Various Bug Fixes and Tailrec Cleanup - #553
Merged
Merged
Conversation
CAG2Mark
commented
Aug 27, 2026
Contributor
- Fixed two possible dormant bugs in the handler runtime where the continuation chain was not unlinked/relinked properly. (I only discovered these bugs when re-using the handler runtime for the shadow stack handler experimentation.) CC @AnsonYeung
- Made the tailrec pass idempotent by rewriting known calls to functions within each SCC into calls to the merged loop definition and added the corresponding tests.
- Cleaned up and refactored some logic in the tailrec pass to make it less error-prone.
Contributor
Author
|
Typo in the latest commit, it should be "make worker private". It seems making the worker private actually enables some optimizations. |
LPTK
reviewed
Aug 27, 2026
LPTK
reviewed
Aug 27, 2026
Contributor
Author
|
It seems the wrappers for the mutually tail-recursive function definitions were never given the inline annotation, so I've added that now |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes handler continuation-chain bookkeeping and makes tail-recursion optimization idempotent.
Changes:
- Corrects handler frame unlinking and relinking.
- Rewrites recursive SCC calls to merged loop functions.
- Adds and updates tail-recursion golden tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
Block.scala |
Adds flattened function parameter symbols. |
TailRecOpt.scala |
Refactors argument handling and SCC rewriting. |
Runtime.mls |
Fixes continuation-chain bookkeeping. |
Runtime.mjs |
Regenerates compiled runtime output. |
TailRecOpt.mls |
Adds idempotence coverage and snapshots. |
MultiArgLists.mls |
Adds curried/spread-call coverage and snapshots. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
AnsonYeung
reviewed
Aug 27, 2026
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.