Skip to content

bugc: emit coalesce transform on read-write merging#228

Merged
gnidan merged 1 commit into
transform-contextfrom
compiler-emit-coalesce
Jul 2, 2026
Merged

bugc: emit coalesce transform on read-write merging#228
gnidan merged 1 commit into
transform-contextfrom
compiler-emit-coalesce

Conversation

@gnidan

@gnidan gnidan commented Jul 2, 2026

Copy link
Copy Markdown
Member

Emits transform: ["coalesce"] on the SHL/OR field-packing sequence produced by ReadWriteMerging (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; inline pending the #16 pass).

Approach

Every instruction the merge produces (shifts, ORs, and the merged write) routes its debug through the shared Ir.Utils.addTransform helper (from #225), 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 intentionally left unmarked for v1 (team-lead + architect agreed; no merge id yet).

Evidence (widget path, runtimeInstructions)

L0/L1/L2  coalesce-marked instructions: 0
L3        coalesce-marked instructions: >0  (SHL/OR packing seq)

Changes

  • optimizer/steps/read-write-merging.ts — mark merged instructions via addTransform.
  • 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).

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.
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-02 21:56 UTC

@gnidan gnidan merged commit 4a46330 into transform-context Jul 2, 2026
4 checks passed
@gnidan gnidan deleted the compiler-emit-coalesce branch July 2, 2026 21:51
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