-
Notifications
You must be signed in to change notification settings - Fork 745
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
Stack switching proposal support #7041
base: main
Are you sure you want to change the base?
Conversation
1be4ea5
to
d531797
Compare
This patch implements text and binary encoding/decoding support for the stack switching proposal. It does so by adapting the previous typed-continunations implementation. Particular changes: * Support for new `resume` encoding. * Added support for `resume_throw` and `switch`. * Feature flag `typed-continuations` has been renamed to `stack-switching`. A small unfortunate implementation detail is that the internal name `Switch` was already taken by the `br_table` instruction, so I opted to give the `switch` instruction the internal name `StackSwitch`. A minor detail is that I have reordered the declarations/definitions of the stack switching instructions such that they appear in ascending order according to their opcode value (this is the same order that the stack-switching explainer document present them in).
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.
Thanks for working on this! Happy to meet and discuss any of these comments in real time if it would be more efficient for you.
Also, if you could avoid force pushes as you update the PR, that will help me see what changes from version to version. |
Yes, I only did that while rebasing and noone were reviewing :-) I will implement your feedback and push it directly on top of here. |
'ContNew' and 'ContBind'
@tlively I think I have addressed all of your feedback now. Please take a look when you got time. Thanks in advance! |
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.
Thanks for making the changes! Here are a few more comments, but I think we're getting close.
@@ -301,7 +301,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { | |||
void visitLoop(Loop* curr); | |||
void visitTry(Try* curr); | |||
void visitTryTable(TryTable* curr); | |||
void visitResume(Resume* curr); |
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.
For the expressions that now depend on the types of their children to recover the printed type annotations, we now need to handle the case where the children are unreachable or have bottom heap types. See what we do for StructNew
and friends just below this. It would also be good to add tests that exercise these cases.
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.
This reverts commit d1866bc.
Do you prefer I resolve the merge conflict via rebase+force-push or just as a merge commit? |
A merge would be good, thanks! |
This commit is a partial solution to removing the type immediate members from `cont.new,cont.bind,resume,resume_throw,switch`. However, when I fully remove the type immediates then I observe a crash in `child-ir.h` on `visitContBind,visitResume,visitResumeThrow,visitStackSwitch`. It seems that `curr->cont->type` is sometimes not a continuation type...
82d683a
to
c549cd7
Compare
@tlively I am experiencing some difficulties with getting rid of the type immediate members ( |
Check out the pattern used by other instructions that take type immediates in child-typer.h, for example |
This patch implements text and binary encoding/decoding support for the stack switching proposal. It does so by adapting the previous typed-continunations implementation. Particular changes:
resume
encoding.resume_throw
andswitch
.typed-continuations
has been renamed tostack-switching
.A small unfortunate implementation detail is that the internal name
Switch
was already taken by thebr_table
instruction, so I opted to give theswitch
instruction the internal nameStackSwitch
.A minor detail is that I have reordered the declarations/definitions of the stack switching instructions such that they appear in ascending order according to their opcode value (this is the same order that the stack-switching explainer document present them in).
I can look into adding validation support in a subsequent patch.