mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
GH-115419: Move setting the instruction pointer to error exit stubs (GH-118088)
This commit is contained in:
parent
77cd0428b6
commit
83235f7791
5 changed files with 6 additions and 5 deletions
|
@ -231,7 +231,7 @@ class TestUops(unittest.TestCase):
|
||||||
ex = get_first_executor(testfunc)
|
ex = get_first_executor(testfunc)
|
||||||
self.assertIsNotNone(ex)
|
self.assertIsNotNone(ex)
|
||||||
uops = get_opnames(ex)
|
uops = get_opnames(ex)
|
||||||
self.assertIn("_SET_IP", uops)
|
self.assertIn("_JUMP_TO_TOP", uops)
|
||||||
self.assertIn("_LOAD_FAST_0", uops)
|
self.assertIn("_LOAD_FAST_0", uops)
|
||||||
|
|
||||||
def test_extended_arg(self):
|
def test_extended_arg(self):
|
||||||
|
|
|
@ -4226,7 +4226,8 @@ dummy_func(
|
||||||
EXIT_TO_TRACE();
|
EXIT_TO_TRACE();
|
||||||
}
|
}
|
||||||
|
|
||||||
tier2 op(_ERROR_POP_N, (unused[oparg] --)) {
|
tier2 op(_ERROR_POP_N, (target/2, unused[oparg] --)) {
|
||||||
|
frame->instr_ptr = ((_Py_CODEUNIT *)_PyFrame_GetCode(frame)->co_code_adaptive) + target;
|
||||||
SYNC_SP();
|
SYNC_SP();
|
||||||
GOTO_UNWIND();
|
GOTO_UNWIND();
|
||||||
}
|
}
|
||||||
|
|
2
Python/executor_cases.c.h
generated
2
Python/executor_cases.c.h
generated
|
@ -4210,6 +4210,8 @@
|
||||||
|
|
||||||
case _ERROR_POP_N: {
|
case _ERROR_POP_N: {
|
||||||
oparg = CURRENT_OPARG();
|
oparg = CURRENT_OPARG();
|
||||||
|
uint32_t target = (uint32_t)CURRENT_OPERAND();
|
||||||
|
frame->instr_ptr = ((_Py_CODEUNIT *)_PyFrame_GetCode(frame)->co_code_adaptive) + target;
|
||||||
stack_pointer += -oparg;
|
stack_pointer += -oparg;
|
||||||
GOTO_UNWIND();
|
GOTO_UNWIND();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -978,6 +978,7 @@ prepare_for_execution(_PyUOpInstruction *buffer, int length)
|
||||||
current_error_target = target;
|
current_error_target = target;
|
||||||
make_exit(&buffer[next_spare], _ERROR_POP_N, 0);
|
make_exit(&buffer[next_spare], _ERROR_POP_N, 0);
|
||||||
buffer[next_spare].oparg = popped;
|
buffer[next_spare].oparg = popped;
|
||||||
|
buffer[next_spare].operand = target;
|
||||||
next_spare++;
|
next_spare++;
|
||||||
}
|
}
|
||||||
buffer[i].error_target = current_error;
|
buffer[i].error_target = current_error;
|
||||||
|
|
|
@ -554,9 +554,6 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
|
||||||
needs_ip = true;
|
needs_ip = true;
|
||||||
may_have_escaped = true;
|
may_have_escaped = true;
|
||||||
}
|
}
|
||||||
if (_PyUop_Flags[opcode] & HAS_ERROR_FLAG) {
|
|
||||||
needs_ip = true;
|
|
||||||
}
|
|
||||||
if (needs_ip && last_set_ip >= 0) {
|
if (needs_ip && last_set_ip >= 0) {
|
||||||
if (buffer[last_set_ip].opcode == _CHECK_VALIDITY) {
|
if (buffer[last_set_ip].opcode == _CHECK_VALIDITY) {
|
||||||
buffer[last_set_ip].opcode = _CHECK_VALIDITY_AND_SET_IP;
|
buffer[last_set_ip].opcode = _CHECK_VALIDITY_AND_SET_IP;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue