Skip to content

bugc: flatten TCO back-edge JUMP context#214

Open
gnidan wants to merge 1 commit intotransform-contextfrom
compiler-tco-flat-context
Open

bugc: flatten TCO back-edge JUMP context#214
gnidan wants to merge 1 commit intotransform-contextfrom
compiler-tco-flat-context

Conversation

@gnidan
Copy link
Copy Markdown
Member

@gnidan gnidan commented Apr 16, 2026

Summary

The TCO back-edge JUMP previously wrapped its invoke and return contexts in a gather. Multiple discriminator keys can coexist on a single context object, so the JUMP now carries a flat combined context with both invoke and return directly.

Applies to future annotation emissions as well (e.g., the upcoming inlining pass will combine invoke with transform without gather wrapping).

Changes

  • evmgen/generation/control-flow/terminator.tsbuildTailCallJumpOptions emits { return: {...}, invoke: {...} } directly
  • evmgen/optimizer-contexts.test.tscountCallSites helper now checks invoke and return independently so flat multi-discriminator contexts get counted in both buckets; TCO-specific assertion finds the back-edge JUMP by the presence of both discriminators rather than by gather wrapper

Test plan

  • bugc typecheck clean
  • optimizer-contexts.test.ts passes (31/31) at all levels
  • Full bugc suite passes (406 passed, 22 skipped)

The TCO back-edge JUMP previously emitted a gather wrapper
around its invoke and return contexts. Multiple discriminator
keys can coexist on a single context object without gather
wrapping, so the JUMP now carries a flat combined context with
both `invoke` and `return` keys directly.

Updates the countCallSites helper in optimizer-contexts.test
to check invoke and return independently rather than as an
either/or, so flat multi-discriminator contexts get counted
in both buckets. The TCO-specific assertion now finds the
back-edge JUMP by the presence of both discriminators rather
than by a gather wrapper.
@github-actions
Copy link
Copy Markdown
Contributor

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://ethdebug.github.io/format/pr-preview/pr-214/

Built to branch gh-pages at 2026-04-16 09:09 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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