Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

efaust
Copy link

@efaust efaust commented Mar 30, 2016

No description provided.

@littledan
Copy link
Member

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>
Copy link
Contributor

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

@littledan
Copy link
Member

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

@littledan
Copy link
Member

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.

@bterlson
Copy link
Member

bterlson commented Apr 18, 2016

@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?

@littledan
Copy link
Member

We could make it like SetValueInBuffer, where the implementation decides whether it's a tail-calling or non-tail-calling cross-realm thing.

@littledan
Copy link
Member

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.

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.

4 participants