summaryrefslogtreecommitdiffstatshomepage
path: root/py
Commit message (Collapse)AuthorAge
* pyexec: Add event-driven variant pyexec_friendly_repl().Paul Sokolovsky2015-01-16
| | | | | | | | | | pyexec_friendly_repl_process_char() and friends, useful for ports which integrate into existing cooperative multitasking system. Unlike readline() refactor before, this was implemented in less formal, trial&error process, minor functionality regressions are still known (like soft&hard reset support). So, original loop-based pyexec_friendly_repl() is left intact, specific implementation selectable by config setting.
* py: Add "default" to switches to allow better code flow analysis.Damien George2015-01-14
| | | | | This helps compiler produce smaller code. Saves 124 bytes on stmhal and bare-arm.
* py: Only allocate strings/bytes once for load_const_obj.Damien George2015-01-14
|
* py: Allocate memory for assembled code at start of PASS_EMIT.Damien George2015-01-14
| | | | | Previously was allocating at end of PASS_COMPUTE, and this pass was being run twice, so memory was being allocated twice.
* py: Reluctantly add an extra pass to bytecode compiler.Damien George2015-01-14
| | | | | | | | | | | | | | | Bytecode also needs a pass to compute the stack size. This is because the state size of the bytecode function is encoded as a variable uint, so we must know the value of this uint before we encode it (otherwise the size of the generated code changes from one pass to the next). Having an entire pass for this seems wasteful (in time). Alternative is to allocate fixed space for the state size (would need 3-4 bytes to be general, when 1 byte is usually sufficient) which uses a bit of extra RAM per bytecode function, and makes the code less elegant in places where this uint is encoded/decoded. So, for now, opt for an extra pass.
* py, unix: Trace root pointers with native emitter under unix port.Damien George2015-01-14
| | | | | | Native code has GC-heap pointers in it so it must be scanned. But on unix port memory for native functions is mmap'd, and so it must have explicit code to scan it for root pointers.
* py: Make compiler not crash when default except is not last.Damien George2015-01-13
|
* py/showbc.c: Handle new LOAD_CONST_OBJ opcode, and opcodes with cache.Damien George2015-01-13
|
* py: Never intern data of large string/bytes object; add relevant tests.Damien George2015-01-13
| | | | | | | | | | Previously to this patch all constant string/bytes objects were interned by the compiler, and this lead to crashes when the qstr was too long (noticeable now that qstr length storage defaults to 1 byte). With this patch, long string/bytes objects are never interned, and are referenced directly as constant objects within generated code using load_const_obj.
* py: Add load_const_obj to emitter, add LOAD_CONST_OBJ to bytecode.Damien George2015-01-13
| | | | | This allows to directly load a Python object to the Python stack. See issue #722 for background.
* py: Allow to compile with -Wstrict-prototypes.Damien George2015-01-12
|
* py: Allow to compile with -Wredundant-decls.Damien George2015-01-12
|
* py, unix, lib: Allow to compile with -Wold-style-definition.Damien George2015-01-12
|
* py: Can compile with -Wmissing-declarations and -Wmissing-prototypes.Damien George2015-01-12
|
* py: Make a function static and comment out those not used.Damien George2015-01-12
|
* py, unix: Allow to compile with -Wdouble-promotion.Damien George2015-01-12
| | | | Ref issue #699.
* py/makeqstrdata.py: Make it work again with both Python2 and Python3.Damien George2015-01-11
|
* py: Add MICROPY_QSTR_BYTES_IN_LEN config option, defaulting to 1.Damien George2015-01-11
| | | | | | | | | | | | | | | | | | This new config option sets how many fixed-number-of-bytes to use to store the length of each qstr. Previously this was hard coded to 2, but, as per issue #1056, this is considered overkill since no-one needs identifiers longer than 255 bytes. With this patch the number of bytes for the length is configurable, and defaults to 1 byte. The configuration option filters through to the makeqstrdata.py script. Code size savings going from 2 to 1 byte: - unix x64 down by 592 bytes - stmhal down by 1148 bytes - bare-arm down by 284 bytes Also has RAM savings, and will be slightly more efficient in execution.
* py: Add qstr cfg capability; generate QSTR_NULL and QSTR_ from script.Damien George2015-01-11
|
* py: Remove unnecessary BINARY_OP_EQUAL code that just checks pointers.Damien George2015-01-11
| | | | | | | Previous patch c38dc3ccc76d1a9bf867704f43ea5d15da3fea7b allowed any object to be compared with any other, using pointer comparison for a fallback. As such, existing code which checked for this case is no longer needed.
* py: Implement fallback for equality check for all types.Damien George2015-01-11
| | | | | Return "not equal" for objects that don't implement equality check. This is as per Python specs.
* py: Add (commented out) code to gc_dump_alloc_table for qstr info.Damien George2015-01-11
|
* py/makeqstrdata.py: Add more allowed qstr characters; escape quot.Damien George2015-01-11
|
* py: Fix hard-coded hash for empty qstr (was 0x0000 now 0x1505).Damien George2015-01-11
|
* py: Add config option MICROPY_COMP_MODULE_CONST for module consts.Damien George2015-01-10
| | | | | | Compiler optimises lookup of module.CONST when enabled (an existing feature). Disabled by default; enabled for unix, windows, stmhal. Costs about 100 bytes ROM on stmhal.
* py: Fix handling of "0" mpz in some functions.Damien George2015-01-09
|
* py: Make mem_info print correct remaining stack bytes.Damien George2015-01-09
|
* py: Add MICROPY_PY_MICROPYTHON_MEM_INFO to enable mem-info funcs.Damien George2015-01-09
| | | | | | This allows to enable mem-info functions in micropython module, even if MICROPY_MEM_STATS is not enabled. In this case, you get mem_info and qstr_info but not mem_{total,current,peak}.
* py: Disable stack checking by default; enable on most ports.Damien George2015-01-09
|
* tests: Add test for when instance member overrides class member.Damien George2015-01-08
|
* py: Fix nlr mp_state_ctx symbol error for Mac.Damien George2015-01-08
|
* Remove obsolete bss-related code/build featuresstijn2015-01-08
| | | | | GC for unix/windows builds doesn't make use of the bss section anymore, so we do not need the (sometimes complicated) build features and code related to it
* py: Add option to cache map lookup results in bytecode.Damien George2015-01-07
| | | | | | | | | | | | | | | 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.
* py: Put all global state together in state structures.Damien George2015-01-07
| | | | | | 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.
* py: Temporary fix for conversion of float to int when fits in small int.Damien George2015-01-07
| | | | Addresses issue #1044 (see also #1040). Could do with a better fix.
* showbc: Show conditional jump destination as unsigned value.Paul Sokolovsky2015-01-07
| | | | | | | | This is consistent with how BC_JUMP was handled before. We never show jumps destinations relative to jump instrucion itself, only relative to beginning of function. Another useful way to show them as absolute (real memory address), and this change makes result expected and consistent with how BC_JUMP is shown.
* objarray: Make sure that longint works as bytearray size.Paul Sokolovsky2015-01-04
|
* modbuiltins.c: Fix NULL vs MP_OBJ_NULL usage.Paul Sokolovsky2015-01-04
|
* objstr: Common subexpression elimination for vstr_str(field_name).Paul Sokolovsky2015-01-04
|
* objstr: Implement kwargs support for str.format().Paul Sokolovsky2015-01-04
|
* py: Raise exception if trying to convert inf/nan to int.Damien George2015-01-02
|
* py: Fix float to int conversion for large exponents.David Steinberg2015-01-02
|
* msvc: Fix unresolved mp_arg_error_terse_mismatch since 7f23384stijn2015-01-02
| | | | | | | | The compiler treats `if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE)` as a normal statement and generates assembly for it in degug mode as if MICROPY_ERROR_REPORTING is an actual symbol instead of a preprocessor definition. As such linking fails because mp_arg_error_terse_mismatch is not defined when MICROPY_ERROR_REPORTING_TERSE is detailed or normal.
* py: Make GC's STACK_SIZE definition a proper MICROPY_ config variable.Damien George2015-01-01
|
* py: Fix windows external name error for nlr_top.Damien George2015-01-01
|
* py: Move global variable nlr_top to one place, in a .c file.Damien George2015-01-01
| | | | | This reduces dependency on assembler, and allows to consolidate global variables in the future.
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* emitnative: Disable warning in delete_fast for now (breaks test).Paul Sokolovsky2015-01-01
|
* py: Add basic framework for issuing compile/runtime warnings.Paul Sokolovsky2015-01-01
|
* py: Add guarded includes for asm-based headers.Damien George2015-01-01
|