mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
GH-118095: Add tier two support for BINARY_SUBSCR_GETITEM (GH-120793)
This commit is contained in:
parent
fda6bd842a
commit
df13a1821a
10 changed files with 317 additions and 207 deletions
|
@ -795,6 +795,7 @@ translate_bytecode_to_trace(
|
|||
assert(i + 1 == nuops);
|
||||
if (opcode == FOR_ITER_GEN ||
|
||||
opcode == LOAD_ATTR_PROPERTY ||
|
||||
opcode == BINARY_SUBSCR_GETITEM ||
|
||||
opcode == SEND_GEN)
|
||||
{
|
||||
DPRINTF(2, "Bailing due to dynamic target\n");
|
||||
|
@ -921,7 +922,9 @@ done:
|
|||
2 * INSTR_IP(initial_instr, code));
|
||||
return 0;
|
||||
}
|
||||
if (trace[trace_length-1].opcode != _JUMP_TO_TOP) {
|
||||
if (!is_terminator(&trace[trace_length-1])) {
|
||||
/* Allow space for _EXIT_TRACE */
|
||||
max_length += 2;
|
||||
ADD_TO_TRACE(_EXIT_TRACE, 0, 0, target);
|
||||
}
|
||||
DPRINTF(1,
|
||||
|
@ -1102,7 +1105,7 @@ sanity_check(_PyExecutorObject *executor)
|
|||
CHECK(inst->format == UOP_FORMAT_JUMP);
|
||||
CHECK(inst->error_target < executor->code_size);
|
||||
}
|
||||
if (opcode == _JUMP_TO_TOP || opcode == _EXIT_TRACE) {
|
||||
if (is_terminator(inst)) {
|
||||
ended = true;
|
||||
i++;
|
||||
break;
|
||||
|
@ -1207,8 +1210,7 @@ int effective_trace_length(_PyUOpInstruction *buffer, int length)
|
|||
if (opcode == _NOP) {
|
||||
nop_count++;
|
||||
}
|
||||
if (opcode == _EXIT_TRACE ||
|
||||
opcode == _JUMP_TO_TOP) {
|
||||
if (is_terminator(&buffer[i])) {
|
||||
return i+1-nop_count;
|
||||
}
|
||||
}
|
||||
|
@ -1257,7 +1259,7 @@ uop_optimize(
|
|||
else if (oparg < _PyUop_Replication[opcode]) {
|
||||
buffer[pc].opcode = opcode + oparg + 1;
|
||||
}
|
||||
else if (opcode == _JUMP_TO_TOP || opcode == _EXIT_TRACE) {
|
||||
else if (is_terminator(&buffer[pc])) {
|
||||
break;
|
||||
}
|
||||
assert(_PyOpcode_uop_name[buffer[pc].opcode]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue