aboutsummaryrefslogtreecommitdiff
path: root/py/runtime.c
AgeCommit message (Collapse)Author
2014-10-25py: Add mp_pending_exception global variable, for VM soft interrupt.Damien George
This allows to implement KeyboardInterrupt on unix, and a much safer ctrl-C in stmhal port. First ctrl-C is a soft one, with hope that VM will notice it; second ctrl-C is a hard one that kills anything (for both unix and stmhal). One needs to check for a pending exception in the VM only for jump opcodes. Others can't produce an infinite loop (infinite recursion is caught by stack check).
2014-10-25py: Implement compile builtin, enabled only on unix port.Damien George
This should be pretty compliant with CPython, except perhaps for some corner cases to do with globals/locals context. Addresses issue #879.
2014-10-25py: Factor out mp_obj_is_package() function.Paul Sokolovsky
2014-10-23py: Use MP_OBJ_NULL instead of NULL in a few places.Damien George
2014-10-09py: Add #if guard around gc-specific code.Damien George
2014-10-07Allow real memory errors (from locked gc) to be reported with traceback.Dave Hylands
2014-10-05py: Implement proper context save/restore for eval/exec; factor code.Damien George
This has benefits all round: code factoring for parse/compile/execute, proper context save/restore for exec, allow to sepcify globals/locals for eval, and reduced ROM usage by >100 bytes on stmhal and unix. Also, the call to mp_parse_compile_execute is tail call optimised for the import code, so it doesn't increase stack memory usage.
2014-10-03py: Change [u]int to mp_[u]int_t in qstr.[ch], and some other places.Damien George
This should pretty much resolve issue #50.
2014-09-25py: Tidy up exception matching; allow matching of tuple of exceptions.Damien George
Addresses issue #864.
2014-09-25py: For malloc and vstr functions, use size_t exclusively for int type.Damien George
It seems most sensible to use size_t for measuring "number of bytes" in malloc and vstr functions (since that's what size_t is for). We don't use mp_uint_t because malloc and vstr are not Micro Python specific.
2014-09-23stmhal: Initialise stack pointer correctly.Damien George
Stack is full descending and must be 8-byte aligned. It must start off pointing to just above the last byte of RAM. Previously, stack started pointed to last byte of RAM (eg 0x2001ffff) and so was not 8-byte aligned. This caused a bug in combination with alloca. This patch also updates some debug printing code. Addresses issue #872 (among many other undiscovered issues).
2014-08-30py: Small simplifications in tuple and list accessors.Damien George
2014-08-30py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.Damien George
Part of code cleanup, working towards resolving issue #50.
2014-08-30py: Change all uint to mp_uint_t in obj.h.Damien George
Part of code cleanup, working towards resolving issue #50.
2014-08-30py: Make tuple and list use mp_int_t/mp_uint_t.Damien George
Part of code cleanup, to resolve issue #50.
2014-08-28py: Move native glue code from runtime.c to new file nativeglue.c.Damien George
This way, the native glue code is only compiled if native code is enabled (which makes complete sense; thanks to Paul Sokolovsky for the idea). Should fix issue #834.
2014-08-16py: Code clean-up in native emitter; improve thumb native calls.Damien George
2014-08-16py: Viper can call functions with native types, and raise exceptions.Damien George
2014-08-15py: Viper can now store to global.Damien George
2014-08-04Put call to qstr_init and mp_init_emergency_exc_buf in mp_init.Damien George
qstr_init is always called exactly before mp_init, so makes sense to just have mp_init call it. Similarly with mp_init_emergency_exception_buf. Doing this makes the ports simpler and less error prone (ie they can no longer forget to call these).
2014-07-03Rename machine_(u)int_t to mp_(u)int_t.Damien George
See discussion in issue #50.
2014-07-01stackctrl: Add "mp_" prefix.Paul Sokolovsky
2014-06-27py: Move stack_ctrl_init() to mp_init().Paul Sokolovsky
As stack checking is enabled by default, ports which don't call stack_ctrl_init() are broken now (report RuntimeError on startup). Save them trouble and just init stack control framework in interpreter init.
2014-06-20py: Separate MICROPY_PY_BUILTINS_COMPLEX from MICROPY_PY_BUILTINS_FLOAT.Paul Sokolovsky
One thing is wanting to do 1 / 2 and get something else but 0, and quite another - doing rocket science ;-).
2014-06-08Merge branch 'alloca' of github.com:marcusva/micropython into marcusva-allocaDamien George
2014-06-07py: Add generic mp_not_implemented() func to use instead of assert().Paul Sokolovsky
Benefits: won't crash baremetal targets, will provide Python source location when not implemented feature used (it will no longer provide C source location, but just grep for error message).
2014-06-07- FreeBSD provides alloca() via stdlib.h, in contrast to Linux and WindowsMarcus von Appen
- Move the includes for alloca() intp mpconfigport.h
2014-06-06Change comments (mainly URLs) to no longer specifically say Python 3.3Chris Angelico
2014-06-03py: Allow tail call optimisation in mp_call_function_n_kw.Damien George
This saves 4 words of stack space per Python call.
2014-06-03py: Instead of having "debug on" var, have "optimization level" var.Paul Sokolovsky
This allows to have multiple "optimization" levels (CPython has two (-OO removes docstrings), we can have more).
2014-06-01py: Fix configurability of builtin slice.Damien George
2014-06-01py: Add option to disable set() object (enabled by default).Damien George
2014-06-01Rename bultins config variables to MICROPY_PY_BUILTINS_*.Damien George
This renames: MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT See issue #35 for discussion.
2014-05-28py: Fix check of small-int overflow when parsing ints.Damien George
Also unifies use of SMALL_INT_FITS macro across parser and runtime.
2014-05-28py: Implement long int parsing in int(...).Damien George
Addresses issue #627.
2014-05-21py: Rename MP_OBJ_NOT_SUPPORTED to MP_OBJ_NULL.Damien George
See issue #608 for justification.
2014-05-12py: Remove emit_glue init and deinit. Needed only for debugging.Damien George
Debugging output for emit_glue now simplified so that the init and deinit functions are no longer needed.
2014-05-12py: Add support for __debug__ constant.Damien George
__debug__ now resolves to True or False. Its value needs to be set by mp_set_debug(). TODO: call mp_set_debug in unix/ port. TODO: optimise away "if False:" statements in compiler.
2014-05-11py: Don't expect that type->getiter() always returns iterator, check for NULL.Paul Sokolovsky
This is better than forcing each getiter() implementation to raise exception.
2014-05-11py: Don't try to "bind" types store as attributes of objects.Paul Sokolovsky
This was hit when trying to make urlparse.py from stdlib run. Took quite some time to debug. TODO: Reconsile bound method creation process better, maybe callable is to generic type to bind at all?
2014-05-10py: Fix prefix on few sequence helpers, was incorrectly "mp_".Paul Sokolovsky
2014-05-09windows: Add modtime implementationstijn
2014-05-08Windows MSVC portstijn
Extend the windows port so it compiles with the toolchain from Visual Studio 2013
2014-05-07py: Improve native emitter; now supports more opcodes.Damien George
2014-05-07py, compiler: Improve passes; add an extra pass for native emitter.Damien George
2014-05-03Add license header to (almost) all files.Damien George
Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
2014-05-03mingw: Fix number of exponent digits in floating point formattingstijn
By default mingw outputs 3 digits instead of the standard 2 so all float tests using printf fail. Using setenv at the start of the program fixes this. To accomodate calling platform specific initialization a MICROPY_MAIN_INIT_FUNC macro is used which is called in mp_init()
2014-05-02py, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky
Specifically, nlr.h does.
2014-04-25py: Support instance __call__ method.Paul Sokolovsky
2014-04-18py: from import * should not import symbols starting with underscore.Paul Sokolovsky
I skipped implementing this initially, but then it causes __name__ of current module be overwritten and relative imports fail.