summaryrefslogtreecommitdiffstatshomepage
path: root/py/bc.h
Commit message (Collapse)AuthorAge
* py/bc.h: Rename _mp_code_state to _mp_code_state_t.Damien George2016-08-27
| | | | This rename was missed in the previous patch.
* py: Rename struct mp_code_state to mp_code_state_t.Damien George2016-08-27
| | | | Also at _t to mp_exc_stack pre-declaration in struct typedef.
* py/bc: Use size_t instead of mp_uint_t to count size of state and args.Damien George2015-12-17
|
* py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George2015-11-29
| | | | | | | | | This allows the mp_obj_t type to be configured to something other than a pointer-sized primitive type. This patch also includes additional changes to allow the code to compile when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of mp_uint_t, and various casts.
* py: Use uintptr_t instead of mp_uint_t in MP_TAGPTR_* macros.Damien George2015-11-29
|
* py: Make mp_setup_code_state take concrete pointer for func arg.Damien George2015-11-29
|
* py: Add MICROPY_PERSISTENT_CODE_LOAD/SAVE to load/save bytecode.Damien George2015-11-13
| | | | | | MICROPY_PERSISTENT_CODE must be enabled, and then enabling MICROPY_PERSISTENT_CODE_LOAD/SAVE (either or both) will allow loading and/or saving of code (at the moment just bytecode) from/to a .mpy file.
* py: Add constant table to bytecode.Damien George2015-11-13
| | | | | Contains just argument names at the moment but makes it easy to add arbitrary constants.
* py: Put all bytecode state (arg count, etc) in bytecode.Damien George2015-11-13
|
* py: Reorganise bytecode layout so it's more structured, easier to edit.Damien George2015-11-13
|
* vm: Initial support for calling bytecode functions w/o C stack ("stackless").Paul Sokolovsky2015-04-03
|
* py: Make old_globals part of mp_code_state structure.Paul Sokolovsky2015-02-15
| | | | | Conceptually it is part of code state, so let it be allocated in the same way as the rest of state.
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* showbc: Refactor to allow inline instruction printing.Paul Sokolovsky2014-12-27
|
* py: Reduce size of VM exception stack element by 1 machine word.Damien George2014-12-22
| | | | | | | | | | | This optimisation reduces the VM exception stack element (mp_exc_stack_t) by 1 word, by using bit 1 of a pointer to store whether the opcode was a FINALLY or WITH opcode. This optimisation was pending, waiting for maturity of the exception handling code, which has now proven itself. Saves 1 machine word RAM for each exception (4->3 words per exception). Increases stmhal code by 4 bytes, and decreases unix x64 code by 32 bytes.
* 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: 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: Use variable length encoded uints in more places in bytecode.Damien George2014-09-04
| | | | | | Code-info size, block name, source name, n_state and n_exc_stack now use variable length encoded uints. This saves 7-9 bytes per bytecode function for most functions.
* 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.
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* objgenerator: First iteration of refactor to use mp_setup_code_state().Paul Sokolovsky2014-06-11
|
* py: Merge mp_execute_bytecode into fun_bc_call.Damien George2014-06-07
| | | | | | This reduces stack usage by 16 words (64 bytes) for stmhal/ port. See issue #640.
* showbc: Make sure it's possible to trace MAKE_FUNCTION arg to actual bytecode.Paul Sokolovsky2014-06-03
|
* vm: Factor out structure with code execution state and pass it around.Paul Sokolovsky2014-05-31
| | | | | | | This improves stack usage in callers to mp_execute_bytecode2, and is step forward towards unifying execution interface for function and generators (which is important because generators don't even support full forms of arguments passing (keywords, etc.)).
* py: Rename byte_code to bytecode everywhere.Damien George2014-05-10
| | | | bytecode is the more widely used. See issue #590.
* 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/.
* vm: Add rudimentary bytecode execution tracing capability.Paul Sokolovsky2014-04-23
|
* py: Implement support for generalized generator protocol.Paul Sokolovsky2014-03-30
| | | | Iterators and ducktype objects can now be arguments of yield from.
* py: Rename mp_exc_stack to mp_exc_stack_t.Damien George2014-03-30
|
* vm: Save current active exception on opening new try block.Paul Sokolovsky2014-03-30
| | | | | | | | | | | Required to reraise correct exceptions in except block, regardless if more try blocks with active exceptions happen in the same except block. P.S. This "automagic reraise" appears to be quite wasteful feature of Python - we need to save pending exception just in case it *might* be reraised. Instead, programmer could explcitly capture exception to a variable using "except ... as var", and reraise that. So, consider disabling argless raise support as an optimization.
* py: Put n_state for bytecode in the bytecode prelude.Damien George2014-03-27
| | | | | | | | | | | 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.
* vm: Abstract working with tagged pointers in VM using macro accessors.Paul Sokolovsky2014-03-23
| | | | | Based on issues raised during recent review and inconsistency of different implementations.
* objgenerator: Implement .throw() method to throw exceptions into generator.Paul Sokolovsky2014-03-22
|
* objgenerator: Keep exception stack within generator object, like value stack.Paul Sokolovsky2014-03-22
| | | | This is required to properly handle exceptions across yields.
* py: VM never throws an exception, instead returns a status and value.Damien George2014-02-15
| | | | | Addresses issue #290, and hopefully sets up things to allow generators throwing exceptions, etc.
* py: mp_execute_byte_code has 2 arg arrays, for more efficient default params.Damien George2014-02-01
|
* py: Add module/function/class name to exceptions.Damien George2014-01-19
| | | | | | | Exceptions know source file, line and block name. Also tidy up some debug printing functions and provide a global flag to enable/disable them.
* Add source file name and line number to error messages.Damien George2014-01-18
| | | | | Byte code has a map from byte-code offset to source-code line number, used to give better error messages.
* Change object representation from 1 big union to individual structs.Damien2013-12-21
| | | | | | | | | | 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).
* py: work towards working closures.Damien2013-12-11
|
* py: add skeletal import functionality.Damien2013-12-10
|
* Improve allocation of stack for byte code.Damien2013-11-05
|
* Make byte code jumps relative.Damien2013-11-05
|
* Implement BC & runtime support for generator/yielding.Damien2013-10-16
|
* Rename vm.h to bc.h.Damien2013-10-10
|
* Further factorise PASS_1 out of specific emit code.Damien2013-10-05
|
* Initial commit.Damien2013-10-04