-
Notifications
You must be signed in to change notification settings - Fork 13
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
Implementation characteristics of cont.bind (cf. func.bind) #87
Comments
I should say explicitly that thinking through the implications of a separate continuation closure type, things seem to get quite messy (e.g. with separate resume variants for each type), which leaves me looking back on our previous "function closure" thoughts with a little discomfort. |
I think these are important considerations, and I'd like to know how much supporting At the same time, I think there's a reasonable justification for considering using a separate class of type for |
The idea was always use use the underlying stack resource to store the extra 'stuff'. |
Ah interesting, I think this answers my question about how the unboxed representation would work (assuming the stack resource is still a separate allocation). I didn't realise EDIT: I think the question about the overhead of the conditional check is still relevant, and naively storing the bound "stuff" in the stack resource might also make the check more expensive. |
cont.bind must invalidate its argument; otherwise you would effectively get multi-shot continuations. |
As for implementation cost of cont.bind; a 'natural' strategy would be to use the underlying stack resource. This is similar to how argument spilling for a normal call would work. |
Just checking in to see if I understand other people's ideas correctly. "Calling convention" for stack switchingI'm assuming that when switching stacks, the ideal "calling convention" for passing payloads to the destination continuation/stack is the same as the actual calling convention used for Wasm function calls on the current platform. The idea is that when we switch to a fresh stack that is about to start execution a Wasm function, the arguments used for switching can be passed on to that function without needing to reshuffle registers (or stack slots). Does that align with what other people had in mind? I believe that @fgmccabe's ideas about Where to collect
|
I havent completely parsed your register assignments; but, yes, that is what I had in mind. Using the normal function call mechanism for stack switching where at all possible. |
Thanks for clarifying!
Yes, I should have made it more clear that I was only focusing on the payload passing aspect here and ignoring everything else. Regarding your idea of letting As an example, let's add even more arguments that will be passed on the stack (again assuming a variant of
If you That means that if you do To me, it looks like I will have to think about whether all of this logic could be encoded statically into the translation of a particular In any case, it seems to me that making this work is quite intricate, but only applies if you use |
AFAICT a continuation that has no bound arguments can be invoked without any register shuffling and the (I assume uncommon case) of argument shuffling can be supported by the stack resource storing an extra code pointer. In addition to the buffer management considerations above, the fastest way to go from the So if the top-level consideration is whether we should remove |
This fixes four things in the JS-API tests: 1. Pass BigInt for i64 WebAssembly.Table and WebAssembly.Memory constructors. 2. Use reference types for tables (would throw a TypeError otherwise). 3. Overwrite 'toString' instead of 'valueOf' for the 'index' property which is a string. 4. 'index' is read after 'element' and before 'initial' in Table construction.
When we previously discussed
func.bind
, my memory is that we ended up with a soft idea that this could be accomplished with a future separate "closure" type that has space in its representation for bound function arguments. Some of the talking points from this previous discussion also seem to also apply tocont.bind
:cont.bind
resume
requires an additional conditional check to work out whether any bound arguments exist, penalisingresume
on "unbound" continuationsHave these points been discussed previously, and has a separate (or subtyped) "continuation closure" type been considered analogous to the "closure" type we considered for
func.bind
?The text was updated successfully, but these errors were encountered: