summaryrefslogtreecommitdiffstatshomepage
path: root/py
Commit message (Collapse)AuthorAge
* stmhal: Put mod_network_nic_list in global root-pointer state.Damien George2015-01-22
| | | | It needs to be scanned by GC. Thanks to Daniel Campora.
* py: Add comments for vstr_init and mp_obj_new_str.Damien George2015-01-21
|
* py: Remove mp_obj_str_builder and use vstr instead.Damien George2015-01-21
| | | | | | | | | | | | With this patch str/bytes construction is streamlined. Always use a vstr to build a str/bytes object. If the size is known beforehand then use vstr_init_len to allocate only required memory. Otherwise use vstr_init and the vstr will grow as needed. Then use mp_obj_new_str_from_vstr to create a str/bytes object using the vstr memory. Saves code ROM: 68 bytes on stmhal, 108 bytes on bare-arm, and 336 bytes on unix x64.
* py: Add mp_obj_new_str_from_vstr, and use it where relevant.Damien George2015-01-21
| | | | | | | | This patch allows to reuse vstr memory when creating str/bytes object. This improves memory usage. Also saves code ROM: 128 bytes on stmhal, 92 bytes on bare-arm, and 88 bytes on unix x64.
* builtinimport: Make sure that qstr is used properly to load frozen modules.Paul Sokolovsky2015-01-21
|
* py: Implement proper re-raising in native codegen's finally handler.Damien George2015-01-21
| | | | | This allows an exception to propagate correctly through a finally handler.
* py: Implement __reversed__ slot.Damien George2015-01-21
| | | | Addresses issue #1073.
* py: Prevent segfault for operations on closed StringIO.stijn2015-01-20
| | | | Addresses issue #1067.
* py: Use mp_arg_check_num in some _make_new functions.Damien George2015-01-20
| | | | Reduces stmhal code size by about 250 bytes.
* py, unix: Allow to compile with -Wunused-parameter.Damien George2015-01-20
| | | | See issue #699.
* py, unix, stmhal: Allow to compile with -Wshadow.Damien George2015-01-20
| | | | See issue #699.
* py: Implement very simple frozen modules support.Paul Sokolovsky2015-01-20
| | | | | Only modules (not packages) supported now. Source modules can be converted to frozen module structures using tools/make-frozen.py script.
* py, unix: Allow to compile with -Wsign-compare.Damien George2015-01-16
| | | | See issue #699.
* py: Remove unnecessary id_flags argument from emitter's load_fast.Damien George2015-01-16
| | | | Saves 24 bytes in bare-arm.
* 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.