py: Put all global state together in state structures.
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.
This commit is contained in:
@@ -26,14 +26,11 @@
|
||||
|
||||
#include "py/nlr.h"
|
||||
|
||||
// this global variable is used for all nlr implementations
|
||||
nlr_buf_t *nlr_top;
|
||||
|
||||
#if MICROPY_NLR_SETJMP
|
||||
|
||||
void nlr_setjmp_jump(void *val) {
|
||||
nlr_buf_t *buf = nlr_top;
|
||||
nlr_top = buf->prev;
|
||||
nlr_buf_t *buf = MP_STATE_VM(nlr_top);
|
||||
MP_STATE_VM(nlr_top) = buf->prev;
|
||||
buf->ret_val = val;
|
||||
longjmp(buf->jmpbuf, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user