py/runtime: mp_stack_ctrl_init() should be called immediately on startup.

Calling it from mp_init() is too late for some ports (like Unix), and leads
to incomplete stack frame being captured, with following GC issues. So, now
each port should call mp_stack_ctrl_init() on its own, ASAP after startup,
and taking special precautions so it really was called before stack variables
get allocated (because if such variable with a pointer is missed, it may lead
to over-collecting (typical symptom is segfaulting)).
This commit is contained in:
Paul Sokolovsky
2016-01-29 01:05:53 +02:00
parent 850212203a
commit d3b1f0b627
8 changed files with 25 additions and 1 deletions

View File

@@ -61,7 +61,6 @@ const mp_obj_module_t mp_module___main__ = {
void mp_init(void) {
qstr_init();
mp_stack_ctrl_init();
// no pending exceptions to start with
MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL;