Repository navigation
feat(vcr-ra): flag-gated range re-allocation pass — first consequential allocator step (wiring 3a) - #288
Merged
Conversation
…ential allocator step (#209/#242, wiring step 3a) reallocate_function(instrs, pool): re-colour each maximal straight-line segment over the pool with VALUE RANGES as the allocation unit. Conservative pinning makes every segment independently sound with no cross-segment liveness: inputs (def==0) and per-register last-opened ranges (live-outs) keep their original registers; reserved-register ranges (R9-R12/SP) are identity-assigned outside the colouring. Renames only — never adds, removes, or reorders instructions, so labels and branch offsets are unaffected. Defense-in-depth: every interference edge is re-checked against the final assignment before a segment's rewrite is accepted; any decline passes the segment through untouched. Wired in arm_backend behind SYNTH_RANGE_REALLOC=1 (default OFF — every fixture stays bit-identical, verified by cmp). FLAG-ON evidence (the consequential gate): - differentials ALL RESULT-IDENTICAL: control_step 13/13 0x00210A55, flight_seam inlined+flat 0x07FDF307, div_const 338/338 - control_step + div_const: flag-on output is BYTE-identical to flag-off — the conservative pass re-derives the greedy assignment exactly (the strongest no-regression evidence) - flat_flight: 1/1 segment re-allocated, .text 1244 -> 1240 B (-4): the re-colouring enables more 16-bit Thumb encodings, result unchanged - stats per function: control_step 2/5 segments re-allocated, flight_seam 1/2, flat_flight 1/1 The flag stays default-off pending gale's on-target cycle confirmation (bytes != cycles, lesson #277). Step-4 spill insertion and the slack-aware assignment policy (const-CSE residency) build on this pass. Tests: pins honoured (inputs/live-outs/reserved identity), control flow verbatim, soundness on packed greedy code (output's own range interference conflict-free), structure preservation. 338/338 lib tests, clippy clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Jun 10, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The first consequential VCR-RA-001 step:
reallocate_functionre-colours each maximal straight-line segment with value ranges as the allocation unit, wired behindSYNTH_RANGE_REALLOC=1(default off — fixtures bit-identical, verified).Soundness by construction:
def==0) and per-register live-outs keep their original registers, so segments are independently sound with no cross-segment liveness; reserved registers (R9–R12/SP) identity-assigned outside the colouring.Flag-ON evidence (the gate that matters)
0x00210A55PASS0x07FDF307MATCH.text1244 → 1240 B (−4) — re-colouring enables more 16-bit Thumb forms, result unchangedFlag-OFF: all fixtures
cmp-bit-identical to v0.11.35. 338/338 lib tests, clippy clean.Why the flag stays off
Bytes ≠ cycles (lesson #277: the mla fusion removed instructions and still regressed on-target). The flip is gated on gale's on-target cycle confirmation. Step-4 spill insertion and the slack-aware assignment policy (the const-CSE residency unlock) build directly on this pass.
Falsification
Wrong if any flag-on module's result diverges from wasmtime — i.e. the pinning rules missed a cross-segment dependency or the interference convention let simultaneous values share a register. Watched by the four differentials (all green above) and the per-segment defense-in-depth check.
Traceability: VCR-RA-001 (epic #242,
release-v0.11.37).🤖 Generated with Claude Code