bugc: emit coalesce transform on read-write merging#228
Merged
Conversation
Marks the SHL/OR field-packing sequence produced by ReadWriteMerging (level 3) with transform:["coalesce"], so debuggers can show that a packed-storage write is compiler-synthesized rather than source the user wrote. Every instruction the merge produces (shifts, ORs, and the merged write) routes its debug through Ir.Utils.addTransform, which appends coalesce to any existing transform array — so a folded value packed into a word composes as ["fold","coalesce"]. Per #212, coalesce = read-write (SHL/OR) packing specifically; the CFG-merging passes (block-merging, return-merging) are left unmarked for v1. Adds an end-to-end test: coalesce marker present at level 3, absent at levels 0-2.
Contributor
|
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.
Emits
transform: ["coalesce"]on the SHL/OR field-packing sequence produced byReadWriteMerging(L3), so the tracer widget lights up O3 — a debugger can show a packed-storage write is compiler-synthesized rather than source the user wrote. Completes the emitted-transform set (fold #225 / tailcall #217 / coalesce;inlinepending the #16 pass).Approach
Every instruction the merge produces (shifts, ORs, and the merged write) routes its debug through the shared
Ir.Utils.addTransformhelper (from #225), which appendscoalesceto any existingtransformarray — so a folded value packed into a word composes as["fold","coalesce"].Per #212,
coalesce= read-write (SHL/OR) packing specifically. The CFG-merging passes (block-merging,return-merging) are intentionally left unmarked for v1 (team-lead + architect agreed; nomergeid yet).Evidence (widget path,
runtimeInstructions)Changes
optimizer/steps/read-write-merging.ts— mark merged instructions viaaddTransform.evmgen/transform-contexts.test.ts— end-to-end test: coalesce present at L3, absent at L0-2.Verification
yarn build+ full bugc suite green (418 passed, 22 pre-existing skips).