- Mar 05, 2019
-
-
Damien George authored
POP_BLOCK and POP_EXCEPT are now the same, and are always followed by a JUMP. So this optimisation reduces code size, and RAM usage of bytecode by two bytes for each try-except handler.
-
- Oct 04, 2017
-
-
Damien George authored
2 non-bytecode binary ops (NOT_IN and IN_NOT) are moved out of the bytecode group, so this change will change the bytecode format.
-
- Sep 25, 2017
-
-
Paul Sokolovsky authored
Not all can, so we don't need to reserve bytecodes for them, and can use free slots for something else later.
-
- Jul 31, 2017
-
-
Alexander Steffen authored
There were several different spellings of MicroPython present in comments, when there should be only one.
-
- Jul 18, 2017
-
-
Alexander Steffen authored
The code conventions suggest using header guards, but do not define how those should look like and instead point to existing files. However, not all existing files follow the same scheme, sometimes omitting header guards altogether, sometimes using non-standard names, making it easy to accidentally pick a "wrong" example. This commit ensures that all header files of the MicroPython project (that were not simply copied from somewhere else) follow the same pattern, that was already present in the majority of files, especially in the py folder. The rules are as follows. Naming convention: * start with the words MICROPY_INCLUDED * contain the full path to the file * replace special characters with _ In addition, there are no empty lines before #ifndef, between #ifndef and one empty line before #endif. #endif is followed by a comment containing the name of the guard macro. py/grammar.h cannot use header guards by design, since it has to be included multiple times in a single C file. Several other files also do not need header guards as they are only used internally and guaranteed to be included only once: * MICROPY_MPHALPORT_H * mpconfigboard.h * mpconfigport.h * mpthreadport.h * pin_defs_*.h * qstrdefs*.h
-
- Apr 22, 2017
-
-
Damien George authored
This patch allows the following code to run without allocating on the heap: super().foo(...) Before this patch such a call would allocate a super object on the heap and then load the foo method and call it right away. The super object is only needed to perform the lookup of the method and not needed after that. This patch makes an optimisation to allocate the super object on the C stack and discard it right after use. Changes in code size due to this patch are: bare-arm: +128 minimal: +232 unix x64: +416 unix nanbox: +364 stmhal: +184 esp8266: +340 cc3200: +128
-
- Feb 16, 2017
-
-
Damien George authored
So that the "for x in it: ..." statement can now work without using the heap (so long as the iterator argument fits in an iter_buf structure).
-
- Sep 19, 2016
-
-
Damien George authored
With the previous patch combining 3 emit functions into 1, it now makes sense to also combine the corresponding VM opcodes, which is what this patch does. This eliminates 2 opcodes which simplifies the VM and reduces code size, in bytes: bare-arm:44, minimal:64, unix(NDEBUG,x86-64):272, stmhal:92, esp8266:200. Profiling (with a simple script that creates many list/dict/set comprehensions) shows no measurable change in performance.
-
- Dec 10, 2015
-
-
Damien George authored
Fixes #1684 and makes "not" match Python semantics. The code is also simplified (the separate MP_BC_NOT opcode is removed) and the patch saves 68 bytes for bare-arm/ and 52 bytes for minimal/. Previously "not x" was implemented as !mp_unary_op(x, MP_UNARY_OP_BOOL), so any given object only needs to implement MP_UNARY_OP_BOOL (and the VM had a special opcode to do the ! bit). With this patch "not x" is implemented as mp_unary_op(x, MP_UNARY_OP_NOT), but this operation is caught at the start of mp_unary_op and dispatched as !mp_obj_is_true(x). mp_obj_is_true has special logic to test for truthness, and is the correct way to handle the not operation.
-
- Jun 25, 2015
-
-
Damien George authored
Previous to this patch each time a bytes object was referenced a new instance (with the same data) was created. With this patch a single bytes object is created in the compiler and is loaded directly at execute time as a true constant (similar to loading bignum and float objects). This saves on allocating RAM and means that bytes objects can now be used when the memory manager is locked (eg in interrupts). The MP_BC_LOAD_CONST_BYTES bytecode was removed as part of this. Generated bytecode is slightly larger due to storing a pointer to the bytes object instead of the qstr identifier. Code size is reduced by about 60 bytes on Thumb2 architectures.
-
- Jun 13, 2015
-
-
Damien George authored
-
- May 12, 2015
-
-
Damien George authored
Hashing is now done using mp_unary_op function with MP_UNARY_OP_HASH as the operator argument. Hashing for int, str and bytes still go via fast-path in mp_unary_op since they are the most common objects which need to be hashed. This lead to quite a bit of code cleanup, and should be more efficient if anything. It saves 176 bytes code space on Thumb2, and 360 bytes on x86. The only loss is that the error message "unhashable type" is now the more generic "unsupported type for __hash__".
-
- May 05, 2015
-
-
Damien George authored
Ellipsis constant is rarely used so no point having an extra bytecode for it.
-
- Feb 08, 2015
-
-
Damien George authored
Previous to this patch, a big-int, float or imag constant was interned (made into a qstr) and then parsed at runtime to create an object each time it was needed. This is wasteful in RAM and not efficient. Now, these constants are parsed straight away in the parser and turned into objects. This allows constants with large numbers of digits (so addresses issue #1103) and takes us a step closer to #722.
-
- Jan 13, 2015
-
-
Damien George authored
This allows to directly load a Python object to the Python stack. See issue #722 for background.
-
- Jan 01, 2015
-
-
Damien George authored
Addresses issue #1022.
-
- Oct 25, 2014
-
-
Damien George authored
There is a lot potential in compress bytecodes and make more use of the coding space. This patch introduces "multi" bytecodes which have their argument included in the bytecode (by addition). UNARY_OP and BINARY_OP now no longer take a 1 byte argument for the opcode. Rather, the opcode is included in the first byte itself. LOAD_FAST_[0,1,2] and STORE_FAST_[0,1,2] are removed in favour of their multi versions, which can take an argument between 0 and 15 inclusive. The majority of LOAD_FAST/STORE_FAST codes fit in this range and so this saves a byte for each of these. LOAD_CONST_SMALL_INT_MULTI is used to load small ints between -16 and 47 inclusive. Such ints are quite common and now only need 1 byte to store, and now have much faster decoding. In all this patch saves about 2% RAM for typically bytecode (1.8% on 64-bit test, 2.5% on pyboard test). It also reduces the binary size (because bytecodes are simplified) and doesn't harm performance.
-
- May 03, 2014
-
-
Damien George authored
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/.
-
- Apr 27, 2014
-
-
Damien George authored
It's the same as LOAD_CONST_STR.
-
- Apr 20, 2014
-
-
Damien George authored
3 emitter functions are needed only for emitcpy, and so we can #if them out when compiling with emitcpy support. Also remove unused SETUP_LOOP bytecode.
-
- Apr 17, 2014
-
-
Damien George authored
mp_obj_t->subscr now does load/store/delete.
-
- Apr 12, 2014
-
-
Damien George authored
This is necessary to catch all cases where locals are referenced before assignment. We still keep the _0, _1, _2 versions of LOAD_FAST to help reduced the byte code size in RAM. Addresses issue #457.
-
- Apr 09, 2014
-
-
Damien George authored
Needed to reinstate 2 delete opcodes, to specifically check that a local is not deleted twice.
-
- Apr 08, 2014
-
-
Damien George authored
This makes the runtime and object APIs more consistent. mp_store_subscr functionality now moved into objects (ie list and dict store_item).
-
Damien George authored
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.
-
- Mar 31, 2014
-
-
Damien George authored
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.
-
- Mar 26, 2014
-
-
Paul Sokolovsky authored
-
- Feb 01, 2014
-
-
Damien George authored
IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new special NOT bytecode.
-
Damien George authored
Still todo: break/continue from within the finally block itself.
-
Paul Sokolovsky authored
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.
-
- Jan 11, 2014
-
-
Damien George authored
-
John R. Lenton authored
-
- Jan 04, 2014
-
-
Damien George authored
-
- Dec 30, 2013
-
-
Damien George authored
-
- Dec 21, 2013
-
-
Damien authored
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).
-