mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 19:20:22 +01:00
webassembly: Enable C-stack checking.
This gets the recursive stress-tests working on this port. For relatively small Python functions the maximum recursive depth is about 150 nested calls. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -49,6 +49,9 @@
|
||||
// the top-level call into C.
|
||||
static size_t external_call_depth = 0;
|
||||
|
||||
// Emscripten defaults to a 64k C-stack, so our limit should be less than that.
|
||||
#define CSTACK_SIZE (32 * 1024)
|
||||
|
||||
#if MICROPY_GC_SPLIT_HEAP_AUTO
|
||||
static void gc_collect_top_level(void);
|
||||
#endif
|
||||
@@ -67,6 +70,8 @@ void external_call_depth_dec(void) {
|
||||
}
|
||||
|
||||
void mp_js_init(int pystack_size, int heap_size) {
|
||||
mp_cstack_init_with_sp_here(CSTACK_SIZE);
|
||||
|
||||
#if MICROPY_ENABLE_PYSTACK
|
||||
mp_obj_t *pystack = (mp_obj_t *)malloc(pystack_size * sizeof(mp_obj_t));
|
||||
mp_pystack_init(pystack, pystack + pystack_size);
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
#define MICROPY_READER_VFS (MICROPY_VFS)
|
||||
#define MICROPY_ENABLE_GC (1)
|
||||
#define MICROPY_ENABLE_PYSTACK (1)
|
||||
#define MICROPY_STACK_CHECK (0)
|
||||
#define MICROPY_KBD_EXCEPTION (1)
|
||||
#define MICROPY_REPL_EVENT_DRIVEN (1)
|
||||
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
||||
|
||||
Reference in New Issue
Block a user