summaryrefslogtreecommitdiffstatshomepage
path: root/py/compile.c
Commit message (Collapse)AuthorAge
* py: Fix bug with right-shifting small ints by large amounts.Paul Sokolovsky2014-11-02
| | | | Undefined behavior in C, needs explicit check.
* py: Add more compiler optimisations for constant if/while conditions.Damien George2014-10-17
|
* py: Simplify compilation of elif blocks.Damien George2014-10-17
|
* py: Fix compiling of nested while/for and exception handler.Damien George2014-10-17
| | | | Addresses issue #912.
* py: Make compiler return a proper exception on SyntaxError.Damien George2014-10-05
|
* py: Fix unix-cpy to compile with uint->mp_uint_t changes.Damien George2014-10-03
|
* py: Change [u]int to mp_[u]int_t in qstr.[ch], and some other places.Damien George2014-10-03
| | | | This should pretty much resolve issue #50.
* py: Convert [u]int to mp_[u]int_t where appropriate.Damien George2014-10-03
| | | | Addressing issue #50.
* py: Free non-interned strings in the parser when not needed.Damien George2014-09-23
| | | | | | | | | | | mp_parse_node_free now frees the memory associated with non-interned strings. And the parser calls mp_parse_node_free when discarding a non-used node (such as a doc string). Also, the compiler now frees the parse tree explicitly just before it exits (as opposed to relying on the caller to do this). Addresses issue #708 as best we can.
* py: Convert [u]int to mp_[u]int_t in emit.h and associated .c files.Damien George2014-09-08
| | | | Towards resolving issue #50.
* py: Add support for emitting native x86 machine code.Damien George2014-09-06
|
* Code style/whitespace cleanup; remove obsolete headers.Damien George2014-09-03
| | | | And move the MAP_ANON redefinition from py/asmx64.c to unix/alloc.c.
* py: Add compiler optimisation for conditions in parenthesis.Damien George2014-08-29
| | | | | | | Optimises: if () -> if False if (x,...) -> if True if (a and b) -> if a and b
* Basic native ARM emitterFabian Vogt2014-08-27
|
* py: Fix typing of viper locals; allow default types in annotation.Damien George2014-08-15
|
* py: Allow viper to have type annotations.Damien George2014-08-15
| | | | | | | | | Viper functions can now be annotated with the type of their arguments and return value. Eg: @micropython.viper def f(x:int) -> int: return x + 1
* py: Clean up and simplify functions in scope; add STATIC in compiler.Damien George2014-08-15
| | | | | Some small code clean-ups that result in about 80 bytes ROM saving for stmhal.
* moductypes: Foreign data interface module, roughly based on ctype ideas.Paul Sokolovsky2014-07-09
| | | | | But much smaller and memory-efficient. Uses Python builtin data structures (dict, tuple, int) to describe structure layout.
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* py: Improvements to native emitter.Damien George2014-06-30
| | | | | | | | | | | Native emitter can now compile try/except blocks using nlr_push/nlr_pop. It probably only works for 1 level of exception handling. It doesn't work on Thumb (only x64). Native emitter can also handle some additional op codes. With this patch, 198 tests now pass using "-X emit=native" option to micropython.
* py: Include mpconfig.h before all other includes.Paul Sokolovsky2014-06-21
| | | | | | It defines types used by all other headers. Fixes #691.
* Prefix ARRAY_SIZE with micropython prefix MP_Emmanuel Blot2014-06-19
|
* py: Implement default keyword only args.Damien George2014-06-07
| | | | Should finish addressing issue #524.
* py: Fix stack underflow with optimised for loop.Damien George2014-05-31
|
* py: Fix break from within a for loop.Damien George2014-05-30
| | | | | | | Needed to pop the iterator object when breaking out of a for loop. Need also to be careful to unwind exception handler before popping iterator. Addresses issue #635.
* py: Fix check of small-int overflow when parsing ints.Damien George2014-05-28
| | | | Also unifies use of SMALL_INT_FITS macro across parser and runtime.
* py: Don't automatically intern strings in parser.Damien George2014-05-25
| | | | | | | | This completes non-automatic interning of strings in the parser, so that doc strings don't take up RAM. It complicates the parser and compiler, and bloats stmhal by about 300 bytes. It's complicated because now there are 2 kinds of parse-nodes that can be strings: interned leaves and non-interned structs.
* Tidy up some configuration options.Damien George2014-05-21
| | | | | | | | | | MP_ALLOC_* -> MICROPY_ALLOC_* MICROPY_PATH_MAX -> MICROPY_ALLOC_PATH_MAX MICROPY_ENABLE_REPL_HELPERS -> MICROPY_HELPER_REPL MICROPY_ENABLE_LEXER_UNIX -> MICROPY_HELPER_LEXER_UNIX MICROPY_EXTRA_* -> MICROPY_PORT_* See issue #35.
* py: Rename BYTE_CODE to BYTECODE (this was missed in previous rename).Damien George2014-05-12
|
* py: Rename byte_code to bytecode everywhere.Damien George2014-05-10
| | | | bytecode is the more widely used. See issue #590.
* py, compiler: Add basic support for A=const(123).Damien George2014-05-08
| | | | | | | | | | | You can now do: X = const(123) Y = const(456 + X) and the compiler will replace X and Y with their values. See discussion in issue #266 and issue #573.
* py, compiler: Improve passes; add an extra pass for native emitter.Damien George2014-05-07
|
* py, compiler: Start adding support for compile-time constants.Damien George2014-05-07
| | | | Just a start, no working code yet. As per issue #573.
* Add license header to (almost) all files.Damien George2014-05-03
| | | | | | | Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
* py: Add '*' qstr for 'import *'; use blank qstr for comprehension arg.Damien George2014-04-27
|
* py: Remove unnecessary LOAD_CONST_ID bytecode.Damien George2014-04-27
| | | | It's the same as LOAD_CONST_STR.
* py: Save some ROM by shortening compiler error messages.Damien George2014-04-27
| | | | Messages are still explanatory, while taking a little less ROM.
* py: Change the way function arguments are compiled.Damien George2014-04-27
| | | | | | | | New way uses slightly less ROM and RAM, should be slightly faster, and, most importantly, allows to catch the error "non-keyword arg following keyword arg". Addresses issue #466.
* py: Implement keyword-only args.Damien George2014-04-27
| | | | | | | Implements 'def f(*, a)' and 'def f(*a, b)', but not default keyword-only args, eg 'def f(*, a=1)'. Partially addresses issue #524.
* Add ARRAY_SIZE macro, and use it where possible.Damien George2014-04-26
|
* py: Add MICROPY_ENABLE_DOC_STRING, disabled by default.Damien George2014-04-25
| | | | | | Also add a few STATIC's to some compile functions that should have them. Addresses issue #521.
* py: Add 'align' and 'data' meta-instructions to inline assembler.Damien George2014-04-21
|
* py: Making closures now passes pointer to stack, not a tuple for vars.Damien George2014-04-20
| | | | | | | Closed over variables are now passed on the stack, instead of creating a tuple and passing that. This way memory for the closed over variables can be allocated within the closure object itself. See issue #510 for background.
* py: Merge BINARY_OP_SUBSCR and store_subscr (w/ delete) into subscr.Damien George2014-04-17
| | | | mp_obj_t->subscr now does load/store/delete.
* py: Remove unique_codes from emitglue.c. Replace with pointers.Damien George2014-04-13
| | | | | | | | | | | | | | | | 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.
* py: Improve inline assembler; improve compiler constant folding.Damien George2014-04-12
|
* py, compiler: Fix up creation of default positionals tuple.Damien George2014-04-12
| | | | | With new order of evaluation of defaults, creating the tuple was done in the wrong spot.
* py, compiler: Fix compiling of keyword args following named star.Damien George2014-04-11
|
* py: Change compile order for default positional and keyword args.Damien George2014-04-11
| | | | | | | | | | | 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.
* py, compiler: Allow lambda's to yield.Damien George2014-04-11
|