- 21 Sep, 2016 1 commit
-
-
Damien George authored
One can instead lookup __name__ in the modules dict to get the value.
-
- 02 Sep, 2016 1 commit
-
-
Damien George authored
-
- 12 Aug, 2016 1 commit
-
-
Paul Sokolovsky authored
Introduce mp_raise_msg(), mp_raise_ValueError(), mp_raise_TypeError() instead of previous pattern nlr_raise(mp_obj_new_exception_msg(...)). Save few bytes on each call, which are many.
-
- 28 Jun, 2016 1 commit
-
-
Damien George authored
This makes the VM/runtime thread safe, at the cost of not being able to run code in parallel.
-
- 07 May, 2016 1 commit
-
-
Damien George authored
-
- 21 Apr, 2016 1 commit
-
-
Damien George authored
Addresses issue #1998.
-
- 14 Mar, 2016 1 commit
-
-
Damien George authored
Passing an mp_uint_t to a %d printf format is incorrect for builds where mp_uint_t is larger than word size (eg a nanboxing build). This patch adds some simple casting to int in these cases.
-
- 29 Jan, 2016 1 commit
-
-
Paul Sokolovsky authored
Calling it from mp_init() is too late for some ports (like Unix), and leads to incomplete stack frame being captured, with following GC issues. So, now each port should call mp_stack_ctrl_init() on its own, ASAP after startup, and taking special precautions so it really was called before stack variables get allocated (because if such variable with a pointer is missed, it may lead to over-collecting (typical symptom is segfaulting)).
-
- 11 Jan, 2016 1 commit
-
-
Damien George authored
This patch changes the type signature of .make_new and .call object method slots to use size_t for n_args and n_kw (was mp_uint_t. Makes code more efficient when mp_uint_t is larger than a machine word. Doesn't affect ports when size_t and mp_uint_t have the same size.
-
- 08 Jan, 2016 1 commit
-
-
Damien George authored
-
- 26 Dec, 2015 1 commit
-
-
Damien George authored
When looking up and extracting an attribute of an instance, some attributes must bind self as the first argument to make a working method call. Previously to this patch, any attribute that was callable had self bound as the first argument. But Python specs require the check to be more restrictive, and only functions, closures and generators should have self bound as the first argument Addresses issue #1675.
-
- 18 Dec, 2015 1 commit
-
-
Damien George authored
MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler, which is useful when only loading of pre-compiled bytecode is supported. It is enabled by default. MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin functions. By default they are only included if MICROPY_ENABLE_COMPILER is enabled. Disabling both options saves about 40k of code size on 32-bit x86.
-
- 10 Dec, 2015 1 commit
-
-
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.
-
- 09 Dec, 2015 1 commit
-
-
Damien George authored
Addresses issue #1697.
-
- 03 Dec, 2015 1 commit
-
-
Damien George authored
Addresses issue #1678.
-
- 29 Nov, 2015 1 commit
-
-
Damien George authored
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.
-
- 20 Oct, 2015 1 commit
-
-
Damien George authored
-
- 11 Oct, 2015 1 commit
-
-
Paul Sokolovsky authored
-
- 01 Oct, 2015 2 commits
-
-
Damien George authored
With this patch parse nodes are allocated sequentially in chunks. This reduces fragmentation of the heap and prevents waste at the end of individually allocated parse nodes. Saves roughly 20% of RAM during parse stage.
-
Damien George authored
-
- 26 Jun, 2015 1 commit
-
-
Paul Sokolovsky authored
-
- 25 Jun, 2015 2 commits
-
-
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.
-
Damien George authored
-
- 20 Jun, 2015 1 commit
-
-
Damien George authored
Previous to this patch a call such as list.append(1, 2) would lead to a seg fault. This is because list.append is a builtin method and the first argument to such methods is always assumed to have the correct type. Now, when a builtin method is extracted like this it is wrapped in a checker object which checks the the type of the first argument before calling the builtin function. This feature is contrelled by MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG and is enabled by default. See issue #1216.
-
- 13 Jun, 2015 1 commit
-
-
Damien George authored
-
- 03 Jun, 2015 1 commit
-
-
Damien George authored
Eg, builtin map can map over a map, etc, and call iternext deeply. Addresses issue #1294.
-
- 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__".
-
- 09 May, 2015 2 commits
-
-
Paul Sokolovsky authored
Exceptions in .close() should be ignored (dumped to sys.stderr, not propagated), but in uPy, they are propagated. Fix would require nlr-wrapping .close() call, which is expensive. Bu on the other hand, .close() is not called often, so maybe that's not too bad (depends, if it's finally called and that causes stack overflow, there's nothing good in that). And yet on another hand, .close() can be implemented to catch exceptions on its side, and that should be the right choice.
-
Paul Sokolovsky authored
Testing for incorrect value led to premature termination of generator containing yield from for such iterator (e.g. "yield from [1, 2]").
-
- 16 Apr, 2015 1 commit
-
-
Damien George authored
-
- 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.
-
- 02 Apr, 2015 2 commits
-
-
Damien George authored
Also rename call_args_t to mp_call_args_t.
-
Paul Sokolovsky authored
Allow for reuse for stackless design, where preparing args is separate from calling.
-
- 21 Mar, 2015 1 commit
-
-
Damien George authored
Despite initial guess, this code factoring does not hamper performance. In fact it seems to improve speed by a little: running pystone(1.2) on pyboard (which gives a very stable result) this patch takes pystones from 1729.51 up to 1742.16. Also, pystones on x64 increase by around the same proportion (but it's much noisier). Taking a look at the generated machine code, stack usage with this patch is unchanged, and call is tail-optimised with all arguments in registers. Code size decreases by about 50 bytes on Thumb2 archs.
-
- 20 Mar, 2015 1 commit
-
-
Paul Sokolovsky authored
"Base" should rather refer to "base type"."Base object for attribute lookup" should rather be just "object". Also, a case of common subexpression elimination.
-
- 03 Mar, 2015 1 commit
-
-
Paul Sokolovsky authored
-
- 15 Feb, 2015 1 commit
-
-
Damien George authored
-
- 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.
-
- 07 Feb, 2015 1 commit
-
-
Damien George authored
To enable parsing constants more efficiently, mp_parse should be allowed to raise an exception, and mp_compile can already raise a MemoryError. So these functions need to be protected by an nlr push/pop block. This patch adds that feature in all places. This allows to simplify how mp_parse and mp_compile are called: they now raise an exception if they have an error and so explicit checking is not needed anymore.
-
- 27 Jan, 2015 1 commit
-
-
Damien George authored
Eg, "() + 1" now tells you that __add__ is not supported for tuple and int types (before it just said the generic "binary operator"). We reuse the table of names for slot lookup because it would be a waste of code space to store the pretty name for each operator.
-