summaryrefslogtreecommitdiff
path: root/py/compile.c
AgeCommit message (Collapse)Author
2014-04-17py: Merge BINARY_OP_SUBSCR and store_subscr (w/ delete) into subscr.Damien George
mp_obj_t->subscr now does load/store/delete.
2014-04-13py: Remove unique_codes from emitglue.c. Replace with pointers.Damien George
Attempt to address issue #386. unique_code_id's have been removed and replaced with a pointer to the "raw code" information. This pointer is stored in the actual byte code (aligned, so the GC can trace it), so that raw code (ie byte code, native code and inline assembler) is kept only for as long as it is needed. In memory it's now like a tree: the outer module's byte code points directly to its children's raw code. So when the outer code gets freed, if there are no remaining functions that need the raw code, then the children's code gets freed as well. This is pretty much like CPython does it, except that CPython stores indexes in the byte code rather than machine pointers. These indices index the per-function constant table in order to find the relevant code.
2014-04-12py: Improve inline assembler; improve compiler constant folding.Damien George
2014-04-12py, compiler: Fix up creation of default positionals tuple.Damien George
With new order of evaluation of defaults, creating the tuple was done in the wrong spot.
2014-04-11py, compiler: Fix compiling of keyword args following named star.Damien George
2014-04-11py: Change compile order for default positional and keyword args.Damien George
This simplifies the compiler a little, since now it can do 1 pass over a function declaration, to determine default arguments. I would have done this originally, but CPython 3.3 somehow had the default keyword args compiled before the default position args (even though they appear in the other order in the text of the script), and I thought it was important to have the same order of execution when evaluating default arguments. CPython 3.4 has changed the order to the more obvious one, so we can also change.
2014-04-11py, compiler: Allow lambda's to yield.Damien George
2014-04-11py: Implement compiling of *-expr within parenthesis.Damien George
2014-04-10py: Add simple way of looking up constants in compiler.Damien George
Working towards trying to support compile-time constants (see discussion in issue #227), this patch allows the compiler to look inside arbitrary uPy objects at compile time. The objects to search are given by the macro MICROPY_EXTRA_CONSTANTS (so they must be constant/ROM objects), and the constant folding occures on forms base.attr (both base and attr must be id's). It works, but it breaks strict CPython compatibility, since the lookup will succeed even without importing the namespace.
2014-04-10py: Simplify stack get/set to become stack adjust in emitters.Damien George
Can do this now that the stack size calculation is improved.
2014-04-10py, compiler: Improve stack depth counting.Damien George
Much less of a hack now. Hopefully it's correct!
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-10py, compiler: Implement compiling of relative imports.Damien George
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, compiler: Turn id_info_t.param into a set of flags.Damien George
So we can add more flags.
2014-04-09py, compile: Simplify initialisation of compiler structure.Damien George
2014-04-09py, compile: Reduce size of compiler structure.Damien George
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: implement UNPACK_EX byte code (for: a, *b, c = d)Damien George
2014-04-08py: Improve compiler syntax errors; catch more errors.Damien George
2014-04-06py: Implement more features in native emitter.Damien George
On x64, native emitter now passes 70 of the tests.
2014-04-06py: Add option to compiler to specify default code emitter.Damien George
Also add command line option to unix port to select emitter.
2014-04-04py: Enable optimisation of multiplying 2 small ints in compiler.Damien George
2014-04-04py: This time, real proper overflow checking of small int power.Damien George
Previous overflow test was inadequate.
2014-04-02py: Wrap compile_scope_inline_asm in #if; remove comment from misc.h.Damien George
2014-04-02py: Enable a jump optimisation in the compiler.Damien George
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: Fix bug in optimised for .. range.Damien George
Don't store final, failing value to the loop variable. This fix also makes for .. range a bit more efficient, as it uses less store/load pairs for the loop variable.
2014-03-31py: Towards default keyword arguments.Damien George
These are default arguments after a bare *.
2014-03-31Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-03-31py: Rename and reorder parameters in emit_make_function/closure.Damien George
In preparation for implementing default keyword arguments.
2014-03-31compile: Don't try to constant-fold division by zero.Paul Sokolovsky
The way it is, just crashes app. And optimizing to "raise ZeroDivisionError" is probably too much.
2014-03-30py: Fix bug in compiler for empty class bases.Damien George
Eg class A(): pass would fail an assertion.
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-30compile: Print error messages on unimplemented relative imports.Paul Sokolovsky
2014-03-29Merge pull request #389 from pfalcon/with-statementDamien George
With statement implementation
2014-03-29py: Free unique_code slot for outer module.Damien George
Partly (very partly!) addresses issue #386. Most importantly, at the REPL command line, each invocation does not now lead to increased memory usage (unless you define a function/lambda).
2014-03-29vm: Implement "with" statement (SETUP_WITH and WITH_CLEANUP bytecodes).Paul Sokolovsky
2014-03-27py: Factor out code from runtime.c to emitglue.c.Damien George
2014-03-27py: Calculate maximum exception stack size in compiler.Damien George
2014-03-26py: Restore CPython compatibility in compiler for closures with def args.Damien George
2014-03-26py: Support closures with default args.Paul Sokolovsky
2014-03-22Fixed floor division on mp ints and small ints. Added a floordivide test case.Rachel Dowdall
2014-03-22Fixed modulo operator on ints and mp ints to agree with python. Added ↵Rachel Dowdall
intdivmod.c and tests/basics/modulo.py.
2014-03-17py: Clean up includes.xbe
Remove unnecessary includes. Add includes that improve portability.
2014-03-03py: Unify syntax error handling in compiler; check defualt arg syntax.Damien George
Checks for non-default args following default args, and errors out. Addresses issue #328.
2014-02-26py: Remove name of var arg from macros with var args.Damien George
2014-02-22parse: Refactor parse node encoding to support full range of small ints.Paul Sokolovsky
Based on suggestion by @dpgeorge at https://github.com/micropython/micropython/pull/313
2014-02-21parse: Note that fact that parser's small ints are different than VM small int.Paul Sokolovsky
Specifically, VM's small ints are 31 bit, while parser's only 28. There's already MP_OBJ_FITS_SMALL_INT(), so, for clarity, rename MP_FIT_SMALL_INT() to MP_PARSE_FITS_SMALL_INT().