mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
gh-132758: Fix tail call and pystats builds (GH-132759)
This commit is contained in:
parent
de9deb7ca7
commit
6430c634da
3 changed files with 29 additions and 8 deletions
|
@ -0,0 +1 @@
|
||||||
|
Fix building with tail call interpreter and pystats.
|
|
@ -1071,7 +1071,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
|
||||||
monitor_throw(tstate, frame, next_instr);
|
monitor_throw(tstate, frame, next_instr);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
#if Py_TAIL_CALL_INTERP
|
#if Py_TAIL_CALL_INTERP
|
||||||
|
# if Py_STATS
|
||||||
|
return _TAIL_CALL_error(frame, stack_pointer, tstate, next_instr, 0, lastopcode);
|
||||||
|
# else
|
||||||
return _TAIL_CALL_error(frame, stack_pointer, tstate, next_instr, 0);
|
return _TAIL_CALL_error(frame, stack_pointer, tstate, next_instr, 0);
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
goto error;
|
goto error;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1083,7 +1087,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
|
||||||
const _PyUOpInstruction *next_uop = NULL;
|
const _PyUOpInstruction *next_uop = NULL;
|
||||||
#endif
|
#endif
|
||||||
#if Py_TAIL_CALL_INTERP
|
#if Py_TAIL_CALL_INTERP
|
||||||
|
# if Py_STATS
|
||||||
|
return _TAIL_CALL_start_frame(frame, NULL, tstate, NULL, 0, lastopcode);
|
||||||
|
# else
|
||||||
return _TAIL_CALL_start_frame(frame, NULL, tstate, NULL, 0);
|
return _TAIL_CALL_start_frame(frame, NULL, tstate, NULL, 0);
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
goto start_frame;
|
goto start_frame;
|
||||||
# include "generated_cases.c.h"
|
# include "generated_cases.c.h"
|
||||||
|
|
|
@ -70,8 +70,13 @@
|
||||||
#define INSTRUCTION_STATS(op) ((void)0)
|
#define INSTRUCTION_STATS(op) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int oparg
|
#ifdef Py_STATS
|
||||||
#define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg
|
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int oparg, int lastopcode
|
||||||
|
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg, lastopcode
|
||||||
|
#else
|
||||||
|
# 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
|
||||||
|
#endif
|
||||||
|
|
||||||
#if Py_TAIL_CALL_INTERP
|
#if Py_TAIL_CALL_INTERP
|
||||||
// Note: [[clang::musttail]] works for GCC 15, but not __attribute__((musttail)) at the moment.
|
// Note: [[clang::musttail]] works for GCC 15, but not __attribute__((musttail)) at the moment.
|
||||||
|
@ -88,10 +93,17 @@
|
||||||
do { \
|
do { \
|
||||||
Py_MUSTTAIL return (_TAIL_CALL_##name)(TAIL_CALL_ARGS); \
|
Py_MUSTTAIL return (_TAIL_CALL_##name)(TAIL_CALL_ARGS); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
# ifdef Py_STATS
|
||||||
|
# define JUMP_TO_PREDICTED(name) \
|
||||||
|
do { \
|
||||||
|
Py_MUSTTAIL return (_TAIL_CALL_##name)(frame, stack_pointer, tstate, this_instr, oparg, lastopcode); \
|
||||||
|
} while (0)
|
||||||
|
# else
|
||||||
# define JUMP_TO_PREDICTED(name) \
|
# define JUMP_TO_PREDICTED(name) \
|
||||||
do { \
|
do { \
|
||||||
Py_MUSTTAIL return (_TAIL_CALL_##name)(frame, stack_pointer, tstate, this_instr, oparg); \
|
Py_MUSTTAIL return (_TAIL_CALL_##name)(frame, stack_pointer, tstate, this_instr, oparg); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
# endif
|
||||||
# define LABEL(name) TARGET(name)
|
# define LABEL(name) TARGET(name)
|
||||||
#elif USE_COMPUTED_GOTOS
|
#elif USE_COMPUTED_GOTOS
|
||||||
# define TARGET(op) TARGET_##op:
|
# define TARGET(op) TARGET_##op:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue