Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,13 +1090,27 @@ static int
_PyFrame_OpAlreadyRan(_PyInterpreterFrame *frame, int opcode, int oparg)
{
// This only works when opcode is a non-quickened form:
assert(opcode != ENTER_EXECUTOR);
assert(_PyOpcode_Deopt[opcode] == opcode);
int check_oparg = 0;
for (_Py_CODEUNIT *instruction = _PyCode_CODE(_PyFrame_GetCode(frame));
PyCodeObject *code = _PyFrame_GetCode(frame);
for (_Py_CODEUNIT *instruction = _PyCode_CODE(code);
instruction < frame->instr_ptr; instruction++)
{
int check_opcode = _PyOpcode_Deopt[instruction->op.code];
check_oparg |= instruction->op.arg;
int check_opcode = -1;
if (instruction->op.code == ENTER_EXECUTOR) {
int exec_index = instruction->op.arg;
_PyExecutorObject *exec = code->co_executors->executors[exec_index];
check_opcode = _PyOpcode_Deopt[exec->vm_data.opcode];
check_oparg |= exec->vm_data.oparg;
}
else {
check_opcode = _PyOpcode_Deopt[instruction->op.code];
check_oparg |= instruction->op.arg;
}

assert(check_opcode != ENTER_EXECUTOR);

if (check_opcode == opcode && check_oparg == oparg) {
return 1;
}
Expand Down