summaryrefslogtreecommitdiff
path: root/py/stackctrl.c
AgeCommit message (Collapse)Author
2024-08-14py: Add new cstack API for stack checking, with limit margin macro.Angus Gratton
Currently the stack limit margin is hard-coded in each port's call to `mp_stack_set_limit()`, but on threaded ports it's fiddlier and can lead to bugs (such as incorrect thread stack margin on esp32). This commit provides a new API to initialise the C Stack in one function call, with a config macro to set the margin. Where possible the new call is inlined to reduce code size in thread-free ports. Intended replacement for `MP_TASK_STACK_LIMIT_MARGIN` on esp32. The previous `stackctrl.h` API is still present and unmodified apart from a deprecation comment. However it's not available when the `MICROPY_PREVIEW_VERSION_2` macro is set. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-05-04py/stackctrl: Add gcc pragmas to ignore dangling-pointer warning.Damien George
This warning became apparent in gcc 13. Signed-off-by: Damien George <damien@micropython.org>
2020-02-28all: Reformat C and Python source code with tools/codeformat.py.Damien George
This is run with uncrustify 0.70.1, and black 19.10b0.
2017-12-11py/runtime: Move mp_exc_recursion_depth to runtime and rename to raise.Damien George
For consistency this helper function is renamed to match the other exception helpers, and moved to their location in runtime.c.
2017-11-29py: Annotate func defs with NORETURN when their corresp decls have it.Damien George
2017-10-04all: Remove inclusion of internal py header files.Damien George
Header files that are considered internal to the py core and should not normally be included directly are: py/nlr.h - internal nlr configuration and declarations py/bc0.h - contains bytecode macro definitions py/runtime0.h - contains basic runtime enums Instead, the top-level header files to include are one of: py/obj.h - includes runtime0.h and defines everything to use the mp_obj_t type py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h, and defines everything to use the general runtime support functions Additional, specific headers (eg py/objlist.h) can be included if needed.
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2016-06-28py: Add MP_STATE_THREAD to hold state specific to a given thread.Damien George
2016-03-07py/stackctrl: Add mp_stack_set_top() to explicitly set stack top value.Paul Sokolovsky
Useful for embedded targets with fixed stack layout.
2015-04-03vm: Support strict stackless mode, with proper exception reporting.Paul Sokolovsky
I.e. in this mode, C stack will never be used to call a Python function, but if there's no free heap for a call, it will be reported as RuntimeError (as expected), not MemoryError.
2015-02-15stackctrl: Encode "recursion depth exceeded" message as qstr.Paul Sokolovsky
So corresponding exception can be thrown even under tight memory conditions.
2015-01-07py: Put all global state together in state structures.Damien George
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.
2015-01-01py: Move to guarded includes, everywhere in py/ core.Damien George
Addresses issue #1022.
2014-12-10py: Fix function type: () -> (void).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-07-01stackctrl: Add "mp_" prefix.Paul Sokolovsky
2014-06-27py: Add portable framework to query/check C stack usage.Paul Sokolovsky
Such mechanism is important to get stable Python functioning, because Python function calling is handled with C stack. The idea is to sprinkle STACK_CHECK() calls in places where there can be C recursion. TODO: Add more STACK_CHECK()'s.