Skip to content

Try a typed local for indexed comparison bases - #29

Merged
Sumaiter merged 2 commits into
mainfrom
fix/materialize-index-base
Nov 14, 2026
Merged

Sumaiter merged 2 commits into
mainfrom
fix/materialize-index-base

Conversation

@Sumaiter

@Sumaiter Sumaiter commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

An inline cast used as an indexed base can keep an otherwise exact candidate on a different register allocation. Add a bounded, game-independent search variant that gives the existing cast its own local before a plain comparison, inside the same gate or loop.

The variant preserves the cast type, address expression, index, comparison and ABI. It infers no array bound, element width, data ownership or initial value. Short-circuits, side effects, hidden qualifiers, escaped/shadowed bases, attributes, macro-altered headers and ambiguous insertion points are rejected. Claims, handoff, search budgets and independent promotion checks are unchanged.

Validation:

  • Ten focused regression tests cover insertion scope and counterexamples; the full Python suite and 23 JavaScript tests pass.
  • Eight unchanged SN EE compiler runs cover int, short, float and double headers. Actual call/data relocation symbols, types and encoded addends are checked, including the double comparison helper.
  • The generated AST reproduces a retained reviewed 80-byte source after renaming only the added local. That compiler pair removed a one-byte register-order difference and independently passed all three placements and actual targets. No new game compilation or claim transfer was performed.
  • The VSIX builds and contains the exact new runtime module. No game sources, ROMs, objects, private paths or toolchains are included.

Synthetic compiler metadata and an optional reproduction runner are included. A generated candidate still requires full independent byte, relocation, ABI, ownership and semantic review; this rule does not approve matches.

Review corrections: reject function-local typedefs rather than hoisting the new declaration across an alias scope, reject source/context-dependent reserved identifiers throughout the translation unit, and include enum constants when choosing a fresh local name. Three new regressions cover these counterexamples. All 570 Python tests (9 optional skips), 23 JavaScript tests and packaging pass on this branch; the combined #28/#29 tree passes 580 Python tests (9 optional skips) and all 23 JavaScript tests. All eight synthetic source hashes and all four recorded relocation/addend inventories still match the retained evidence. No additional native game or proprietary compiler runs were performed in this review.

@Sumaiter
Sumaiter merged commit 2f088f0 into main Nov 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant