-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clear reference to 'this' on all tail calls
Removes calls to emitClearLocals(), which is a no-op. When the context is RETURN (indicating a tail call), and the operation is an InvokeExpr, StaticMethodExpr, or InstanceMethodExpr, clear the reference to 'this' which is in slot 0 of the locals. Edge-case: Inside the body of a try block, we cannot clear 'this' at the tail position as we might need to keep refs around for use in the catch or finally clauses. Introduces another truthy dynamic binding var to track position being inside a try block. In a try block with no catch or finally, use enclosing context and return a regular BodyExpr. Adds two helpers to emitClearThis and inTailCall. Adds test for the original reducer case and some try/catch cases. Signed-off-by: Stuart Halloway <stu@cognitect.com>
- Loading branch information
1 parent
6f4a49b
commit 9b6c3a5
Showing
3 changed files
with
81 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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