-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow cross-realm tail calls to consume linear resources. #508
base: main
Are you sure you want to change the base?
Conversation
LGTM; it seems like we reached consensus on this at the March 2016 TC39 meeting on Tuesday. |
<emu-note> | ||
<p>For example, a tail position call should only grow an implementation's activation record stack by the amount that the size of the target function's activation record exceeds the size of the calling function's activation record. If the target function's activation record is smaller, then the total size of the stack should decrease.</p> | ||
<p>For example, a same-realm tail position call should only grow an implementation's activation record stack by the amount that the size of the target function's activation record exceeds the size of the calling function's activation record. If the target function's activation record is smaller, then the total size of the stack should decrease.</p> | ||
<p>Because cross-realm tail position calls still syntactically appear in tail poition, implementations may optionally elect to optimize cross-realm tail position calls to not increase total internal resource consumption in this manner, or to emit a warning in this case.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: in tail poition → position
In more discussion within the TC39 meeting, we decided that this patch should be reworded to explicitly allow (and, non-normatively, prefer) proper tail calls. @allenwb |
I believe the current patch meets the requirements from TC39 that the wording should aim towards explicitly allowing (and phrasing as the default) proper tail calls. In #535 , @msaboff raised concerns about the web compatibility of making proper tail calls optional for the cross-realm case. Let's continue discussion of that on this thread. |
@littledan / @efaust I don't believe this text matches consensus because it is default-no-TCO-cross-realm. I think it would be preferable to have the default case be that cross-realm tail calls happen as this text reads like it's somehow desirable to not do tail calls. That said, I'm not entirely sure how to accomplish this without allowing an implementation to decide for any reason they can't do a tail call which kind of defeats the purpose here. Thoughts? |
We could make it like SetValueInBuffer, where the implementation decides whether it's a tail-calling or non-tail-calling cross-realm thing. |
At the TC39 meeting in May 2016, @msaboff clarified that he has no objection to this change. The PR seems to have changed the default. |
3d0c24c
to
7a79833
Compare
No description provided.