- 30 Sep, 2016 3 commits
-
-
Damien George authored
Saves 50-100 bytes of code.
-
Damien George authored
On 32-bit archs this makes the scope_t struct 48 bytes in size, which fits in 3 GC blocks (previously it used 4 GC blocks). This will lead to some savings when compiling scripts because there are usually quite a few scopes, one for each function and class. Note that qstrs will fit in 16 bits, this assumption is made in a few other places.
-
Damien George authored
Generates slightly smaller and more efficient code.
-
- 29 Sep, 2016 1 commit
-
-
Paul Sokolovsky authored
Utility functions for keyboard interrupt handling, to be reused across (baremetal) ports.
-
- 28 Sep, 2016 7 commits
-
-
Damien George authored
-
Radomir Dopieralski authored
The memory read/write I2C functions now take an optional keyword-only parameter that specifies the number of bits in the memory address. Only mem-addrs that are a multiple of 8-bits are supported (otherwise the behaviour is undefined). Due to the integer type used for the address, for values larger than 32 bits, only 32 bits of address will be sent, and the rest will be padded with 0s. Right now no exception is raised when that happens. For values smaller than 8, no address is sent. Also no exception then. Tested with a VL6180 sensor, which has 16-bit register addresses. Due to code refactoring, this patch reduces stmhal and esp8266 builds by about 50 bytes.
-
Nicholas Graumann authored
-
Damien George authored
There is now just the exception instance on the stack when an exception is raised, not the full (type, exc, traceback).
-
Damien George authored
-
Damien George authored
-
Damien George authored
Following how other objects work, set/frozenset methods should use the mp_check_self() macro to check the type of the self argument, because in most cases this check can be a null operation. Saves about 100-180 bytes of code for builds with set and frozenset enabled.
-
- 27 Sep, 2016 15 commits
-
-
Damien George authored
It's simpler and improves code coverage.
-
Damien George authored
The native emitter/compiler restricts viper functions to 4 args, so there is no need for an extra check in the dynamic dispatch.
-
Damien George authored
To reset the flags we should write to the single bit only, not the entire register (otherwise all other settings in the register are cleared). Fixes #2457.
-
Damien George authored
-
Damien George authored
-
Damien George authored
-
Alex March authored
-
Alex March authored
-
Alex March authored
-
Damien George authored
Having a micropython.const identity function, and writing "from micropython import const" at the start of scripts that use the const feature, allows to write scripts which are compatible with CPython, and with uPy builds that don't include const optimisation. This patch adds such a function and updates the tests to do the import.
-
Damien George authored
This corresponds to the change in the way exception values are stored on the Python value stack.
-
Damien George authored
-
Damien George authored
-
Damien George authored
-
Damien George authored
When an exception is raised and is to be handled by the VM, it is stored on the Python value stack so the bytecode can access it. CPython stores 3 objects on the stack for each exception: exc type, exc instance and traceback. uPy followed this approach, but it turns out not to be necessary. Instead, it is enough to store just the exception instance on the Python value stack. The only place where the 3 values are needed explicitly is for the __exit__ handler of a with-statement context, but for these cases the 3 values can be extracted from the single exception instance. This patch removes the need to store 3 values on the stack, and instead just stores the exception instance. Code size is reduced by about 50-100 bytes, the compiler and VM are slightly simpler, generate bytecode is smaller (by 2 bytes for each try block), and the Python value stack is reduced in size for functions that handle exceptions.
-
- 24 Sep, 2016 4 commits
-
-
Paul Sokolovsky authored
Fixes for more pedantic warnings.
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
This uses extension introduced in CPython 3.5: if wbits (dictionary size code) has value 16 + 8..15, it means that gzip-formatted stream expected.
-
Paul Sokolovsky authored
-
- 23 Sep, 2016 6 commits
-
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
-
Damien George authored
This fixes constant substitution so that only standalone identifiers are replaced with their constant value (if they have one). I.e. don't replace NAME in expressions like obj.NAME or NAME = expr.
-
Damien George authored
-
Damien George authored
LIST_APPEND, MAP_ADD and SET_ADD have been removed, and STORE_COMP has been added in adaf0d86.
-
Damien George authored
qstrs ids are restricted to fit within 2 bytes already (eg in persistent bytecode) so it's safe to use a uint16_t to store them in mp_arg_t. And the flags member only needs a maximum of 2 bytes so can also use uint16_t. Savings in code size can be significant when many mp_arg_t structs are used for argument parsing. Eg, this patch reduces stmhal by 480 bytes.
-
- 22 Sep, 2016 4 commits
-
-
Paul Sokolovsky authored
In CPython, module-level .wrap_socket() function actually doesn't accept (or document) this param, only SSLContext.wrap_socket() has.
-
Radomir Dopieralski authored
When the clock is too fast for the i2c slave, it can temporarily hold down the scl line to signal to the master that it needs to wait. The master should check the scl line when it is releasing it after transmitting data, and wait for it to be released. This change has been tested with a logic analyzer and an i2c slace implemented on an atmega328p using its twi peripheral, clocked at 8Mhz. Without the change, the i2c communication works up to aboy 150kHz frequency, and above that results in the slave stuck in an unresponsive state. With this change, communication has been tested to work up to 400kHz.
-
Krzysztof Blazewicz authored
-
Krzysztof Blazewicz authored
-