summaryrefslogtreecommitdiffstatshomepage
path: root/py/emitglue.c
Commit message (Collapse)AuthorAge
* unix: Make -v dump memory info at exit.Paul Sokolovsky2014-10-26
| | | | Also, move bytecode dumps to -v -v, because they're too verbose for just -v.
* py: Store bytecode arg names in bytecode (were in own array).Damien George2014-10-25
| | | | | | | | | | | | | | | | | | | | This saves a lot of RAM for 2 reasons: 1. For functions that don't have default values, var args or var kw args (which is a large number of functions in the general case), the mp_obj_fun_bc_t type now fits in 1 GC block (previously needed 2 because of the extra pointer to point to the arg_names array). So this saves 16 bytes per function (32 bytes on 64-bit machines). 2. Combining separate memory regions generally saves RAM because the unused bytes at the end of the GC block are saved for 1 of the blocks (since that block doesn't exist on its own anymore). So generally this saves 8 bytes per function. Tested by importing lots of modules: - 64-bit Linux gave about an 8% RAM saving for 86k of used RAM. - pyboard gave about a 6% RAM saving for 31k of used RAM.
* py: Fix debug-printing of bytecode line numbers.Damien George2014-10-24
| | | | Also move the raw bytecode printing code from emitglue to mp_bytecode_print.
* py: Fix line number printing for file with 1 line.Damien George2014-08-26
| | | | | | | | | | With a file with 1 line (and an error on that line), used to show the line as number 0. Now shows it correctly as line number 1. But, when line numbers are disabled, it now prints line number 1 for any line that has an error (instead of 0 as previously). This might end up being confusing, but requires extra RAM and/or hack logic to make it print something special in the case of no line numbers.
* py: Fix bug where GC collected native/viper/asm function data.Damien George2014-08-24
| | | | | | | | Because (for Thumb) a function pointer has the LSB set, pointers to dynamic functions in RAM (eg native, viper or asm functions) were not being traced by the GC. This patch is a comprehensive fix for this. Addresses issue #820.
* 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
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* py: Include mpconfig.h before all other includes.Paul Sokolovsky2014-06-21
| | | | | | It defines types used by all other headers. Fixes #691.
* py: Implement default keyword only args.Damien George2014-06-07
| | | | Should finish addressing issue #524.
* showbc: Make micropython -v also dump bytecode in hex form.Paul Sokolovsky2014-06-03
|
* showbc: Make sure it's possible to trace MAKE_FUNCTION arg to actual bytecode.Paul Sokolovsky2014-06-03
|
* py: Remove emit_glue init and deinit. Needed only for debugging.Damien George2014-05-12
| | | | | Debugging output for emit_glue now simplified so that the init and deinit functions are no longer needed.
* py: Combine native emitters to 1 glue function; distinguish viper.Damien George2014-05-10
| | | | | | | | This patch simplifies the glue between native emitter and runtime, and handles viper code like inline assember: return values are converted to Python objects. Fixes issue #531.
* py: Rename byte_code to bytecode everywhere.Damien George2014-05-10
| | | | bytecode is the more widely used. See issue #590.
* py, unix: Add -v option, print bytecode dump if used.Paul Sokolovsky2014-05-05
| | | | | | | | | | This will work if MICROPY_DEBUG_PRINTERS is defined, which is only for unix/windows ports. This makes it convenient to user uPy normally, but easily get bytecode dump on the spot if needed, without constant recompiles back and forth. TODO: Add more useful debug output, adjust verbosity level on which specifically bytecode dump happens.
* 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: 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.
* emitglue: Typo fix in var name.Paul Sokolovsky2014-04-23
|
* 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: 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: 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: Implement more features in native emitter.Damien George2014-04-06
| | | | On x64, native emitter now passes 70 of the tests.
* py: Towards default keyword arguments.Damien George2014-03-31
| | | | These are default arguments after a bare *.
* Rename rt_* to mp_*.Damien George2014-03-30
| | | | | | | 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.
* py: Free unique_code slot for outer module.Damien George2014-03-29
| | | | | | 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).
* py: Fix bugs with debugging output.Damien George2014-03-28
| | | | | | | show_bc now decodes the prelude correctly. Moved WRITE_FILE stuff from runtime.c to emitglue.c. Addresses issue #385.
* py: Factor out code from runtime.c to emitglue.c.Damien George2014-03-27