Add a macro for "inlining" new frames (GH-99490)

This commit is contained in:
Brandt Bucher 2022-11-17 11:36:03 -08:00 committed by GitHub
parent a0d940d6ac
commit 6f8b0e781c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 86 deletions

View file

@ -712,6 +712,16 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
DISPATCH_GOTO(); \
}
#define DISPATCH_INLINED(NEW_FRAME) \
do { \
_PyFrame_SetStackPointer(frame, stack_pointer); \
frame->prev_instr = next_instr - 1; \
(NEW_FRAME)->previous = frame; \
frame = cframe.current_frame = (NEW_FRAME); \
CALL_STAT_INC(inlined_py_calls); \
goto start_frame; \
} while (0)
#define CHECK_EVAL_BREAKER() \
_Py_CHECK_EMSCRIPTEN_SIGNALS_PERIODICALLY(); \
if (_Py_atomic_load_relaxed_int32(eval_breaker)) { \