Skip to content

Commit 522dc9a

Browse files
committed
Reverse temporary variable numbering
This makes the PEEK/POKE sequences less jarring.
1 parent f84798f commit 522dc9a

File tree

2 files changed

+51
-46
lines changed

2 files changed

+51
-46
lines changed

Python/generated_cases.c.h

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

Tools/cases_generator/generate_cases.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ def stack_analysis(
552552
# and 'lowest' and 'highest' are the extremes.
553553
# Note that 'lowest' may be negative.
554554
# TODO: Reverse the numbering.
555-
stack = [StackEffect(f"_tmp_{i+1}", "") for i in range(highest - lowest)]
555+
stack = [StackEffect(f"_tmp_{i+1}", "") for i in reversed(range(highest - lowest))]
556556
return stack, -lowest
557557

558558
def write_instructions(self) -> None:
@@ -629,6 +629,11 @@ def write_macro(self, mac: MacroInstruction) -> None:
629629
@contextlib.contextmanager
630630
def wrap_super_or_macro(self, up: SuperOrMacroInstruction):
631631
"""Shared boilerplate for super- and macro instructions."""
632+
# TODO: Somewhere (where?) make it so that if one instruction
633+
# has an output that is input to another, and the variable names
634+
# and types match and don't conflict with other instructions,
635+
# that variable is declared with the right name and type in the
636+
# outer block, rather than trusting the compiler to optimize it.
632637
self.out.emit("")
633638
with self.out.block(f"TARGET({up.name})"):
634639
for i, var in enumerate(up.stack):

0 commit comments

Comments
 (0)