-
Notifications
You must be signed in to change notification settings - Fork 747
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
Typed continuations: resume instructions #6083
Changes from all commits
f9ab9d4
2a932d3
e96014a
6b8787d
a3cc291
dfbb193
ef0a683
53e40d4
8f85434
b475268
3c1906e
6ab20ad
3556171
bc86090
97d54f7
cf17036
db5b02a
115d0e2
143bb2d
6749e08
17be964
c262d3c
fbcb7fb
06a26c1
d41256d
ab6ff8b
179faa4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -333,6 +333,8 @@ struct SubtypingDiscoverer : public OverriddenVisitor<SubType> { | |
void visitStringIterMove(StringIterMove* curr) {} | ||
void visitStringSliceWTF(StringSliceWTF* curr) {} | ||
void visitStringSliceIter(StringSliceIter* curr) {} | ||
|
||
void visitResume(Resume* curr) { WASM_UNREACHABLE("not implemented"); } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should just note that the body is a subtype of the resume's type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think It's slightly more complicated than that: We may also need to report subtyping relations induced by values being sent to handler blocks: If a |
||
}; | ||
|
||
} // namespace wasm | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -945,6 +945,18 @@ switch (DELEGATE_ID) { | |
DELEGATE_END(StringSliceIter); | ||
break; | ||
} | ||
|
||
case Expression::Id::ResumeId: { | ||
DELEGATE_START(Resume); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems we need to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
DELEGATE_FIELD_TYPE_VECTOR(Resume, sentTypes); | ||
DELEGATE_FIELD_CHILD(Resume, cont); | ||
DELEGATE_FIELD_CHILD_VECTOR(Resume, operands); | ||
DELEGATE_FIELD_SCOPE_NAME_USE_VECTOR(Resume, handlerBlocks); | ||
DELEGATE_FIELD_NAME_KIND_VECTOR(Resume, handlerTags, ModuleItemKind::Tag); | ||
DELEGATE_FIELD_HEAPTYPE(Resume, contType); | ||
DELEGATE_END(Resume); | ||
break; | ||
} | ||
} | ||
|
||
#undef DELEGATE_ID | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2349,6 +2349,7 @@ class ConstantExpressionRunner : public ExpressionRunner<SubType> { | |
} | ||
return ExpressionRunner<SubType>::visitRefAs(curr); | ||
} | ||
Flow visitResume(Resume* curr) { WASM_UNREACHABLE("unimplemented"); } | ||
|
||
void trap(const char* why) override { throw NonconstantException(); } | ||
|
||
|
@@ -3915,6 +3916,7 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> { | |
multiValues.pop_back(); | ||
return ret; | ||
} | ||
Flow visitResume(Resume* curr) { return Flow(NONCONSTANT_FLOW); } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
void trap(const char* why) override { externalInterface->trap(why); } | ||
|
||
|
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.
Is this because we're modeling suspending as throwing? Probably worth a comment if so.
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 was just inspired by the following happening at the end of
visitCall
here :I'm not sure if it's really necessary for
Resume
. @aheejin would you mind having a look?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.
Can a resume instruction throw an exception? If not, we can remove this. (Calls can, which is why they have it.)
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.
Yes, if the resumed continuation throws, it will bubble out from the
resume
instruction, just like an exception from a called function would.