Skip to content

gh-129819: Allow tier2/JIT and tailcall #129820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 12, 2025
Prev Previous commit
Next Next commit
Get JIT working minimally with tailcalling interpreter
  • Loading branch information
Fidget-Spinner committed Feb 7, 2025
commit dae88e3ca730576256a0b8d2bc9e78b8cacab645
19 changes: 19 additions & 0 deletions Python/ceval_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,24 @@ _PyFrame_SetStackPointer(frame, stack_pointer)
/* Tier-switching macros. */

#ifdef _Py_JIT
#ifdef Py_TAIL_CALL_INTERP
#define GOTO_TIER_TWO(EXECUTOR) \
do { \
OPT_STAT_INC(traces_executed); \
jit_func jitted = (EXECUTOR)->jit_code; \
next_instr = jitted(frame, stack_pointer, tstate); \
Py_DECREF(tstate->previous_executor); \
tstate->previous_executor = NULL; \
frame = tstate->current_frame; \
if (next_instr == NULL) { \
next_instr = frame->instr_ptr; \
stack_pointer = _PyFrame_GetStackPointer(frame); \
return _TAIL_CALL_error(TAIL_CALL_ARGS); \
} \
stack_pointer = _PyFrame_GetStackPointer(frame); \
DISPATCH(); \
} while (0)
#else
#define GOTO_TIER_TWO(EXECUTOR) \
do { \
OPT_STAT_INC(traces_executed); \
Expand All @@ -400,6 +418,7 @@ do { \
stack_pointer = _PyFrame_GetStackPointer(frame); \
DISPATCH(); \
} while (0)
#endif
#else
#define GOTO_TIER_TWO(EXECUTOR) \
do { \
Expand Down
Loading