kopia lustrzana https://github.com/micropython/micropython
unix: Add support for using the Python stack.
rodzic
ab750ee2fb
commit
357486d9b4
|
@ -440,6 +440,11 @@ MP_NOINLINE int main_(int argc, char **argv) {
|
||||||
gc_init(heap, heap + heap_size);
|
gc_init(heap, heap + heap_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MICROPY_ENABLE_PYSTACK
|
||||||
|
static mp_obj_t pystack[1024];
|
||||||
|
mp_pystack_init(pystack, &pystack[MP_ARRAY_SIZE(pystack)]);
|
||||||
|
#endif
|
||||||
|
|
||||||
mp_init();
|
mp_init();
|
||||||
|
|
||||||
char *home = getenv("HOME");
|
char *home = getenv("HOME");
|
||||||
|
|
|
@ -66,6 +66,10 @@ STATIC void mp_thread_gc(int signo, siginfo_t *info, void *context) {
|
||||||
// that we don't need the extra information, enough is captured by the
|
// that we don't need the extra information, enough is captured by the
|
||||||
// gc_collect_regs_and_stack function above
|
// gc_collect_regs_and_stack function above
|
||||||
//gc_collect_root((void**)context, sizeof(ucontext_t) / sizeof(uintptr_t));
|
//gc_collect_root((void**)context, sizeof(ucontext_t) / sizeof(uintptr_t));
|
||||||
|
#if MICROPY_ENABLE_PYSTACK
|
||||||
|
void **ptrs = (void**)(void*)MP_STATE_THREAD(pystack_start);
|
||||||
|
gc_collect_root(ptrs, (MP_STATE_THREAD(pystack_cur) - MP_STATE_THREAD(pystack_start)) / sizeof(void*));
|
||||||
|
#endif
|
||||||
thread_signal_done = 1;
|
thread_signal_done = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue