Skip to content

v0.44.0 Lane D: #390 redundant-store elimination in forward_stack_reloads (gust_poll 724→716 B) - #765

Merged
avrabe merged 1 commit into
mainfrom
feat/44-390-spill-size
Jul 15, 2026
Merged

avrabe merged 1 commit into
mainfrom
feat/44-390-spill-size

Conversation

@avrabe

@avrabe avrabe commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

VCR-PERF-001 Lane D. Extends the forward_stack_reloads holder lattice with redundant-store elimination: a full-word str rd,[sp,#N] whose slot the lattice PROVES already holds rd's value writes bytes the slot already has — a no-op — so it's deleted.

gust_poll 724→716 B (−8 by the size-oracle symbol-delta method): one redundant str.w r0,[sp,#40] removed between the func_0 reload and the func_1 call (r0 unchanged since the reload, slot #40 still holding it). Only gust_poll's bytes change; func_0/func_1/gust_mix byte-identical.

Soundness (reuses the shipped reload-forwarding lattice)

Verification (coordinator re-ran ALL of this — original agent died on an API stall before pushing)

🤖 Generated with Claude Code

…st_poll 724→716 B

VCR-PERF-001 Lane D (v0.44): extend the forward_stack_reloads holder lattice
with redundant-store elimination. A `str rd,[sp,#N]` whose slot #N the lattice
PROVES already holds rd's value (a caller-save value re-spilled unchanged
between two calls) writes bytes the slot already has — a no-op. Delete it.

gust_poll: one redundant `str.w r0,[sp,#40]` removed between the func_0 reload
and the func_1 call (r0 unchanged since the reload, slot #40 still holding it
from the pre-func_0 spill). 722→716 B machine code (−6, one str.w + 2 B
realignment); 724→716 B by the size oracle's symbol-delta method (−8).
Only gust_poll's bytes change — func_0/func_1/gust_mix byte-identical.

SOUNDNESS:
- Same #606 frozen-span guard as reload-deletion: a deletion inside a resolved
  branch→target span would shift the pre-resolved displacement, so a frozen
  candidate is kept (re-writes the same value; state below identical).
- On deletion the holder set is left UNCHANGED — the slot content is unaltered
  by removing a redundant write, so every co-holder register stays valid;
  collapsing to {rd} would only lose precision.
- OVERWRITE-ONLY / sub-word-hole invariants untouched: this deletes a full-word
  store the lattice already tracks; sub-word sp accesses still clear holders.

Correctness evidence on the new bytes BEFORE re-pinning the size oracle:
- gust_spill_fwd_390_differential.py PASS — gust_poll return value AND post-call
  state struct match wasmtime in all three configs (default, SYNTH_NO_STACK_FWD,
  SYNTH_SPILL_REALLOC=0).
- full scripts/repro/*_differential.py sweep: 90 PASS; the 6 failures fail
  IDENTICALLY on the pristine origin/main binary (5 fact_spec_* need
  --features verify; 1 u64_unpack_riscv a pre-existing RISC-V unicorn harness
  issue) — none are regressions.
- full synth-cli + synth-synthesis test suites green (frozen anchors unchanged).

Also fixes gust_spill_fwd_390_differential.py: post-#758 (v0.43.1) the
self-contained image carries the ~1 MB data ROM image inside `.text`, so
`text.data()` overflowed the 64 KB unicorn code window (UC_ERR_WRITE_UNMAPPED)
on ANY binary. Write only the code prefix that fits — every reachable
instruction lives in the first few KB.

Size oracle re-pinned 724→716; artifacts/size_attribution_390.md regenerated
(gust_poll 3.55x→3.44x vs cited LLVM). Two new unit tests cover the delete and
the reg-reloaded-between keep.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
@avrabe
avrabe merged commit 4c1e906 into main Jul 15, 2026
36 checks passed
@avrabe
avrabe deleted the feat/44-390-spill-size branch July 15, 2026 17:26
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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