From d5611f280403d19befe4a3e505b037d286cf798e Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Fri, 22 Sep 2023 14:13:31 -0700 Subject: GH-107265: Add missing deoptimizations for ENTER_EXECUTOR's original opcode (GH-109420) --- .../Core and Builtins/2023-09-14-20-15-57.gh-issue-107265.qHZL_6.rst | 1 + Objects/codeobject.c | 2 +- Python/instrumentation.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-09-14-20-15-57.gh-issue-107265.qHZL_6.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-09-14-20-15-57.gh-issue-107265.qHZL_6.rst b/Misc/NEWS.d/next/Core and Builtins/2023-09-14-20-15-57.gh-issue-107265.qHZL_6.rst new file mode 100644 index 0000000..c30c21f --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-09-14-20-15-57.gh-issue-107265.qHZL_6.rst @@ -0,0 +1 @@ +Deopt opcodes hidden by the executor when base opcode is needed diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 20e5ded..f662b8e 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -1505,7 +1505,7 @@ deopt_code(PyCodeObject *code, _Py_CODEUNIT *instructions) int opcode = _Py_GetBaseOpcode(code, i); if (opcode == ENTER_EXECUTOR) { _PyExecutorObject *exec = code->co_executors->executors[instructions[i].op.arg]; - opcode = exec->vm_data.opcode; + opcode = _PyOpcode_Deopt[exec->vm_data.opcode]; instructions[i].op.arg = exec->vm_data.oparg; } assert(opcode != ENTER_EXECUTOR); diff --git a/Python/instrumentation.c b/Python/instrumentation.c index df8943b..0b974f6 100644 --- a/Python/instrumentation.c +++ b/Python/instrumentation.c @@ -306,7 +306,7 @@ _PyInstruction_GetLength(PyCodeObject *code, int offset) if (opcode == ENTER_EXECUTOR) { int exec_index = _PyCode_CODE(code)[offset].op.arg; _PyExecutorObject *exec = code->co_executors->executors[exec_index]; - opcode = exec->vm_data.opcode; + opcode = _PyOpcode_Deopt[exec->vm_data.opcode]; } assert(opcode != ENTER_EXECUTOR); -- cgit v0.12