Skip to content

Commit 89729f2

Browse files
gh-142543: Mark tracer functions as Py_NO_INLINE (GH-142846)
1 parent 4345253 commit 89729f2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a stack overflow on Clang JIT build configurations with full LTO.

Python/optimizer.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,8 @@ is_terminator(const _PyUOpInstruction *uop)
582582

583583
/* Returns 1 on success (added to trace), 0 on trace end.
584584
*/
585-
int
585+
// gh-142543: inlining this function causes stack overflows
586+
Py_NO_INLINE int
586587
_PyJit_translate_single_bytecode_to_trace(
587588
PyThreadState *tstate,
588589
_PyInterpreterFrame *frame,
@@ -994,7 +995,8 @@ _PyJit_translate_single_bytecode_to_trace(
994995
}
995996

996997
// Returns 0 for do not enter tracing, 1 on enter tracing.
997-
int
998+
// gh-142543: inlining this function causes stack overflows
999+
Py_NO_INLINE int
9981000
_PyJit_TryInitializeTracing(
9991001
PyThreadState *tstate, _PyInterpreterFrame *frame, _Py_CODEUNIT *curr_instr,
10001002
_Py_CODEUNIT *start_instr, _Py_CODEUNIT *close_loop_instr, int curr_stackdepth, int chain_depth,
@@ -1066,7 +1068,7 @@ _PyJit_TryInitializeTracing(
10661068
return 1;
10671069
}
10681070

1069-
void
1071+
Py_NO_INLINE void
10701072
_PyJit_FinalizeTracing(PyThreadState *tstate)
10711073
{
10721074
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;

0 commit comments

Comments
 (0)