Skip to content

Commit

Permalink
Simplify result handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom committed Apr 4, 2024
1 parent 27267d7 commit b917d1f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
12 changes: 0 additions & 12 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Tools/cases_generator/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Properties:
oparg_and_1: bool = False
const_oparg: int = -1
stub: bool = False
errors_if: bool = False

def dump(self, indent: str) -> None:
print(indent, end="")
Expand Down Expand Up @@ -540,6 +541,7 @@ def compute_properties(op: parser.InstDef) -> Properties:
)
deopts_if = variable_used(op, "DEOPT_IF")
exits_if = variable_used(op, "EXIT_IF")
errors_if = variable_used(op, "ERROR_IF")
if deopts_if and exits_if:
tkn = op.tokens[0]
raise lexer.make_syntax_error(
Expand Down Expand Up @@ -575,6 +577,7 @@ def compute_properties(op: parser.InstDef) -> Properties:
passthrough=passthrough,
tier=tier_variable(op),
stub="stub" in op.annotations,
errors_if=errors_if
)


Expand Down
10 changes: 6 additions & 4 deletions Tools/cases_generator/tier2_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,12 @@ def generate_tier2(
out.emit("switch (result) {\n")
out.emit("case 0:\n")
out.emit("break;\n")
out.emit("case 1:\n")
out.emit("JUMP_TO_ERROR();\n");
out.emit("case 2:\n")
out.emit("JUMP_TO_JUMP_TARGET();\n");
if uop.properties.errors_if:
out.emit("case 1:\n")
out.emit("JUMP_TO_ERROR();\n");
if uop.properties.deopts:
out.emit("case 2:\n")
out.emit("JUMP_TO_JUMP_TARGET();\n");
out.emit("}\n")
stack = None
else:
Expand Down

0 comments on commit b917d1f

Please sign in to comment.