summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2022-11-17 19:36:03 (GMT)
committerGitHub <noreply@github.com>2022-11-17 19:36:03 (GMT)
commit6f8b0e781ccd5d17f00f91d1c4eddba4f3e9a8ed (patch)
treea764c8b2012cbd9df6cb014edd21c88b66d43a4a /Python/ceval.c
parenta0d940d6acbb5c6614cf892192d8cb0d7002e5a6 (diff)
downloadcpython-6f8b0e781ccd5d17f00f91d1c4eddba4f3e9a8ed.zip
cpython-6f8b0e781ccd5d17f00f91d1c4eddba4f3e9a8ed.tar.gz
cpython-6f8b0e781ccd5d17f00f91d1c4eddba4f3e9a8ed.tar.bz2
Add a macro for "inlining" new frames (GH-99490)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index bff8b5c..d28fdeb 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -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)) { \