Skip to content

Commit ab74ef0

Browse files
committed
Make RESUME a viable uop
1 parent 0218222 commit ab74ef0

File tree

7 files changed

+31
-5
lines changed

7 files changed

+31
-5
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,6 +2633,7 @@ def dummy(x):
26332633
self.assertIsNotNone(ex)
26342634
uops = {opname for opname, _, _ in ex}
26352635
self.assertIn("_PUSH_FRAME", uops)
2636+
self.assertIn("_BINARY_OP_ADD_INT", uops)
26362637

26372638

26382639

Python/bytecodes.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ dummy_func(
135135
}
136136

137137
inst(RESUME, (--)) {
138+
#if TIER_ONE
138139
assert(tstate->cframe == &cframe);
139140
assert(frame == cframe.current_frame);
140141
/* Possibly combine this with eval breaker */
@@ -143,7 +144,9 @@ dummy_func(
143144
ERROR_IF(err, error);
144145
next_instr--;
145146
}
146-
else if (oparg < 2) {
147+
else
148+
#endif
149+
if (oparg < 2) {
147150
CHECK_EVAL_BREAKER();
148151
}
149152
}

Python/executor_cases.c.h

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/cases_generator/flags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def variable_used_unspecialized(node: parsing.Node, name: str) -> bool:
9292
if text == "#if":
9393
if (
9494
i + 1 < len(node.tokens)
95-
and node.tokens[i + 1].text == "ENABLE_SPECIALIZATION"
95+
and node.tokens[i + 1].text in ("ENABLE_SPECIALIZATION", "TIER_ONE")
9696
):
9797
skipping = True
9898
elif text in ("#else", "#endif"):

Tools/cases_generator/instructions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ def __init__(self, inst: parsing.InstDef):
122122
def is_viable_uop(self) -> bool:
123123
"""Whether this instruction is viable as a uop."""
124124
dprint: typing.Callable[..., None] = lambda *args, **kwargs: None
125-
if "PUSH_FRAME" in self.name:
126-
dprint = print
125+
# if "RESUME" in self.name:
126+
# dprint = print
127127

128128
if self.name == "EXIT_TRACE":
129129
return True # This has 'return frame' but it's okay

0 commit comments

Comments
 (0)