Skip to content

Commit dae88e3

Browse files
Get JIT working minimally with tailcalling interpreter
1 parent a0e1173 commit dae88e3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Python/ceval_macros.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,24 @@ _PyFrame_SetStackPointer(frame, stack_pointer)
384384
/* Tier-switching macros. */
385385

386386
#ifdef _Py_JIT
387+
#ifdef Py_TAIL_CALL_INTERP
388+
#define GOTO_TIER_TWO(EXECUTOR) \
389+
do { \
390+
OPT_STAT_INC(traces_executed); \
391+
jit_func jitted = (EXECUTOR)->jit_code; \
392+
next_instr = jitted(frame, stack_pointer, tstate); \
393+
Py_DECREF(tstate->previous_executor); \
394+
tstate->previous_executor = NULL; \
395+
frame = tstate->current_frame; \
396+
if (next_instr == NULL) { \
397+
next_instr = frame->instr_ptr; \
398+
stack_pointer = _PyFrame_GetStackPointer(frame); \
399+
return _TAIL_CALL_error(TAIL_CALL_ARGS); \
400+
} \
401+
stack_pointer = _PyFrame_GetStackPointer(frame); \
402+
DISPATCH(); \
403+
} while (0)
404+
#else
387405
#define GOTO_TIER_TWO(EXECUTOR) \
388406
do { \
389407
OPT_STAT_INC(traces_executed); \
@@ -400,6 +418,7 @@ do { \
400418
stack_pointer = _PyFrame_GetStackPointer(frame); \
401419
DISPATCH(); \
402420
} while (0)
421+
#endif
403422
#else
404423
#define GOTO_TIER_TWO(EXECUTOR) \
405424
do { \

0 commit comments

Comments
 (0)