mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
Update ceval.c
This commit is contained in:
parent
ddd99b121f
commit
d5bd9359d9
@ -30,6 +30,12 @@ static bool stack_format_object(VM* self, c11_sv spec);
|
|||||||
goto __NEXT_STEP; \
|
goto __NEXT_STEP; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
#define RESET_CO_CACHE() \
|
||||||
|
do { \
|
||||||
|
co_codes = frame->co->codes.data; \
|
||||||
|
co_names = frame->co->names.data; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
/* Stack manipulation macros */
|
/* Stack manipulation macros */
|
||||||
// https://github.com/python/cpython/blob/3.9/Python/ceval.c#L1123
|
// https://github.com/python/cpython/blob/3.9/Python/ceval.c#L1123
|
||||||
#define TOP() (self->stack.sp - 1)
|
#define TOP() (self->stack.sp - 1)
|
||||||
@ -92,9 +98,7 @@ FrameResult VM__run_top_frame(VM* self) {
|
|||||||
py_exception(tp_RecursionError, "maximum recursion depth exceeded");
|
py_exception(tp_RecursionError, "maximum recursion depth exceeded");
|
||||||
goto __ERROR;
|
goto __ERROR;
|
||||||
}
|
}
|
||||||
// NOTE: remember to change another occurrence after __ERROR_RE_RAISE:
|
RESET_CO_CACHE();
|
||||||
co_codes = frame->co->codes.data;
|
|
||||||
co_names = frame->co->names.data;
|
|
||||||
frame->ip++;
|
frame->ip++;
|
||||||
|
|
||||||
__NEXT_STEP:
|
__NEXT_STEP:
|
||||||
@ -1239,8 +1243,7 @@ FrameResult VM__run_top_frame(VM* self) {
|
|||||||
return RES_ERROR;
|
return RES_ERROR;
|
||||||
}
|
}
|
||||||
frame = self->top_frame;
|
frame = self->top_frame;
|
||||||
co_codes = frame->co->codes.data;
|
RESET_CO_CACHE();
|
||||||
co_names = frame->co->names.data;
|
|
||||||
goto __ERROR;
|
goto __ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1522,6 +1525,7 @@ static bool stack_format_object(VM* self, c11_sv spec) {
|
|||||||
#undef SP
|
#undef SP
|
||||||
#undef INSERT_THIRD
|
#undef INSERT_THIRD
|
||||||
#undef vectorcall_opcall
|
#undef vectorcall_opcall
|
||||||
|
#undef RESET_CO_CACHE
|
||||||
|
|
||||||
void py_sys_settrace(py_TraceFunc func, bool reset) {
|
void py_sys_settrace(py_TraceFunc func, bool reset) {
|
||||||
TraceInfo* info = &pk_current_vm->trace_info;
|
TraceInfo* info = &pk_current_vm->trace_info;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user