Skip to content

Commit f62b675

Browse files
committed
Support RESUME op in Tier 2
- Add `#define TIER_ONE 1` to ceval.c - Skip `#if TIER_ONE` blocks in code generator - Use this in the bytecode definition for `RESUME`
1 parent 3cc9e84 commit f62b675

File tree

7 files changed

+30
-4
lines changed

7 files changed

+30
-4
lines changed

Include/internal/pycore_opcode_metadata.h

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

Python/bytecodes.c

+4-1
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/ceval.c

+1
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
578578
return _PyEval_EvalFrame(tstate, f->f_frame, throwflag);
579579
}
580580

581+
#define TIER_ONE 1
581582
#include "ceval_macros.h"
582583

583584

Python/executor_cases.c.h

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

Python/generated_cases.c.h

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

Tools/cases_generator/flags.py

+1-1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __init__(self, inst: parsing.InstDef):
120120
def is_viable_uop(self) -> bool:
121121
"""Whether this instruction is viable as a uop."""
122122
dprint: typing.Callable[..., None] = lambda *args, **kwargs: None
123-
if "PY_EXACT" in self.name:
123+
if "RESUME" in self.name:
124124
dprint = print
125125

126126
if self.name == "EXIT_TRACE":

0 commit comments

Comments
 (0)