WIP: test(lift): the frame-store and dead-flag text passes get a check of their own #1571

Draft
dyst wants to merge 1 commit from dyst/Longshot:test/lift-text-passes into main
Member

Type: test · Risk: low · Tested on: Windows 11, Ryzen 9 3900X · Needs: none

TL;DR

Two of the rewrites the translator makes to the C it writes had no check: the one that stops marking stores to the stack through the frame pointer, and the one that drops flag updates nothing reads. This adds a game-free check of both. Each fails it when broken by hand.

Breakdown

  • Who it helps: anyone changing the translator's emit (#1560 moves it; #1469 changes register handling).
  • What was wrong: frame_stores, fp_is_frame and drop_flag_stores (a64-kit's emit) were checked only by the game-dependent checks that tests/run_all.py skips.
  • What changes: tests/test_lift_text_passes.py, a check on texts in suyu's own shapes and through emit_function on made-up functions.
  • What does not change: the translator, the game.
  • How it was checked: passes on 310e7c9d; frame_stores made a no-op, drop_flag_stores dropping every flag write, and fp_is_frame always true each fail it.
  • What is still open: nothing.
  • Risk: low: a check only.

Why

The wiki's CPU rework plan asks that every pass over the emitted C has a game-free check before the passes are restructured (milestone C4). Of the passes in the kit's emit and Longshot's layer, these two had none naming them: the mark grouping, the giant split, fast float, the entry splices, the polls, local registers and the game patches already have theirs.

What changed

  • tests/test_lift_text_passes.py (new): fp_is_frame (no write of x29, the frame setup and its restore are the frame; any other write, or taking x29's address, is not); frame_stores (stores through x29, direct, through _b and pairs, take the _sp form; stores through other registers and loads are left alone); through emit_function (a frame pointer's stores lose their marks, an ordinary x29's keep them, A64_MARK_FRAME=1 keeps them all); drop_flag_stores (dead flags' writes go, live ones and flag comparisons stay).

Measurements

Verdict: nothing to measure: a check only.

Flags and settings

None.

Testing

Tested: on Windows 11 with the Builder's Python 3.14: passes on 310e7c9d; each of the three passes broken by hand fails it (exit status 1, its message), and passes again restored.

Not tested: Linux (pure Python, no compiler).

Must be tested: None.

Risks

What could break: nothing in the game.

Turning it off: revert the commit.

Compatibility: nothing changes.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main. On 310e7c9d.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named). This check passes; the full suite not run yet.
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

🤖 Generated with Claude Code

**Type:** test · **Risk:** low · **Tested on:** Windows 11, Ryzen 9 3900X · **Needs:** none ## TL;DR Two of the rewrites the translator makes to the C it writes had no check: the one that stops marking stores to the stack through the frame pointer, and the one that drops flag updates nothing reads. This adds a game-free check of both. Each fails it when broken by hand. ## Breakdown - **Who it helps:** anyone changing the translator's emit (#1560 moves it; #1469 changes register handling). - **What was wrong:** `frame_stores`, `fp_is_frame` and `drop_flag_stores` (a64-kit's emit) were checked only by the game-dependent checks that `tests/run_all.py` skips. - **What changes:** `tests/test_lift_text_passes.py`, a check on texts in suyu's own shapes and through `emit_function` on made-up functions. - **What does not change:** the translator, the game. - **How it was checked:** passes on `310e7c9d`; `frame_stores` made a no-op, `drop_flag_stores` dropping every flag write, and `fp_is_frame` always true each fail it. - **What is still open:** nothing. - **Risk:** low: a check only. ## Why The wiki's CPU rework plan asks that every pass over the emitted C has a game-free check before the passes are restructured (milestone C4). Of the passes in the kit's emit and Longshot's layer, these two had none naming them: the mark grouping, the giant split, fast float, the entry splices, the polls, local registers and the game patches already have theirs. ## What changed - `tests/test_lift_text_passes.py` (new): `fp_is_frame` (no write of x29, the frame setup and its restore are the frame; any other write, or taking x29's address, is not); `frame_stores` (stores through x29, direct, through `_b` and pairs, take the `_sp` form; stores through other registers and loads are left alone); through `emit_function` (a frame pointer's stores lose their marks, an ordinary x29's keep them, `A64_MARK_FRAME=1` keeps them all); `drop_flag_stores` (dead flags' writes go, live ones and flag comparisons stay). ## Measurements **Verdict:** nothing to measure: a check only. ### Flags and settings None. ## Testing **Tested:** on Windows 11 with the Builder's Python 3.14: passes on `310e7c9d`; each of the three passes broken by hand fails it (exit status 1, its message), and passes again restored. **Not tested:** Linux (pure Python, no compiler). **Must be tested:** None. ## Risks **What could break:** nothing in the game. **Turning it off:** revert the commit. **Compatibility:** nothing changes. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [ ] Rebased on current `main`. *On `310e7c9d`.* - [ ] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). *This check passes; the full suite not run yet.* - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
test(lift): the frame-store and dead-flag text passes get a check of their own
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 9s
CI / Workflow lint (actionlint) (pull_request) Successful in 10s
Third-party parts / As their notes say (pull_request) Successful in 11s
b8da9e1482
a64-kit's emit rewrites suyu's C in two places no check named: frame_stores, which gives
a frame pointer's stores the unmarked _sp form (only where fp_is_frame says every write of
x29 is the frame setup or its restore), and drop_flag_stores, which drops the NZCV writes
the liveness found dead. tests/test_lift_text_passes.py checks both on texts in suyu's
shapes and frame_stores through emit_function (a frame pointer's store unmarked, an ordinary
x29's kept marked, A64_MARK_FRAME keeping them all); each pass broken by hand fails it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 9s
CI / Workflow lint (actionlint) (pull_request) Successful in 10s
Third-party parts / As their notes say (pull_request) Successful in 11s
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'test/lift-text-passes:dyst-test/lift-text-passes'
git switch 'dyst-test/lift-text-passes'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!1571
No description provided.