summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-02-13 16:28:19 (GMT)
committerGitHub <noreply@github.com>2024-02-13 16:28:19 (GMT)
commit681778c56a9204d65b8857e7ceba57f2c638671d (patch)
tree7d0f520a767a175e40f09f6aa40decc56fce7608 /Python/bytecodes.c
parentde07941729b8899b187b8ef9690f9a74b2d6286b (diff)
downloadcpython-681778c56a9204d65b8857e7ceba57f2c638671d.zip
cpython-681778c56a9204d65b8857e7ceba57f2c638671d.tar.gz
cpython-681778c56a9204d65b8857e7ceba57f2c638671d.tar.bz2
GH-113710: Improve `_SET_IP` and `_CHECK_VALIDITY` (GH-115248)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 2ad5878..96b97ca 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -4037,10 +4037,9 @@ dummy_func(
CHECK_EVAL_BREAKER();
}
- op(_SET_IP, (--)) {
+ op(_SET_IP, (instr_ptr/4 --)) {
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;
}
op(_SAVE_RETURN_OFFSET, (--)) {
@@ -4100,6 +4099,11 @@ dummy_func(
exe->count++;
}
+ op(_CHECK_VALIDITY_AND_SET_IP, (instr_ptr/4 --)) {
+ TIER_TWO_ONLY
+ DEOPT_IF(!current_executor->vm_data.valid);
+ frame->instr_ptr = (_Py_CODEUNIT *)instr_ptr;
+ }
// END BYTECODES //