bugc: carry the call-site source range on the TCO back-edge JUMP#273
Merged
Conversation
Contributor
|
Member
Author
|
Review notes from the format/pointers side:
This completes the call-site story from #263/#267 for the tail-call case. |
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.
When tail-call optimization rewrites a tail-recursive call into a
back-edge JUMP, that JUMP carries a flat
{return, invoke, transform: ["tailcall"]}context so a debugger still sees the recursivecall in the trace. Until now it mapped only to the callee declaration —
the call expression the user wrote had no instruction pointing back to
it.
This carries the call site's own
coderange on the back-edge JUMP,composed flat alongside the invoke/return (disjoint keys). It completes
the call-site source-range story that #263 established for a real caller
JUMP (
{invoke, code}) and its continuation JUMPDEST ({return, code}),and #267 carried through inlining — now the tail-call case matches.
The call expression's range already lives on the original call
terminator's
operationDebug; the TCO pass captures it onto theTailCallIR object (mirroring the existingdeclarationLoc/declarationSourceIdfields), and codegen composes it into the JUMP'scontext. Emission-only: no execution semantics change, and the range is
dropped cleanly when a function has no source location.