aboutsummaryrefslogtreecommitdiff
path: root/py/runtime.c
AgeCommit message (Collapse)Author
2014-02-02Merge branch 'xbe-master'Damien George
2014-02-02Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-02-02py: Partially fix native emitter to work with latest runtime.Damien George
Native emitter has been broken since stack order has changed from reverse to standard. This fix gets it partially working.
2014-02-01Implement and add tests for the id() builtin function.xbe
2014-02-02rt_unpack_sequence(): Support generic iterables.Paul Sokolovsky
2014-02-01Tidy up some comments.Damien George
2014-02-01py: Tidy up BINARY_OPs; negation done by special NOT bytecode.Damien George
IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new special NOT bytecode.
2014-02-01Implement default function arguments (for Python functions).Paul Sokolovsky
TODO: Decide if we really need separate bytecode for creating functions with default arguments - we would need same for closures, then there're keywords arguments too. Having all combinations is a small exponential explosion, likely we need just 2 cases - simplest (no defaults, no kw), and full - defaults & kw.
2014-01-31py: Simplified rt_call_function_n_kw.Damien George
2014-01-31Fix SIGSEV when running "a"()Markus Siemens
rt_call_function_n_kw did check for integers but not for strings being called. Added a check so running "a"() won't SIGSEV but throw an exception.
2014-01-31py: Add MICROPY_ENABLE_FLOAT around a float specific piece of code.Damien George
2014-01-30py: Improve __bool__ and __len__ dispatch; add slots for them.Damien George
2014-01-30Implement __bool__ and __len__ via unary_op virtual method for all types.Paul Sokolovsky
__bool__() and __len__() are just the same as __neg__() or __invert__(), and require efficient dispatching implementation (not requiring search/lookup). type->unary_op() is just the right choice for this short of adding standalone virtual method(s) to already big mp_obj_type_t structure.
2014-01-29py: Simplify fastn in VM; reduce size of unique code struct.Damien George
We still have FAST_[0,1,2] byte codes, but they now just access the fastn array (before they had special local variables). It's now simpler, a bit faster, and uses a bit less stack space (on STM at least, which is most important). The only reason now to keep FAST_[0,1,2] byte codes is for compressed byte code size.
2014-01-29py: Fix bug with LOAD_METHOD; fix int->machine_int_t for small int.Damien George
LOAD_METHOD bug was: emitbc did not correctly calculate the amount of stack usage for a LOAD_METHOD operation. small int bug was: int was being used to pass small ints, when it should have been machine_int_t.
2014-01-28py: Implement 'not' in compiler, and improve rt_is_true.Damien George
2014-01-28Don't pre-import array module.Paul Sokolovsky
2014-01-27py: Add unary op not for NoneType, bool, tuple, list, dict; fix for int.Damien George
2014-01-25Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-01-25py: Implement iterator support for object that has __getitem__.Damien George
Addresses Issue #203.
2014-01-25rt_deinit(): Finalize some maps.Paul Sokolovsky
2014-01-24Add basic implementation of bytes type, piggybacking on str.Paul Sokolovsky
This reuses as much str implementation as possible, from this we can make them more separate as needed.
2014-01-23py: Implement bool unary op; tidy up unary op dispatch.Damien George
2014-01-22py: Initialise loaded_module map in rt_init.Damien George
STM port crashes without this re-init. There should not be any state in the core py/ code that relies on pre-initialised data.
2014-01-22Second stage of qstr revamp: uPy str object can be qstr or not.Damien George
2014-01-21Merge branch 'master' of github.com:micropython/micropythonDamien George
Conflicts: py/objstr.c py/py.mk py/stream.c unix/main.c unix/socket.c
2014-01-21Revamp qstrs: they now include length and hash.Damien George
Can now have null bytes in strings. Can define ROM qstrs per port using qstrdefsport.h
2014-01-20Add dummy bytes() constructor.Paul Sokolovsky
Currently, MicroPython strings are mix between CPython byte and unicode strings. So, conversion is null so far. This dummy implementation is intended for compatibility with CPython (so, same code can run on both).
2014-01-20py: Put micropython module init code in builtinmp.c.Damien George
2014-01-20Expose memory stats functions via "micropython" module.Paul Sokolovsky
These are micropython.mem_total(), .mem_current(), .mem_peak(). These are 3 individual functions with simple scalar return value to make sure that calls to these functions themselves have minimal (hopefully zero) impact on memory allocation.
2014-01-20Don't implicitly import "sys" module.Paul Sokolovsky
2014-01-20Pre-create sys module.Paul Sokolovsky
2014-01-19py: Add module/function/class name to exceptions.Damien George
Exceptions know source file, line and block name. Also tidy up some debug printing functions and provide a global flag to enable/disable them.
2014-01-18py: Fix VM/runtime unpack sequence bug, Issue #193.Damien George
2014-01-18Merge pull request #192 from pfalcon/arraysDamien George
Add skeleton implementation of array.array and bytearray.
2014-01-18Improve method lookup in mp_obj_class_lookup.Damien George
Now searches both locals_dict and methods. Partly addresses Issue #145.
2014-01-18Add skeleton implementation of array.array and bytearray.Paul Sokolovsky
So far, only storage, initialization, repr() and buffer protocol is implemented - alredy suitable for passing binary data around.
2014-01-18Merge pull request #191 from pfalcon/store-itemDamien George
Add store_item() virtual method to type to implement container[index] = val
2014-01-18Merge branch 'master' of github.com:dpgeorge/micropythonDamien George
2014-01-18Make VM stack grow upwards, and so no reversed args arrays.Damien George
Change state layout in VM so the stack starts at state[0] and grows upwards. Locals are at the top end of the state and number downwards. This cleans up a lot of the interface connecting the VM to C: now all functions that take an array of Micro Python objects are in order (ie no longer in reverse). Also clean up C API with keyword arguments (call_n and call_n_kw replaced with single call method that takes keyword arguments). And now make_new takes keyword arguments. emitnative.c has not yet been changed to comply with the new order of stack layout.
2014-01-18Add store_item() virtual method to type to implement container[index] = val.Paul Sokolovsky
2014-01-18Add OverflowError and use it for small int overflow instead of assert.Paul Sokolovsky
2014-01-16Add empty (false) value testing for strings, tuples, lists, dicts.Paul Sokolovsky
2014-01-16Add empty "micropython" module to allow more seamless CPython portability.Paul Sokolovsky
Implicit "micropython" module contains (at least) codegeneration decorators. Make it explicit, so an app could have "import micropython". On MicroPython, that will be no-op. On CPython, that will give a chance to have a module with placeholder decorators.
2014-01-15Merge branch 'str-repr' of github.com:pfalcon/micropython into pfalcon-str-reprDamien George
Conflicts: tests/basics/tests/exception1.py
2014-01-15Merge branch 'builtins' of github.com:chipaca/micropython into chipaca-builtinsDamien George
Added some checks for number of arguments. Conflicts: py/mpqstrraw.h
2014-01-15Implement eval.Damien George
2014-01-15Implement repr.Damien George
2014-01-15added filter()John R. Lenton
2014-01-15Added mapJohn R. Lenton