summaryrefslogtreecommitdiffstatshomepage
path: root/py/runtime.c
Commit message (Collapse)AuthorAge
* py: from import * should not import symbols starting with underscore.Paul Sokolovsky2014-04-18
| | | | | I skipped implementing this initially, but then it causes __name__ of current module be overwritten and relative imports fail.
* py: Add MP_OBJ_STOP_ITERATION and make good use of it.Damien George2014-04-17
| | | | | Also make consistent use of MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL. This helps a lot in debugging and understanding of function API.
* py: Merge BINARY_OP_SUBSCR and store_subscr (w/ delete) into subscr.Damien George2014-04-17
| | | | mp_obj_t->subscr now does load/store/delete.
* py: Don't assert but go to unsupported_op in mp_binary_op for small int.Damien George2014-04-17
|
* Merge pull request #476 from pfalcon/static-sysDamien George2014-04-13
|\ | | | | Convert sys module to static allocation
| * py, unix: Convert sys module to static representation.Paul Sokolovsky2014-04-13
| |
* | py: Remove unique_codes from emitglue.c. Replace with pointers.Damien George2014-04-13
|/ | | | | | | | | | | | | | | | Attempt to address issue #386. unique_code_id's have been removed and replaced with a pointer to the "raw code" information. This pointer is stored in the actual byte code (aligned, so the GC can trace it), so that raw code (ie byte code, native code and inline assembler) is kept only for as long as it is needed. In memory it's now like a tree: the outer module's byte code points directly to its children's raw code. So when the outer code gets freed, if there are no remaining functions that need the raw code, then the children's code gets freed as well. This is pretty much like CPython does it, except that CPython stores indexes in the byte code rather than machine pointers. These indices index the per-function constant table in order to find the relevant code.
* py: Fix compiler warning when floats disabled.Damien George2014-04-12
|
* py: Make ImportError message match CPython's.Paul Sokolovsky2014-04-12
|
* builtinimport: Fix thinko passing 0 vs NULL.Paul Sokolovsky2014-04-12
|
* py: Implement "from pkg import mod" variant of import.Paul Sokolovsky2014-04-12
|
* py: Fix float/complex binop returning NULL; implement complex power.Damien George2014-04-10
|
* py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR.Damien George2014-04-08
| | | | | This makes the runtime and object APIs more consistent. mp_store_subscr functionality now moved into objects (ie list and dict store_item).
* py: Finish implementation of all del opcodes.Damien George2014-04-08
| | | | | | | At this point, all opcodes are now implemented! Some del opcodes have been combined with store opcodes, with the value to store being MP_OBJ_NULL.
* py: implement UNPACK_EX byte code (for: a, *b, c = d)Damien George2014-04-08
|
* py: Implement more features in native emitter.Damien George2014-04-06
| | | | On x64, native emitter now passes 70 of the tests.
* py: Revert mp_load_attr() to its previous state (not supporting default val).Paul Sokolovsky2014-04-06
| | | | | | | | Based on the discussion in #433. mp_load_attr() is critical-path function, so any extra check will slowdown any script. As supporting default val required only for getattr() builtin, move correspending implementation there (still as a separate function due to concerns of maintainability of such almost-duplicated code instances).
* py: Make globals and locals proper dictionary objects.Damien George2014-04-05
| | | | | | | | | | | Finishes addressing issue #424. In the end this was a very neat refactor that now makes things a lot more consistent across the py code base. It allowed some simplifications in certain places, now that everything is a dict object. Also converted builtins tables to dictionaries. This will be useful when we need to turn builtins into a proper module.
* py: Change module globals from mp_map_t* to mp_obj_dict_t*.Damien George2014-04-05
| | | | | | Towards addressing issue #424. Had a small increase to ROM usage (order 60 bytes).
* py: Change nlr_jump to nlr_raise, to aid in debugging.Damien George2014-04-05
| | | | | | This does not affect code size or performance when debugging turned off. To address issue #420.
* Merge pull request #433 from pfalcon/getattr-3argDamien George2014-04-05
|\ | | | | py: Support 3-arg getattr() builtin (with default value).
| * py: Support 3-arg getattr() builtin (with default value).Paul Sokolovsky2014-04-05
| |
* | py: Implement DELETE_SUBSCR bytecode; implement mp_obj_dict_delete.Damien George2014-04-05
|/
* py: Put default namespace into module __main__.Paul Sokolovsky2014-04-05
| | | | That's how CPython has it, in particular, "import __main__" should work.
* mp_load_name(): Optimize for outer scope where locals == globals.Paul Sokolovsky2014-04-05
|
* py: This time, real proper overflow checking of small int power.Damien George2014-04-04
| | | | Previous overflow test was inadequate.
* py: Add m_malloc_fail function to handle memory allocation error.Damien George2014-04-04
| | | | A malloc/realloc fail now throws MemoryError.
* py: Handle small int power overflow correctly.Damien George2014-04-04
|
* py: Fix up so that it can compile without float.Damien George2014-04-02
|
* py: Implement __getattr__.Damien George2014-03-31
| | | | | | | | It's not completely satisfactory, because a failed call to __getattr__ should not raise an exception. __setattr__ could be implemented, but it would slow down all stores to a user created object. Need to implement some caching system.
* py: Wrap .__class__ handling in MICROPY_CPYTHON_COMPAT.Paul Sokolovsky2014-03-31
| | | | | Because it's superfluos in the presence of type(), a remenant from Python's "old classes".
* Merge branch 'master' of github.com:micropython/micropythonDamien George2014-03-31
|\
| * mp_resume: Dare to pass send_value of NULL.Paul Sokolovsky2014-03-31
| | | | | | | | | | | | | | There was thinkos that either send_value or throw_value is specified, but there were cases with both. Note that send_value is pushed onto generator's stack - but that's probably only good, because if we throw exception into gen, it should not ever use send_value, and that will be just extra "assert".
| * mp_resume: Elaborate handling of .throw() for objects which lack it.Paul Sokolovsky2014-03-31
| | | | | | | | | | | | In this case, the exception is just re-thrown - the ideas is that object doesn't handle this exception specially, so it will propagated per Python semantics.
* | py: Remove old "run time" functions that were 1 liners.Damien George2014-03-31
|/
* Merge branch 'master' of github.com:micropython/micropythonDamien George2014-03-31
|\
| * py: Properly implement divide-by-zero handling.Paul Sokolovsky2014-03-31
| | | | | | | | | | "1/0" is sacred idiom, the shortest way to break program execution (sys.exit() is too long).
* | py: Add LOAD_NULL bytecode and use it to simplify function calls.Damien George2014-03-31
|/ | | | | | | Adding this bytecode allows to remove 4 others related to function/method calls with * and ** support. Will also help with bytecodes that make functions/closures with default positional and keyword args.
* py: Implement support for generalized generator protocol.Paul Sokolovsky2014-03-30
| | | | Iterators and ducktype objects can now be arguments of yield from.
* py: Implement positional and keyword args via * and **.Damien George2014-03-30
| | | | | Extends previous implementation with * for function calls to * and ** for both function and method calls.
* Merge map.h into obj.h.Damien George2014-03-30
| | | | | | Pretty much everyone needs to include map.h, since it's such an integral part of the Micro Python object implementation. Thus, the definitions are now in obj.h instead. map.h is removed.
* Rename rt_* to mp_*.Damien George2014-03-30
| | | | | | | Mostly just a global search and replace. Except rt_is_true which becomes mp_obj_is_true. Still would like to tidy up some of the names, but this will do for now.
* py: Rename old const type objects to mp_type_* for consistency.Damien George2014-03-29
|
* py: Change mp_const_* objects to macros.Damien George2014-03-29
| | | | Addresses issue #388.
* py: Fix bugs with debugging output.Damien George2014-03-28
| | | | | | | show_bc now decodes the prelude correctly. Moved WRITE_FILE stuff from runtime.c to emitglue.c. Addresses issue #385.
* py: Factor out code from runtime.c to emitglue.c.Damien George2014-03-27
|
* py: Put n_state for bytecode in the bytecode prelude.Damien George2014-03-27
| | | | | | | | | | | Rationale: setting up the stack (state for locals and exceptions) is really part of the "code", it's the prelude of the function. For example, native code adjusts the stack pointer on entry to the function. Native code doesn't need to know n_state for any other reason. So putting the state size in the bytecode prelude is sensible. It reduced ROM usage on STM by about 30 bytes :) And makes it easier to pass information about the bytecode between functions.
* Merge pull request #381 from pfalcon/closure-defargsDamien George2014-03-26
|\ | | | | py: Support closures with default args.
| * py: Support closures with default args.Paul Sokolovsky2014-03-26
| |
* | py: Fix logic bugs in object attribute/method extraction.Damien George2014-03-26
| |