- 13 Jun, 2015 1 commit
-
-
Damien George authored
-
- 12 May, 2015 1 commit
-
-
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__".
-
- 11 May, 2015 1 commit
-
-
Paul Sokolovsky authored
I.e. in bytecode Python functions.
-
- 10 May, 2015 1 commit
-
-
Paul Sokolovsky authored
When generator raises exception, it is automatically terminated (by setting its code_state.ip to 0), which interferes with this check. Triggered in particular by CPython's test_pep380.py.
-
- 05 May, 2015 1 commit
-
-
Damien George authored
Ellipsis constant is rarely used so no point having an extra bytecode for it.
-
- 25 Apr, 2015 2 commits
-
-
Paul Sokolovsky authored
This doesn't handle case fo enclosed except blocks, but once again, sys.exc_info() support is a workaround for software which uses it instead of properly catching exceptions via variable in except clause.
-
Paul Sokolovsky authored
The implementation is very basic and non-compliant and provided solely for CPython compatibility. The function itself is bad Python2 heritage, its usage is discouraged.
-
- 24 Apr, 2015 1 commit
-
-
Damien George authored
Before this patch a "with" block needed to create a bound method object on the heap for the __exit__ call. Now it doesn't because we use load_method instead of load_attr, and save the method+self on the stack.
-
- 11 Apr, 2015 1 commit
-
-
Damien George authored
This simplifies the API for objects and reduces code size (by around 400 bytes on Thumb2, and around 2k on x86). Performance impact was measured with Pystone score, but change was barely noticeable.
-
- 09 Apr, 2015 2 commits
-
-
Damien George authored
-
stijn authored
Also prevents some of the weaker syntax parsers out there treating the whole '*/*const*/' part as a comment
-
- 02 Apr, 2015 6 commits
-
-
Damien George authored
Also rename call_args_t to mp_call_args_t.
-
Paul Sokolovsky authored
I.e. in this mode, C stack will never be used to call a Python function, but if there's no free heap for a call, it will be reported as RuntimeError (as expected), not MemoryError.
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
-
- 26 Mar, 2015 1 commit
-
-
stijn authored
Disabled by default. Enabled on unix and windows ports.
-
- 25 Mar, 2015 1 commit
-
-
Damien George authored
Saves around 30 bytes code on Thumb2 archs.
-
- 26 Feb, 2015 1 commit
-
-
Damien George authored
Slightly smaller code, and does not need to use C stack to save temporaries.
-
- 10 Feb, 2015 1 commit
-
-
Damien George authored
Saves 8 bytes C-stack on stmhal and 16 bytes on unix x86.
-
- 08 Feb, 2015 1 commit
-
-
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.
-
- 13 Jan, 2015 1 commit
-
-
Damien George authored
This allows to directly load a Python object to the Python stack. See issue #722 for background.
-
- 07 Jan, 2015 2 commits
-
-
Damien George authored
This is a simple optimisation inspired by JITing technology: we cache in the bytecode (using 1 byte) the offset of the last successful lookup in a map. This allows us next time round to check in that location in the hash table (mp_map_t) for the desired entry, and if it's there use that entry straight away. Otherwise fallback to a normal map lookup. Works for LOAD_NAME, LOAD_GLOBAL, LOAD_ATTR and STORE_ATTR opcodes. On a few tests it gives >90% cache hit and greatly improves speed of code. Disabled by default. Enabled for unix and stmhal ports.
-
Damien George authored
This patch consolidates all global variables in py/ core into one place, in a global structure. Root pointers are all located together to make GC tracing easier and more efficient.
-
- 01 Jan, 2015 1 commit
-
-
Damien George authored
Addresses issue #1022.
-
- 29 Dec, 2014 1 commit
-
-
Damien George authored
This is for efficiency, so we don't need to subtract 1 from the ip before storing it to code_state->ip. It saves a lot of ROM bytes on unix and stmhal.
-
- 28 Dec, 2014 1 commit
-
-
Paul Sokolovsky authored
Mirroring ip to a volatile memory variable for each opcode is an expensive operation. For quite a lot of often executed opcodes like stack manipulation or jumps, exceptions cannot actually happen. So, record ip only for opcode where that's possible.
-
- 22 Dec, 2014 1 commit
-
-
Damien George authored
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.
-
- 12 Dec, 2014 1 commit
-
-
Damien George authored
-
- 02 Dec, 2014 1 commit
-
-
Damien George authored
This makes no change to the generated code, but it's now easier to understand since unum is not a "global" variable anymore.
-
- 25 Oct, 2014 3 commits
-
-
Damien George authored
-
Damien George authored
This allows to implement KeyboardInterrupt on unix, and a much safer ctrl-C in stmhal port. First ctrl-C is a soft one, with hope that VM will notice it; second ctrl-C is a hard one that kills anything (for both unix and stmhal). One needs to check for a pending exception in the VM only for jump opcodes. Others can't produce an infinite loop (infinite recursion is caught by stack check).
-
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.
-
- 04 Sep, 2014 1 commit
-
-
Damien George authored
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.
-
- 26 Aug, 2014 1 commit
-
-
Damien George authored
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.
-
- 31 Jul, 2014 1 commit
-
-
Damien George authored
Reduces by about a factor of 10 on average the amount of RAM needed to store the line-number to bytecode map in the bytecode prelude. Using CPython3.4's stdlib for statistics: previously, an average of 13 bytes were used per (bytecode offset, line-number offset) pair, and now with this improvement, that's down to 1.3 bytes on average. Large RAM usage before was due to some very large steps in line numbers, both from the start of the first line in a function way down in the file, and also functions that have big comments and/or big strings in them (both cases were significant). Although the savings are large on average for the CPython stdlib, it won't have such a big effect for small scripts used in embedded programming. Addresses issue #648.
-
- 03 Jul, 2014 1 commit
-
-
Damien George authored
See discussion in issue #50.
-
- 07 Jun, 2014 2 commits
-
-
Damien George authored
This reduces stack usage by 16 words (64 bytes) for stmhal/ port. See issue #640.
-
Marcus von Appen authored
- Move the includes for alloca() intp mpconfigport.h
-