8000 Skip ENTER_EXECUTOR as deopt target (use vm_data) · python/cpython@36feeb1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 36feeb1

Browse files
committed
Skip ENTER_EXECUTOR as deopt target (use vm_data)
1 parent c6e614f commit 36feeb1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Python/ceval.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,18 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
10741074
UOP_STAT_INC(uopcode, miss);
10751075
frame->return_offset = 0; // Dispatch to frame->instr_ptr
10761076
_PyFrame_SetStackPointer(frame, stack_pointer);
1077+
if (frame->instr_ptr->op.code == ENTER_EXECUTOR) {
1078+
// Avoid recursing into the same executor over and over
1079+
Py_DECREF(current_executor);
1080+
next_instr = frame->instr_ptr;
1081+
PyCodeObject *code = _PyFrame_GetCode(frame);
1082+
oparg = next_instr->op.arg;
1083+
_PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255];
1084+
opcode = executor->vm_data.opcode;
1085+
oparg = executor->vm_data.oparg;
1086+
DPRINTF(2, "Avoiding ENTER_EXECUTOR in favor of underlying %s\n", _PyOpcode_OpName[opcode]);
1087+
DISPATCH_GOTO();
1088+
}
10771089
Py_DECREF(current_executor);
10781090
// Fall through
10791091
// Jump here from ENTER_EXECUTOR

0 commit comments

Comments
 (0)
0