summaryrefslogtreecommitdiffstatshomepage
path: root/py/stackctrl.c
Commit message (Collapse)AuthorAge
* py: Add new cstack API for stack checking, with limit margin macro.Angus Gratton2024-08-14
| | | | | | | | | | | | | | | | | | | | 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>
* py/stackctrl: Add gcc pragmas to ignore dangling-pointer warning.Damien George2023-05-04
| | | | | | This warning became apparent in gcc 13. Signed-off-by: Damien George <damien@micropython.org>
* all: Reformat C and Python source code with tools/codeformat.py.Damien George2020-02-28
| | | | This is run with uncrustify 0.70.1, and black 19.10b0.
* py/runtime: Move mp_exc_recursion_depth to runtime and rename to raise.Damien George2017-12-11
| | | | | For consistency this helper function is renamed to match the other exception helpers, and moved to their location in runtime.c.
* py: Annotate func defs with NORETURN when their corresp decls have it.Damien George2017-11-29
|
* all: Remove inclusion of internal py header files.Damien George2017-10-04
| | | | | | | | | | | | | | | | 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.
* all: Use the name MicroPython consistently in commentsAlexander Steffen2017-07-31
| | | | | There were several different spellings of MicroPython present in comments, when there should be only one.
* py: Add MP_STATE_THREAD to hold state specific to a given thread.Damien George2016-06-28
|
* py/stackctrl: Add mp_stack_set_top() to explicitly set stack top value.Paul Sokolovsky2016-03-07
| | | | Useful for embedded targets with fixed stack layout.
* vm: Support strict stackless mode, with proper exception reporting.Paul Sokolovsky2015-04-03
| | | | | | 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.
* stackctrl: Encode "recursion depth exceeded" message as qstr.Paul Sokolovsky2015-02-15
| | | | So corresponding exception can be thrown even under tight memory conditions.
* 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: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* py: Fix function type: () -> (void).Damien George2014-12-10
|
* py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* stackctrl: Add "mp_" prefix.Paul Sokolovsky2014-07-01
|
* py: Add portable framework to query/check C stack usage.Paul Sokolovsky2014-06-27
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.