Skip to content

Commit c9920dd

Browse files
neonenegvanrossum
authored andcommitted
pythongh-91719: Reload opcode on unknown error so that C can optimize the dispatching in ceval.c (python#94364)
1 parent 6a5a45f commit c9920dd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Reload ``opcode`` when raising ``unknown opcode error`` in the interpreter main loop,
2+
for C compilers to generate dispatching code independently.

Python/ceval.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5706,6 +5706,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
57065706
#else
57075707
EXTRA_CASES // From opcode.h, a 'case' for each unused opcode
57085708
#endif
5709+
/* Tell C compilers not to hold the opcode variable in the loop.
5710+
next_instr points the current instruction without TARGET(). */
5711+
opcode = _Py_OPCODE(*next_instr);
57095712
fprintf(stderr, "XXX lineno: %d, opcode: %d\n",
57105713
_PyInterpreterFrame_GetLine(frame), opcode);
57115714
_PyErr_SetString(tstate, PyExc_SystemError, "unknown opcode");

0 commit comments

Comments
 (0)