diff options
author | Mark Shannon <mark@hotpy.org> | 2024-02-13 16:28:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-13 16:28:19 (GMT) |
commit | 681778c56a9204d65b8857e7ceba57f2c638671d (patch) | |
tree | 7d0f520a767a175e40f09f6aa40decc56fce7608 /Python/executor_cases.c.h | |
parent | de07941729b8899b187b8ef9690f9a74b2d6286b (diff) | |
download | cpython-681778c56a9204d65b8857e7ceba57f2c638671d.zip cpython-681778c56a9204d65b8857e7ceba57f2c638671d.tar.gz cpython-681778c56a9204d65b8857e7ceba57f2c638671d.tar.bz2 |
GH-113710: Improve `_SET_IP` and `_CHECK_VALIDITY` (GH-115248)
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r-- | Python/executor_cases.c.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 7d48d6a..58d2383 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -3360,10 +3360,9 @@ } case _SET_IP: { - oparg = CURRENT_OPARG(); + PyObject *instr_ptr = (PyObject *)CURRENT_OPERAND(); TIER_TWO_ONLY - // TODO: Put the code pointer in `operand` to avoid indirection via `frame` - frame->instr_ptr = _PyCode_CODE(_PyFrame_GetCode(frame)) + oparg; + frame->instr_ptr = (_Py_CODEUNIT *)instr_ptr; break; } @@ -3459,4 +3458,12 @@ break; } + case _CHECK_VALIDITY_AND_SET_IP: { + PyObject *instr_ptr = (PyObject *)CURRENT_OPERAND(); + TIER_TWO_ONLY + if (!current_executor->vm_data.valid) goto deoptimize; + frame->instr_ptr = (_Py_CODEUNIT *)instr_ptr; + break; + } + #undef TIER_TWO |