aboutsummaryrefslogtreecommitdiff
path: root/py/emitbc.c
AgeCommit message (Collapse)Author
2014-04-10py: Make labels unsigned ints (converted from int).Damien George
Labels should never be negative, and this modified type signature reflects that.
2014-04-09py: Properly implement deletion of locals and derefs, and detect errors.Damien George
Needed to reinstate 2 delete opcodes, to specifically check that a local is not deleted twice.
2014-04-09py, compile: Combine have_star_arg, have_dbl_star_arg into star_flags.Damien George
Small reduction in ROM, heap and stack usage.
2014-04-09py, compiler: Clean up and compress scope/compile structures.Damien George
Convert int types to uint where sensible, and then to uint8_t or uint16_t where possible to reduce RAM usage.
2014-04-08py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR.Damien George
This makes the runtime and object APIs more consistent. mp_store_subscr functionality now moved into objects (ie list and dict store_item).
2014-04-08py: Finish implementation of all del opcodes.Damien George
At this point, all opcodes are now implemented! Some del opcodes have been combined with store opcodes, with the value to store being MP_OBJ_NULL.
2014-04-02py: Move to Python 3.4.0 compatibility.Damien George
Very little has changed. In Python 3.4 they removed the opcode STORE_LOCALS, but in Micro Python we only ever used this for CPython compatibility, so it was a trivial thing to remove. It also allowed to clean up some dead code (eg the 0xdeadbeef in class construction), and now class builders use 1 less stack word. Python 3.4.0 introduced the LOAD_CLASSDEREF opcode, which I have not yet understood. Still, all tests (apart from bytecode test) still pass. Bytecode tests needs some more attention, but they are not that important anymore.
2014-03-31py: Towards default keyword arguments.Damien George
These are default arguments after a bare *.
2014-03-31py: Add LOAD_NULL bytecode and use it to simplify function calls.Damien George
Adding this bytecode allows to remove 4 others related to function/method calls with * and ** support. Will also help with bytecodes that make functions/closures with default positional and keyword args.
2014-03-31py: Rename and reorder parameters in emit_make_function/closure.Damien George
In preparation for implementing default keyword arguments.
2014-03-30Rename rt_* to mp_*.Damien George
Mostly just a global search and replace. Except rt_is_true which becomes mp_obj_is_true. Still would like to tidy up some of the names, but this will do for now.
2014-03-27py: Rename emit_pre so they have globally unique names.Damien George
2014-03-27py: Factor out code from runtime.c to emitglue.c.Damien George
2014-03-27py: Put n_state for bytecode in the bytecode prelude.Damien George
Rationale: setting up the stack (state for locals and exceptions) is really part of the "code", it's the prelude of the function. For example, native code adjusts the stack pointer on entry to the function. Native code doesn't need to know n_state for any other reason. So putting the state size in the bytecode prelude is sensible. It reduced ROM usage on STM by about 30 bytes :) And makes it easier to pass information about the bytecode between functions.
2014-03-27py: Calculate maximum exception stack size in compiler.Damien George
2014-03-26py: Support closures with default args.Paul Sokolovsky
2014-03-17py: Clean up includes.xbe
Remove unnecessary includes. Add includes that improve portability.
2014-02-20emitbc: Correct buffer sizes for varlen int encoding.Paul Sokolovsky
Assuming we have truncating (floor) division, way to do ceiling division by N is to use formula (x + (N-1)) / N. Specifically, 63 bits, if stored 7 bits per byte, require exactly 9 bytes. 64 bits overflow that and require 10 bytes.
2014-02-19Bytecode int varlen encoding: support arbitrary values for signed ints too.Paul Sokolovsky
2014-02-19Bytecode uint varlen encoding: support arbitrary values.Paul Sokolovsky
2014-02-16Support passing positional args as keywords to bytecode functions.Paul Sokolovsky
For this, record argument names along with each bytecode function. The code still includes extensive debug logging support so far.
2014-02-15py: Pass all scope flags through to runtime.Damien George
2014-02-12Replace global "static" -> "STATIC", to allow "analysis builds". Part 2.Paul Sokolovsky
2014-02-01py: Tidy up BINARY_OPs; negation done by special NOT bytecode.Damien George
IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new special NOT bytecode.
2014-02-01py: Implement break/continue from an exception with finally.Damien George
Still todo: break/continue from within the finally block itself.
2014-02-01py: mp_execute_byte_code has 2 arg arrays, for more efficient default params.Damien George
2014-02-01Implement default function arguments (for Python functions).Paul Sokolovsky
TODO: Decide if we really need separate bytecode for creating functions with default arguments - we would need same for closures, then there're keywords arguments too. Having all combinations is a small exponential explosion, likely we need just 2 cases - simplest (no defaults, no kw), and full - defaults & kw.
2014-01-29py: Add compile option to enable/disable source line numbers.Damien George
2014-01-29py: Fix bug with LOAD_METHOD; fix int->machine_int_t for small int.Damien George
LOAD_METHOD bug was: emitbc did not correctly calculate the amount of stack usage for a LOAD_METHOD operation. small int bug was: int was being used to pass small ints, when it should have been machine_int_t.
2014-01-25py: Optimise generated code for working out line numbers.Damien George
2014-01-24py: Improve freeing of emitters in mp_compile.Damien George
There can be multiple emitters allocated during compile (eg byte code and native).
2014-01-24Add support for freeing code emitter objects at the end of compilation.Paul Sokolovsky
2014-01-21Revamp qstrs: they now include length and hash.Damien George
Can now have null bytes in strings. Can define ROM qstrs per port using qstrdefsport.h
2014-01-19py: Add module/function/class name to exceptions.Damien George
Exceptions know source file, line and block name. Also tidy up some debug printing functions and provide a global flag to enable/disable them.
2014-01-18Add source file name and line number to error messages.Damien George
Byte code has a map from byte-code offset to source-code line number, used to give better error messages.
2014-01-11Merge branch 'master' of github.com:dpgeorge/micropythonDamien George
2014-01-11py: Make arg to MP_BC_RAISE_VARARGS a byte.Damien George
2014-01-11unified the bopsJohn R. Lenton
2014-01-04Add ellipsis object.Damien George
2014-01-03Change mp_compile so that it returns a function object for the module.Damien George
2013-12-30py: make closures work.Damien George
2013-12-21Change object representation from 1 big union to individual structs.Damien
A big change. Micro Python objects are allocated as individual structs with the first element being a pointer to the type information (which is itself an object). This scheme follows CPython. Much more flexible, not necessarily slower, uses same heap memory, and can allocate objects statically. Also change name prefix, from py_ to mp_ (mp for Micro Python).
2013-12-12py: remove further unnecessary emit_verbatim code.Damien
2013-12-11py: work towards working closures.Damien
2013-11-05Make byte code jumps relative.Damien
2013-11-04Byte code for SMALL_INT uses 3 bytes for integer.Damien
2013-10-20Add local_num skeleton framework to deref/closure emit calls.Damien
2013-10-18Remove line in emitbc.c to print code size.Damien
2013-10-16Implement BC & runtime support for generator/yielding.Damien
2013-10-12Separate out mpy core and unix version.Damien