]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-91719: Reload opcode on unknown error so that C can optimize the dispatching in...
authorneonene <53406459+neonene@users.noreply.github.com>
Thu, 30 Jun 2022 15:38:29 +0000 (00:38 +0900)
committerGitHub <noreply@github.com>
Thu, 30 Jun 2022 15:38:29 +0000 (08:38 -0700)
Misc/NEWS.d/next/Core and Builtins/2022-06-29-22-18-36.gh-issue-91719.3APYYI.rst [new file with mode: 0644]
Python/ceval.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-06-29-22-18-36.gh-issue-91719.3APYYI.rst b/Misc/NEWS.d/next/Core and Builtins/2022-06-29-22-18-36.gh-issue-91719.3APYYI.rst
new file mode 100644 (file)
index 0000000..0d085e8
--- /dev/null
@@ -0,0 +1,2 @@
+Reload ``opcode`` when raising ``unknown opcode error`` in the interpreter main loop,\r
+for C compilers to generate dispatching code independently.\r
index 946e997fc832dfe86a081a13fe8f637e468b8bd6..4fcdf9b41dea92a42ee4037784b763d5e2466579 100644 (file)
@@ -5706,6 +5706,9 @@ handle_eval_breaker:
 #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");