GH-131726: Split up _CHECK_VALIDITY_AND_SET_IP (GH-131810)

This commit is contained in:
Brandt Bucher 2025-04-01 16:55:05 -07:00 committed by GitHub
parent 1a9d4a1fb3
commit 3a8cefba0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 148 additions and 189 deletions

View file

@ -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;
}
}