Skip to content

Commit

Permalink
gh-129989: Properly disable tailcall interp in configure (GH-129991)
Browse files Browse the repository at this point in the history
Co-authored-by: Zanie Blue <[email protected]>
  • Loading branch information
Fidget-Spinner and zanieb authored Feb 15, 2025
1 parent c26bed1 commit 359c7dd
Show file tree
Hide file tree
Showing 9 changed files with 287 additions and 286 deletions.
106 changes: 53 additions & 53 deletions Lib/test/test_generated_cases.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug where the tailcall interpreter was enabled when ``--without-tail-call-interp`` was provided to the configure script.
4 changes: 2 additions & 2 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5234,7 +5234,7 @@ dummy_func(
}
#endif
RELOAD_STACK();
#ifdef Py_TAIL_CALL_INTERP
#if Py_TAIL_CALL_INTERP
int opcode;
#endif
DISPATCH();
Expand Down Expand Up @@ -5278,7 +5278,7 @@ dummy_func(
assert(!_PyErr_Occurred(tstate));
#endif
RELOAD_STACK();
#ifdef Py_TAIL_CALL_INTERP
#if Py_TAIL_CALL_INTERP
int opcode;
#endif
DISPATCH();
Expand Down
8 changes: 4 additions & 4 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ _PyObjectArray_Free(PyObject **array, PyObject **scratch)
/* This setting is reversed below following _PyEval_EvalFrameDefault */
#endif

#ifdef Py_TAIL_CALL_INTERP
#if Py_TAIL_CALL_INTERP
#include "opcode_targets.h"
#include "generated_cases.c.h"
#endif
Expand All @@ -790,7 +790,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
_Py_EnsureTstateNotNULL(tstate);
CALL_STAT_INC(pyeval_calls);

#if USE_COMPUTED_GOTOS && !defined(Py_TAIL_CALL_INTERP)
#if USE_COMPUTED_GOTOS && !Py_TAIL_CALL_INTERP
/* Import the static jump table */
#include "opcode_targets.h"
#endif
Expand Down Expand Up @@ -863,7 +863,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
next_instr = frame->instr_ptr;
monitor_throw(tstate, frame, next_instr);
stack_pointer = _PyFrame_GetStackPointer(frame);
#ifdef Py_TAIL_CALL_INTERP
#if Py_TAIL_CALL_INTERP
return _TAIL_CALL_error(frame, stack_pointer, tstate, next_instr, 0);
#else
goto error;
Expand All @@ -876,7 +876,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
const _PyUOpInstruction *next_uop = NULL;
#endif

#ifdef Py_TAIL_CALL_INTERP
#if Py_TAIL_CALL_INTERP
return _TAIL_CALL_start_frame(frame, NULL, tstate, NULL, 0);
#else
goto start_frame;
Expand Down
2 changes: 1 addition & 1 deletion Python/ceval_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
#define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int oparg
#define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg

#ifdef Py_TAIL_CALL_INTERP
#if Py_TAIL_CALL_INTERP
// Note: [[clang::musttail]] works for GCC 15, but not __attribute__((musttail)) at the moment.
# define Py_MUSTTAIL [[clang::musttail]]
# define Py_PRESERVE_NONE_CC __attribute__((preserve_none))
Expand Down
Loading

0 comments on commit 359c7dd

Please sign in to comment.