Skip to content

Commit fbaf77e

Browse files
authored
gh-109214: Rename SAVE_IP to _SET_IP, and similar (#109285)
* Rename SAVE_IP to _SET_IP * Rename EXIT_TRACE to _EXIT_TRACE * Rename SAVE_CURRENT_IP to _SAVE_CURRENT_IP * Rename INSERT to _INSERT (This is for Ken Jin's abstract interpreter) * Rename IS_NONE to _IS_NONE * Rename JUMP_TO_TOP to _JUMP_TO_TOP
1 parent 1ee50e2 commit fbaf77e

File tree

11 files changed

+117
-117
lines changed

11 files changed

+117
-117
lines changed

Include/internal/pycore_opcode_metadata.h

+35-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/test/test_capi/test_misc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2390,7 +2390,7 @@ def testfunc(x):
23902390
ex = get_first_executor(testfunc)
23912391
self.assertIsNotNone(ex)
23922392
uops = {opname for opname, _, _ in ex}
2393-
self.assertIn("SAVE_IP", uops)
2393+
self.assertIn("_SET_IP", uops)
23942394
self.assertIn("LOAD_FAST", uops)
23952395

23962396
def test_extended_arg(self):
@@ -2536,7 +2536,7 @@ def testfunc(n):
25362536
ex = get_first_executor(testfunc)
25372537
self.assertIsNotNone(ex)
25382538
uops = {opname for opname, _, _ in ex}
2539-
self.assertIn("JUMP_TO_TOP", uops)
2539+
self.assertIn("_JUMP_TO_TOP", uops)
25402540

25412541
def test_jump_forward(self):
25422542
def testfunc(n):

Python/abstract_interp_cases.c.h

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

+17-17
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,8 @@ dummy_func(
803803
}
804804

805805
macro(RETURN_VALUE) =
806-
SAVE_IP + // Tier 2 only; special-cased oparg
807-
SAVE_CURRENT_IP + // Sets frame->prev_instr
806+
_SET_IP + // Tier 2 only; special-cased oparg
807+
_SAVE_CURRENT_IP + // Sets frame->prev_instr
808808
_POP_FRAME;
809809

810810
inst(INSTRUMENTED_RETURN_VALUE, (retval --)) {
@@ -828,8 +828,8 @@ dummy_func(
828828

829829
macro(RETURN_CONST) =
830830
LOAD_CONST +
831-
SAVE_IP + // Tier 2 only; special-cased oparg
832-
SAVE_CURRENT_IP + // Sets frame->prev_instr
831+
_SET_IP + // Tier 2 only; special-cased oparg
832+
_SAVE_CURRENT_IP + // Sets frame->prev_instr
833833
_POP_FRAME;
834834

835835
inst(INSTRUMENTED_RETURN_CONST, (--)) {
@@ -2310,7 +2310,7 @@ dummy_func(
23102310
JUMPBY(oparg * flag);
23112311
}
23122312

2313-
op(IS_NONE, (value -- b)) {
2313+
op(_IS_NONE, (value -- b)) {
23142314
if (Py_IsNone(value)) {
23152315
b = Py_True;
23162316
}
@@ -2320,9 +2320,9 @@ dummy_func(
23202320
}
23212321
}
23222322

2323-
macro(POP_JUMP_IF_NONE) = IS_NONE + POP_JUMP_IF_TRUE;
2323+
macro(POP_JUMP_IF_NONE) = _IS_NONE + POP_JUMP_IF_TRUE;
23242324

2325-
macro(POP_JUMP_IF_NOT_NONE) = IS_NONE + POP_JUMP_IF_FALSE;
2325+
macro(POP_JUMP_IF_NOT_NONE) = _IS_NONE + POP_JUMP_IF_FALSE;
23262326

23272327
inst(JUMP_BACKWARD_NO_INTERRUPT, (--)) {
23282328
/* This bytecode is used in the `yield from` or `await` loop.
@@ -3069,8 +3069,8 @@ dummy_func(
30693069
_CHECK_FUNCTION_EXACT_ARGS +
30703070
_CHECK_STACK_SPACE +
30713071
_INIT_CALL_PY_EXACT_ARGS +
3072-
SAVE_IP + // Tier 2 only; special-cased oparg
3073-
SAVE_CURRENT_IP + // Sets frame->prev_instr
3072+
_SET_IP + // Tier 2 only; special-cased oparg
3073+
_SAVE_CURRENT_IP + // Sets frame->prev_instr
30743074
_PUSH_FRAME;
30753075

30763076
macro(CALL_PY_EXACT_ARGS) =
@@ -3079,8 +3079,8 @@ dummy_func(
30793079
_CHECK_FUNCTION_EXACT_ARGS +
30803080
_CHECK_STACK_SPACE +
30813081
_INIT_CALL_PY_EXACT_ARGS +
3082-
SAVE_IP + // Tier 2 only; special-cased oparg
3083-
SAVE_CURRENT_IP + // Sets frame->prev_instr
3082+
_SET_IP + // Tier 2 only; special-cased oparg
3083+
_SAVE_CURRENT_IP + // Sets frame->prev_instr
30843084
_PUSH_FRAME;
30853085

30863086
inst(CALL_PY_WITH_DEFAULTS, (unused/1, func_version/2, callable, self_or_null, args[oparg] -- unused)) {
@@ -3851,33 +3851,33 @@ dummy_func(
38513851
}
38523852
}
38533853

3854-
op(JUMP_TO_TOP, (--)) {
3854+
op(_JUMP_TO_TOP, (--)) {
38553855
pc = 0;
38563856
CHECK_EVAL_BREAKER();
38573857
}
38583858

3859-
op(SAVE_IP, (--)) {
3859+
op(_SET_IP, (--)) {
38603860
frame->prev_instr = ip_offset + oparg;
38613861
}
38623862

3863-
op(SAVE_CURRENT_IP, (--)) {
3863+
op(_SAVE_CURRENT_IP, (--)) {
38643864
#if TIER_ONE
38653865
frame->prev_instr = next_instr - 1;
38663866
#endif
38673867
#if TIER_TWO
3868-
// Relies on a preceding SAVE_IP
3868+
// Relies on a preceding _SET_IP
38693869
frame->prev_instr--;
38703870
#endif
38713871
}
38723872

3873-
op(EXIT_TRACE, (--)) {
3873+
op(_EXIT_TRACE, (--)) {
38743874
frame->prev_instr--; // Back up to just before destination
38753875
_PyFrame_SetStackPointer(frame, stack_pointer);
38763876
Py_DECREF(self);
38773877
return frame;
38783878
}
38793879

3880-
op(INSERT, (unused[oparg], top -- top, unused[oparg])) {
3880+
op(_INSERT, (unused[oparg], top -- top, unused[oparg])) {
38813881
// Inserts TOS at position specified by oparg;
38823882
memmove(&stack_pointer[-1 - oparg], &stack_pointer[-oparg], oparg * sizeof(stack_pointer[0]));
38833883
}

Python/executor_cases.c.h

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)