mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
GH-131726: Split up _CHECK_VALIDITY_AND_SET_IP (GH-131810)
This commit is contained in:
parent
1a9d4a1fb3
commit
3a8cefba0b
7 changed files with 148 additions and 189 deletions
|
@ -5191,11 +5191,6 @@ dummy_func(
|
|||
Py_FatalError("Fatal error uop executed.");
|
||||
}
|
||||
|
||||
tier2 op(_CHECK_VALIDITY_AND_SET_IP, (instr_ptr/4 --)) {
|
||||
DEOPT_IF(!current_executor->vm_data.valid);
|
||||
frame->instr_ptr = (_Py_CODEUNIT *)instr_ptr;
|
||||
}
|
||||
|
||||
tier2 op(_DEOPT, (--)) {
|
||||
tstate->previous_executor = (PyObject *)current_executor;
|
||||
GOTO_TIER_ONE(_PyFrame_GetBytecode(frame) + CURRENT_TARGET());
|
||||
|
|
10
Python/executor_cases.c.h
generated
10
Python/executor_cases.c.h
generated
|
@ -7025,16 +7025,6 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CHECK_VALIDITY_AND_SET_IP: {
|
||||
PyObject *instr_ptr = (PyObject *)CURRENT_OPERAND0();
|
||||
if (!current_executor->vm_data.valid) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
JUMP_TO_JUMP_TARGET();
|
||||
}
|
||||
frame->instr_ptr = (_Py_CODEUNIT *)instr_ptr;
|
||||
break;
|
||||
}
|
||||
|
||||
case _DEOPT: {
|
||||
tstate->previous_executor = (PyObject *)current_executor;
|
||||
GOTO_TIER_ONE(_PyFrame_GetBytecode(frame) + CURRENT_TARGET());
|
||||
|
|
|
@ -569,13 +569,11 @@ translate_bytecode_to_trace(
|
|||
goto done;
|
||||
}
|
||||
assert(opcode != ENTER_EXECUTOR && opcode != EXTENDED_ARG);
|
||||
if (OPCODE_HAS_NO_SAVE_IP(opcode)) {
|
||||
RESERVE_RAW(2, "_CHECK_VALIDITY");
|
||||
ADD_TO_TRACE(_CHECK_VALIDITY, 0, 0, target);
|
||||
}
|
||||
else {
|
||||
RESERVE_RAW(2, "_CHECK_VALIDITY_AND_SET_IP");
|
||||
ADD_TO_TRACE(_CHECK_VALIDITY_AND_SET_IP, 0, (uintptr_t)instr, target);
|
||||
RESERVE_RAW(2, "_CHECK_VALIDITY");
|
||||
ADD_TO_TRACE(_CHECK_VALIDITY, 0, 0, target);
|
||||
if (!OPCODE_HAS_NO_SAVE_IP(opcode)) {
|
||||
RESERVE_RAW(2, "_SET_IP");
|
||||
ADD_TO_TRACE(_SET_IP, 0, (uintptr_t)instr, target);
|
||||
}
|
||||
|
||||
/* Special case the first instruction,
|
||||
|
|
|
@ -554,16 +554,6 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
|
|||
buffer[pc].opcode = _NOP;
|
||||
}
|
||||
break;
|
||||
case _CHECK_VALIDITY_AND_SET_IP:
|
||||
if (may_have_escaped) {
|
||||
may_have_escaped = false;
|
||||
buffer[pc].opcode = _CHECK_VALIDITY;
|
||||
}
|
||||
else {
|
||||
buffer[pc].opcode = _NOP;
|
||||
}
|
||||
last_set_ip = pc;
|
||||
break;
|
||||
case _POP_TOP:
|
||||
{
|
||||
_PyUOpInstruction *last = &buffer[pc-1];
|
||||
|
@ -597,13 +587,8 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
|
|||
may_have_escaped = true;
|
||||
}
|
||||
if (needs_ip && last_set_ip >= 0) {
|
||||
if (buffer[last_set_ip].opcode == _CHECK_VALIDITY) {
|
||||
buffer[last_set_ip].opcode = _CHECK_VALIDITY_AND_SET_IP;
|
||||
}
|
||||
else {
|
||||
assert(buffer[last_set_ip].opcode == _NOP);
|
||||
buffer[last_set_ip].opcode = _SET_IP;
|
||||
}
|
||||
assert(buffer[last_set_ip].opcode == _NOP);
|
||||
buffer[last_set_ip].opcode = _SET_IP;
|
||||
last_set_ip = -1;
|
||||
}
|
||||
}
|
||||
|
|
4
Python/optimizer_cases.c.h
generated
4
Python/optimizer_cases.c.h
generated
|
@ -2378,10 +2378,6 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CHECK_VALIDITY_AND_SET_IP: {
|
||||
break;
|
||||
}
|
||||
|
||||
case _DEOPT: {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue