Skip to content

bugc: flatten TCO back-edge JUMP context#214

Merged
gnidan merged 1 commit into
transform-contextfrom
compiler-tco-flat-context
Jun 18, 2026
Merged

bugc: flatten TCO back-edge JUMP context#214
gnidan merged 1 commit into
transform-contextfrom
compiler-tco-flat-context

Conversation

@gnidan

@gnidan gnidan commented Apr 16, 2026

Copy link
Copy Markdown
Member

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

github-actions Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-18 02:00 UTC

@gnidan gnidan merged commit 1e6d5ca into transform-context Jun 18, 2026
4 checks passed
@gnidan gnidan deleted the compiler-tco-flat-context branch June 18, 2026 01:56
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