Skip to content

Commit

Permalink
pythongh-91719: Reload opcode on unknown error so that C can optimize…
Browse files Browse the repository at this point in the history
… the dispatching in ceval.c (python#94364)
  • Loading branch information
neonene authored and gvanrossum committed Jun 30, 2022
1 parent 6a5a45f commit c9920dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Reload ``opcode`` when raising ``unknown opcode error`` in the interpreter main loop,
for C compilers to generate dispatching code independently.
3 changes: 3 additions & 0 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -5706,6 +5706,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
#else
EXTRA_CASES // From opcode.h, a 'case' for each unused opcode
#endif
/* Tell C compilers not to hold the opcode variable in the loop.
next_instr points the current instruction without TARGET(). */
opcode = _Py_OPCODE(*next_instr);
fprintf(stderr, "XXX lineno: %d, opcode: %d\n",
_PyInterpreterFrame_GetLine(frame), opcode);
_PyErr_SetString(tstate, PyExc_SystemError, "unknown opcode");
Expand Down

0 comments on commit c9920dd

Please sign in to comment.