summaryrefslogtreecommitdiffstatshomepage
path: root/py
Commit message (Collapse)AuthorAge
* py: Add include guards to mpconfig,misc,qstr,obj,runtime,parsehelper.Damien George2014-12-29
|
* py: In VM, for selective ip saving, store 1 byte past last opcode.Damien George2014-12-29
| | | | | | 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.
* py: Add note about -fno-crossjumping when compiling vm.c.Paul Sokolovsky2014-12-29
|
* py: Add MP_LIKELY(), MP_UNLIKELY() macros to help branch prediction.v1.3.8Paul Sokolovsky2014-12-29
|
* showbc: Print operation mnemonic in BINARY_OP.Paul Sokolovsky2014-12-28
|
* showbc: Make code object start pointer semi-public.Paul Sokolovsky2014-12-28
| | | | | This allows to pring either absolute addresses or relative offsets in jumps and code references.
* vm: Record exception ip only for instructions where exceptions may happen.Paul Sokolovsky2014-12-28
| | | | | | | 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.
* py: Allow to properly disable builtin slice operation.Damien George2014-12-27
| | | | | | | This patch makes the MICROPY_PY_BUILTINS_SLICE compile-time option fully disable the builtin slice operation (when set to 0). This includes removing the slice sytanx from the grammar. Now, enabling slice costs 4228 bytes on unix x64, and 1816 bytes on stmhal.
* py: Allow to properly disable builtin "set" object.Damien George2014-12-27
| | | | | | | | This patch makes MICROPY_PY_BUILTINS_SET compile-time option fully disable the builtin set object (when set to 0). This includes removing set constructor/comprehension from the grammar, the compiler and the emitters. Now, enabling set costs 8168 bytes on unix x64, and 3576 bytes on stmhal.
* py: Move to guarded includes for compile.h and related headers.Paul Sokolovsky2014-12-27
|
* showbc: Refactor to allow inline instruction printing.Paul Sokolovsky2014-12-27
|
* py: Make bytes objs work with more str methods; add tests.Damien George2014-12-24
|
* 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: Use str_to_int function in more places to reduce code size.Damien George2014-12-21
|
* py: Remove last uses of printf from compile; use proper SyntaxError.Damien George2014-12-21
|
* py: Move global/nonlocal decl code to compiler for proper SyntaxError.Damien George2014-12-21
| | | | | | This patch gives proper SyntaxError exceptions for bad global/nonlocal declarations. It also reduces code size: 304 bytes on unix x64, 132 bytes on stmhal.
* py: Fix iteration over map in 2 places.Damien George2014-12-21
|
* py: Remove unnecessary RULE_none and PN_none from parser.Damien George2014-12-20
|
* py: Add blank and ident flags to grammar rules to simplify parser.Damien George2014-12-20
| | | | This saves around 100 bytes code space on stmhal, more on unix.
* py: Save a few code bytes in parser; make vars local where possible.Damien George2014-12-20
|
* py: Add execfile function (from Python 2); enable in stmhal port.Damien George2014-12-19
| | | | Adds just 60 bytes to stmhal binary. Addresses issue #362.
* asmarm: Fix bug with encoding small negative ints using MVN instruction.Paul Sokolovsky2014-12-14
|
* py: Fix optimised for-loop compiler so it follows proper semantics.Damien George2014-12-12
| | | | | | | | | You can now assign to the range end variable and the for-loop still works correctly. This fully addresses issue #565. Also fixed a bug with the stack not being fully popped when breaking out of an optimised for-loop (and it's actually impossible to write a test for this case!).
* py: Fix label printing in showbc; print sp in vm trace.Damien George2014-12-12
|
* py: Fix a semantic issue with range optimisation.Damien George2014-12-11
| | | | | | | Now you can assign to the range variable within the for loop and it will still work. Partially addresses issue #565.
* py: Tidy up a few function declarations.Damien George2014-12-10
|
* py: Remove static from definition of pfenv_printf.Damien George2014-12-10
| | | | It's used by stmhal, but not unix.
* py: Make functions static where appropriate.Damien George2014-12-10
|
* py: Fix function type: () -> (void).Damien George2014-12-10
|
* py: Allow builtins to be overridden.Damien George2014-12-09
| | | | | | | | | | | | | | This patch adds a configuration option (MICROPY_CAN_OVERRIDE_BUILTINS) which, when enabled, allows to override all names within the builtins module. A builtins override dict is created the first time the user assigns to a name in the builtins model, and then that dict is searched first on subsequent lookups. Note that this implementation doesn't allow deleting of names. This patch also does some refactoring of builtins code, creating the modbuiltins.c file. Addresses issue #959.
* modsys: Add sys.print_exception(exc, file=sys.stdout) function.Paul Sokolovsky2014-12-08
| | | | | | | | | | | | The function is modeled after traceback.print_exception(), but unbloated, and put into existing module to save overhead on adding another module. Compliant traceback.print_exception() is intended to be implemented in micropython-lib in terms of sys.print_exception(). This change required refactoring mp_obj_print_exception() to take pfenv_t interface arguments. Addresses #751.
* py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.Damien George2014-12-05
| | | | | | | | | | | mp_obj_int_get_truncated is used as a "fast path" int accessor that doesn't check for overflow and returns the int truncated to the machine word size, ie mp_int_t. Use mp_obj_int_get_truncated to fix struct.pack when packing maximum word sized values. Addresses issues #779 and #998.
* py: Fix printing of size_t entity; fix qemu-arm for changes to lexer.Damien George2014-12-05
|
* py: Optimise lexer by exposing lexer type.Damien George2014-12-05
| | | | | | | | | mp_lexer_t type is exposed, mp_token_t type is removed, and simple lexer functions (like checking current token kind) are now inlined. This saves 784 bytes ROM on 32-bit unix, 348 bytes on stmhal, and 460 bytes on bare-arm. It also saves a tiny bit of RAM since mp_lexer_t is a bit smaller. Also will run a bit more efficiently.
* py: Allow bytes/bytearray/array to be init'd by buffer protocol objects.Damien George2014-12-04
| | | | | | | Behaviour of array initialisation is subtly different for bytes, bytearray and array.array when argument has buffer protocol. This patch gets us CPython conformant (except we allow initialisation of array.array by buffer with length not a multiple of typecode).
* py, vm: Make unum a local variable for each opcode that uses it.Damien George2014-12-02
| | | | | This makes no change to the generated code, but it's now easier to understand since unum is not a "global" variable anymore.
* modmicropython: Move mem_info() and qstr_info() functions from unix port.Paul Sokolovsky2014-12-01
| | | | TODO: Merge useful functionality from modpyb too.
* py: Generalise and reduce code size of array +, += and .extend().Damien George2014-11-30
| | | | | | | | By using the buffer protocol for these array operations, we now allow addition of memoryview objects, and objects with "incompatible" typecodes (in this case it just adds bytes naively). This is an extension to CPython which seems sensible. It also reduces the code size.
* py: Implement +, += and .extend for bytearray and array objs.Damien George2014-11-30
| | | | Addresses issue #994.
* Use MP_DEFINE_CONST_DICT macro to define module dicts.Damien George2014-11-29
| | | | | This is just a clean-up of the code. Generated code is exactly the same.
* modubinascii: Add, with hexlify() implementation.Paul Sokolovsky2014-11-29
|
* py: Add NLR support for xtensa CPU.Damien George2014-11-27
|
* pfenv_printf: Properly implement %p format specifier.Paul Sokolovsky2014-11-27
| | | | Previously, it truncated pointer value to 32 bits on 64-bit systems.
* builtin: Reimplement __repl_print__() in terms of print().Paul Sokolovsky2014-11-27
| | | | | | | Before, __repl_print__() used libc printf(), while print() used uPy streams and own printf() implementation. This led to subtle, but confusing differences in output when just doing "foo" vs "print(foo)" on interactive prompt.
* map: Add empty fixed map.Paul Sokolovsky2014-11-27
| | | | | Useful when need to call kw-receiving functions without any keywords from C, etc.
* py: #if guard str_make_new when not needed.Damien George2014-11-27
|
* moduhashlib: Initial module skeleton.Paul Sokolovsky2014-11-22
|
* py: Add support for float/double arrays in array module.Damien George2014-11-21
| | | | Addresses issue #981.
* py: Make stream seek correctly check for ioctl fn; add seek for textio.Damien George2014-11-16
|
* stream: Implement seek operation support via ioctl, wrapped in generic method.Paul Sokolovsky2014-11-17
| | | | Also, implement for unix port.