summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2023-07-13 19:14:51 (GMT)
committerGitHub <noreply@github.com>2023-07-13 19:14:51 (GMT)
commite6e0ea0113748db1e9fe675be6db9041cd5cce1f (patch)
treeea6e1d899151e58ec7b88a7e2e969470eb9ef042 /Python/bytecodes.c
parent2f3ee02c22c4b42bf6075a75104c3cfbb4eb4c86 (diff)
downloadcpython-e6e0ea0113748db1e9fe675be6db9041cd5cce1f.zip
cpython-e6e0ea0113748db1e9fe675be6db9041cd5cce1f.tar.gz
cpython-e6e0ea0113748db1e9fe675be6db9041cd5cce1f.tar.bz2
gh-106701: Move the hand-written Tier 2 uops to bytecodes.c (#106702)
This moves EXIT_TRACE, SAVE_IP, JUMP_TO_TOP, and _POP_JUMP_IF_{FALSE,TRUE} from ceval.c to bytecodes.c. They are no less special than before, but this way they are discoverable o the copy-and-patch tooling.
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 176dbb5..1fe9970 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -3654,6 +3654,36 @@ dummy_func(
Py_UNREACHABLE();
}
+ ///////// Tier-2 only opcodes /////////
+
+ op(_POP_JUMP_IF_FALSE, (flag -- )) {
+ if (Py_IsFalse(flag)) {
+ pc = oparg;
+ }
+ }
+
+ op(_POP_JUMP_IF_TRUE, (flag -- )) {
+ if (Py_IsTrue(flag)) {
+ pc = oparg;
+ }
+ }
+
+ op(JUMP_TO_TOP, (--)) {
+ pc = 0;
+ CHECK_EVAL_BREAKER();
+ }
+
+ op(SAVE_IP, (--)) {
+ frame->prev_instr = ip_offset + oparg;
+ }
+
+ op(EXIT_TRACE, (--)) {
+ frame->prev_instr--; // Back up to just before destination
+ _PyFrame_SetStackPointer(frame, stack_pointer);
+ Py_DECREF(self);
+ return frame;
+ }
+
// END BYTECODES //