Skip to content

Commit

Permalink
Add start_frame label
Browse files Browse the repository at this point in the history
  • Loading branch information
Fidget-Spinner committed Jan 31, 2025
1 parent 1463132 commit f906c97
Show file tree
Hide file tree
Showing 5 changed files with 509 additions and 21 deletions.
22 changes: 22 additions & 0 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5194,6 +5194,28 @@ dummy_func(
assert(tstate->tracing || eval_breaker == FT_ATOMIC_LOAD_UINTPTR_ACQUIRE(_PyFrame_GetCode(frame)->_co_instrumentation_version));
}

label(start_frame) {
if (_Py_EnterRecursivePy(tstate)) {
goto exit_unwind;
}

next_instr = frame->instr_ptr;
stack_pointer = _PyFrame_GetStackPointer(frame);

#ifdef Py_DEBUG
int lltrace = maybe_lltrace_resume_frame(frame, GLOBALS());
frame->lltrace = lltrace;
if (lltrace < 0) {
goto exit_unwind;
}
#endif
#if defined(Py_TAIL_CALL_INTERP) && !defined(IN_TAIL_CALL_INTERP)
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, 0);
#else
DISPATCH();
#endif
}

label(pop_4_error) {
STACK_SHRINK(1);
goto pop_3_error;
Expand Down
2 changes: 0 additions & 2 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,13 +866,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
const _PyUOpInstruction *next_uop = NULL;
#endif

start_frame:
if (_Py_EnterRecursivePy(tstate)) {
goto exit_unwind;
}

next_instr = frame->instr_ptr;
resume_frame:
stack_pointer = _PyFrame_GetStackPointer(frame);

LLTRACE_RESUME_FRAME();
Expand Down
19 changes: 0 additions & 19 deletions Python/ceval_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,24 +140,6 @@ do { \
DISPATCH_GOTO(); \
}

#ifdef Py_TAIL_CALL_INTERP
#define DISPATCH_INLINED(NEW_FRAME) \
do { \
assert(tstate->interp->eval_frame == NULL); \
_PyFrame_SetStackPointer(frame, stack_pointer); \
assert((NEW_FRAME)->previous == frame); \
frame = tstate->current_frame = (NEW_FRAME); \
CALL_STAT_INC(inlined_py_calls); \
if (_Py_EnterRecursivePy(tstate)) {\
goto exit_unwind;\
} \
next_instr = frame->instr_ptr; \
stack_pointer = _PyFrame_GetStackPointer(frame); \
LLTRACE_RESUME_FRAME(); \
NEXTOPARG(); \
DISPATCH_GOTO(); \
} while (0)
#else
#define DISPATCH_INLINED(NEW_FRAME) \
do { \
assert(tstate->interp->eval_frame == NULL); \
Expand All @@ -167,7 +149,6 @@ do { \
CALL_STAT_INC(inlined_py_calls); \
goto start_frame; \
} while (0)
#endif

// Use this instead of 'goto error' so Tier 2 can go to a different label
#define GOTO_ERROR(LABEL) goto LABEL
Expand Down
21 changes: 21 additions & 0 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f906c97

Please sign in to comment.