GH-118093: Add tier two support to several instructions (GH-121884)

This commit is contained in:
Brandt Bucher 2024-07-18 14:24:58 -07:00 committed by GitHub
parent 7dd52b63ce
commit 7b36b67b1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 372 additions and 108 deletions

View file

@ -797,6 +797,13 @@ translate_bytecode_to_trace(
if (uop == _PUSH_FRAME) {
assert(i + 1 == nuops);
if (opcode == FOR_ITER_GEN || opcode == SEND_GEN) {
DPRINTF(2, "Bailing due to dynamic target\n");
ADD_TO_TRACE(uop, oparg, 0, target);
ADD_TO_TRACE(_DYNAMIC_EXIT, 0, 0, 0);
goto done;
}
assert(_PyOpcode_Deopt[opcode] == CALL);
int func_version_offset =
offsetof(_PyCallCache, func_version)/sizeof(_Py_CODEUNIT)
// Add one to account for the actual opcode/oparg pair:
@ -828,12 +835,6 @@ translate_bytecode_to_trace(
ADD_TO_TRACE(_EXIT_TRACE, 0, 0, 0);
goto done;
}
if (opcode == FOR_ITER_GEN) {
DPRINTF(2, "Bailing due to dynamic target\n");
ADD_TO_TRACE(uop, oparg, 0, target);
ADD_TO_TRACE(_DYNAMIC_EXIT, 0, 0, 0);
goto done;
}
// Increment IP to the return address
instr += _PyOpcode_Caches[_PyOpcode_Deopt[opcode]] + 1;
TRACE_STACK_PUSH();
@ -886,6 +887,11 @@ translate_bytecode_to_trace(
instr++;
// Add cache size for opcode
instr += _PyOpcode_Caches[_PyOpcode_Deopt[opcode]];
if (opcode == CALL_LIST_APPEND) {
assert(instr->op.code == POP_TOP);
instr++;
}
} // End for (;;)
done: