Skip to content

Commit

Permalink
Generate everything
Browse files Browse the repository at this point in the history
  • Loading branch information
Fidget-Spinner committed Jan 10, 2025
1 parent 5862338 commit f5b1c93
Show file tree
Hide file tree
Showing 4 changed files with 605 additions and 3,010 deletions.
22 changes: 10 additions & 12 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
DISPATCH();
#endif

{
#ifndef Py_TAIL_CALL_INTERP
/* Start instructions */
#if !USE_COMPUTED_GOTOS
Expand Down Expand Up @@ -942,15 +941,15 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
or goto error. */
Py_UNREACHABLE();
#endif
pop_4_error:
TAIL_CALL_TARGET(pop_4_error):
STACK_SHRINK(1);
pop_3_error:
TAIL_CALL_TARGET(pop_3_error):
STACK_SHRINK(1);
pop_2_error:
TAIL_CALL_TARGET(pop_2_error):
STACK_SHRINK(1);
pop_1_error:
TAIL_CALL_TARGET(pop_1_error):
STACK_SHRINK(1);
error:
TAIL_CALL_TARGET(error):
/* Double-check exception status. */
#ifdef NDEBUG
if (!_PyErr_Occurred(tstate)) {
Expand All @@ -970,7 +969,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
}
}
_PyEval_MonitorRaise(tstate, frame, next_instr-1);
exception_unwind:
TAIL_CALL_TARGET(exception_unwind):
{
/* We can't use frame->instr_ptr here, as RERAISE may have set it */
int offset = INSTR_OFFSET()-1;
Expand Down Expand Up @@ -1032,9 +1031,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
DISPATCH();
#endif
}
}

exit_unwind:
TAIL_CALL_TARGET(exit_unwind):
assert(_PyErr_Occurred(tstate));
_Py_LeaveRecursiveCallPy(tstate);
assert(frame != entry_frame);
Expand All @@ -1050,12 +1048,12 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
return NULL;
}

resume_with_error:
TAIL_CALL_TARGET(resume_with_error):
next_instr = frame->instr_ptr;
stack_pointer = _PyFrame_GetStackPointer(frame);
goto error;


/* END_BASE_INTERPRETER */
#ifdef _Py_TIER2

// Tier 2 is also here!
Expand Down Expand Up @@ -1197,7 +1195,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int

#endif // _Py_TIER2

}
} /* _PyEval_EvalFrameDefault */

#ifdef DO_NOT_OPTIMIZE_INTERP_LOOP
# pragma optimize("", on)
Expand Down
2 changes: 2 additions & 0 deletions Python/ceval_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
# define CEVAL_GOTO(name) goto name;
#endif

#define TAIL_CALL_TARGET(name) name


/* PRE_DISPATCH_GOTO() does lltrace if enabled. Normally a no-op */
#ifdef LLTRACE
Expand Down
Loading

0 comments on commit f5b1c93

Please sign in to comment.