Skip to content

Conversation

@kripken
Copy link
Member

@kripken kripken commented Jul 27, 2021

Similar to #4025, but when there is a tail call in the function as opposed to
the function is tail-called from somewhere.

@kripken kripken requested review from aheejin and tlively July 27, 2021 17:04
@tlively
Copy link
Member

tlively commented Jul 27, 2021

Doesn't the tail call count as a return and get factored into the LUB, though?

@kripken
Copy link
Member Author

kripken commented Jul 27, 2021

It doesn't, as we just look at returns and not return_call*s. And I believe we should not look at those things, as their presence requires us to return a particular type exactly and nothing more refined (unlike the usual subtyping rules).

@tlively
Copy link
Member

tlively commented Jul 27, 2021

Do return_calls not obey subtyping? It seems like they should.

@kripken
Copy link
Member Author

kripken commented Jul 27, 2021

The validator currently requires precise matching of the type. The spec appears to do the same,

https://github.com/WebAssembly/tail-call/blob/master/proposals/tail-call/Overview.md#validation

That does not surprise me, as it seems like it makes the VM's life a lot simpler when doing a tail to know that the types are identical - it can use the same stack frame without thinking about it. But I'm not an expert on that.

@tlively
Copy link
Member

tlively commented Jul 27, 2021

The tail call proposal spec is not based on any of the other proposals that include subtyping. The point of subtyping is that subtypes can be used wherever supertypes are expected with no coersions, so engines wouldn't have to do anything to make this work safely. I'm working on a PR to update our validator now.

@tlively
Copy link
Member

tlively commented Jul 28, 2021

Ok, after #4032 I believe the return_calls can be handled the same as normal returns. I would be happy to talk about this more tomorrow.

@kripken
Copy link
Member Author

kripken commented Jul 28, 2021

I'll open a new PR for this after #4035 lands.

@kripken kripken closed this Jul 28, 2021
@kripken kripken deleted the tail2 branch July 28, 2021 19:44
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.

3 participants