Skip to content

bugc: carry the call-site source range on invoke/return contexts#263

Merged
gnidan merged 1 commit into
mainfrom
compiler-invoke-callsite
Jul 16, 2026
Merged

bugc: carry the call-site source range on invoke/return contexts#263
gnidan merged 1 commit into
mainfrom
compiler-invoke-callsite

Conversation

@gnidan

@gnidan gnidan commented Jul 16, 2026

Copy link
Copy Markdown
Member

A function call's caller JUMP (invoke) and continuation JUMPDEST
(return) previously carried only the callee's identity and definition
range — never the source range of the call expression itself. A debugger
stepping onto either mapped to the callee's definition, not to the call
site (add(3, 4)).

This composes the call-site code range — already in hand as the call
op's operationDebug — flat alongside the invoke and return contexts.
invoke/return and code are disjoint keys, so it is plain flat
composition (no gather). The invoke/return identity and runtime behavior
are unchanged.

Scope

  • Caller JUMP (invoke) at O0/O1 — terminator.ts.
  • Continuation JUMPDEST (return)block.ts.

Deferred (follow-ups, noted honestly)

  • TCO back-edge JUMP — needs the call-site loc threaded into the
    tail-call IR object; not available at that emission site today.
  • Inlined calls (O2/O3) — the surviving instruction already carries
    the callee-body code range, so the call site must be gathered with
    it (two colliding code keys), not flat-composed. That is a distinct,
    more involved change and lands separately.

A function call's caller JUMP (invoke) and continuation JUMPDEST
(return) previously carried only the callee's identity and
definition range — never the source range of the call expression
itself. Stepping onto either mapped to the callee's definition, not
to the call site.

Compose the call-site `code` range (already in hand as the call
op's operationDebug) flat alongside the invoke and return contexts.
invoke/return and code are disjoint keys, so this is plain flat
composition. Behavior and the invoke/return identity are unchanged.

Covers the real caller JUMP (O0/O1) and the continuation JUMPDEST.
Deferred: the TCO back-edge JUMP (needs the call-site loc threaded
into the tail-call IR) and inlined calls (the surviving instruction
already carries the callee-body range, so the call site must be
gathered rather than flat-composed) — both follow separately.
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-16 05:49 UTC

@gnidan
gnidan merged commit c17f52c into main Jul 16, 2026
4 checks passed
@gnidan
gnidan deleted the compiler-invoke-callsite branch July 16, 2026 05:45
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