-
Notifications
You must be signed in to change notification settings - Fork 869
Updated waitqueue support #8672
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
Open
stevenfontanella
wants to merge
9
commits into
main
Choose a base branch
from
waitqueue
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ec73bbe
Updated waitqueue support
stevenfontanella 7cacf10
Some updates
stevenfontanella 0d52cee
More updates
stevenfontanella 3d0ee2f
Fix test
stevenfontanella 7a01e72
Some fixes
stevenfontanella 84e0adf
Binary format test
stevenfontanella 6689195
Format
stevenfontanella 38127ac
Update binary test
stevenfontanella 5806dd5
Small update to test
stevenfontanella File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1074,11 +1074,12 @@ class EffectAnalyzer { | |||||
| void visitStructRMW(StructRMW* curr) { visitStructRMWExpr(curr); } | ||||||
| void visitStructCmpxchg(StructCmpxchg* curr) { visitStructRMWExpr(curr); } | ||||||
| void visitStructWait(StructWait* curr) { | ||||||
| if (trapOnNull(curr->ref)) { | ||||||
| if (trapOnNull({curr->ref, curr->waitqueue})) { | ||||||
| return; | ||||||
| } | ||||||
|
|
||||||
| // StructWait doesn't strictly write a struct, but it does modify the | ||||||
| // waiters list associated with the waitqueue field, which we can think | ||||||
| // waiters list associated with the waitqueue, which we can think | ||||||
| // of as a write. | ||||||
| parent.readsSharedMutableStruct = true; | ||||||
| parent.writesSharedStruct = true; | ||||||
|
|
@@ -1087,16 +1088,13 @@ class EffectAnalyzer { | |||||
| // If the timeout is negative and no-one wakes us. | ||||||
| parent.mayNotReturn = true; | ||||||
| } | ||||||
| void visitStructNotify(StructNotify* curr) { | ||||||
| if (trapOnNull(curr->ref)) { | ||||||
| return; | ||||||
| } | ||||||
| // Non-shared notifies just return 0. | ||||||
| if (curr->ref->type.getHeapType().isShared()) { | ||||||
| void visitWaitqueueNew(WaitqueueNew* curr) {} | ||||||
| void visitWaitqueueNotify(WaitqueueNotify* curr) { | ||||||
| if (trapOnNull(curr->waitqueue)) { | ||||||
| return; | ||||||
| } | ||||||
| // AtomicNotify doesn't strictly write the struct, but it does | ||||||
| // modify the waiters list associated with the waitqueue field, which we | ||||||
| // AtomicNotify doesn't strictly write anything, but it does | ||||||
|
Member
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.
Suggested change
|
||||||
| // modify the waiters list associated with the waitqueue, which we | ||||||
| // can think of as a write. | ||||||
| parent.readsSharedMutableStruct = true; | ||||||
| parent.writesSharedStruct = true; | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -122,6 +122,8 @@ struct NullTypeParserCtx { | |||||||||||||||||||||||||
| HeapTypeT makeNofuncType(Shareability) { return Ok{}; } | ||||||||||||||||||||||||||
| HeapTypeT makeNoexnType(Shareability) { return Ok{}; } | ||||||||||||||||||||||||||
| HeapTypeT makeNocontType(Shareability) { return Ok{}; } | ||||||||||||||||||||||||||
| HeapTypeT makeWaitqueueType(Shareability) { return Ok{}; } | ||||||||||||||||||||||||||
| HeapTypeT makeNowaitqueueType(Shareability) { return Ok{}; } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| TypeT makeI32() { return Ok{}; } | ||||||||||||||||||||||||||
| TypeT makeI64() { return Ok{}; } | ||||||||||||||||||||||||||
|
|
@@ -150,7 +152,6 @@ struct NullTypeParserCtx { | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| StorageT makeI8() { return Ok{}; } | ||||||||||||||||||||||||||
| StorageT makeI16() { return Ok{}; } | ||||||||||||||||||||||||||
| StorageT makeWaitQueue() { return Ok{}; } | ||||||||||||||||||||||||||
| StorageT makeStorageType(TypeT) { return Ok{}; } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| FieldT makeFieldType(StorageT, Mutability) { return Ok{}; } | ||||||||||||||||||||||||||
|
|
@@ -263,6 +264,12 @@ template<typename Ctx> struct TypeParserCtx { | |||||||||||||||||||||||||
| HeapTypeT makeNocontType(Shareability share) { | ||||||||||||||||||||||||||
| return HeapTypes::nocont.getBasic(share); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| HeapTypeT makeWaitqueueType(Shareability share) { | ||||||||||||||||||||||||||
| return HeapType(HeapType::waitqueue).getBasic(share); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| HeapTypeT makeNowaitqueueType(Shareability share) { | ||||||||||||||||||||||||||
| return HeapType(HeapType::nowaitqueue).getBasic(share); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+267
to
+272
Member
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.
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| HeapTypeT makeExact(HeapTypeT type) { | ||||||||||||||||||||||||||
| type.exactness = Exact; | ||||||||||||||||||||||||||
|
|
@@ -308,7 +315,6 @@ template<typename Ctx> struct TypeParserCtx { | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| StorageT makeI8() { return Field(Field::i8, Immutable); } | ||||||||||||||||||||||||||
| StorageT makeI16() { return Field(Field::i16, Immutable); } | ||||||||||||||||||||||||||
| StorageT makeWaitQueue() { return Field(Field::WaitQueue, Immutable); } | ||||||||||||||||||||||||||
| StorageT makeStorageType(TypeT type) { return Field(type, Immutable); } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| FieldT makeFieldType(FieldT field, Mutability mutability) { | ||||||||||||||||||||||||||
|
|
@@ -825,11 +831,10 @@ struct NullInstrParserCtx { | |||||||||||||||||||||||||
| makeStructWait(Index, const std::vector<Annotation>&, HeapTypeT, FieldIdxT) { | ||||||||||||||||||||||||||
| return Ok{}; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| template<typename HeapTypeT> | ||||||||||||||||||||||||||
| Result<> makeStructNotify(Index, | ||||||||||||||||||||||||||
| const std::vector<Annotation>&, | ||||||||||||||||||||||||||
| HeapTypeT, | ||||||||||||||||||||||||||
| FieldIdxT) { | ||||||||||||||||||||||||||
| Result<> makeWaitqueueNew(Index, const std::vector<Annotation>&) { | ||||||||||||||||||||||||||
| return Ok{}; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| Result<> makeWaitqueueNotify(Index, const std::vector<Annotation>&) { | ||||||||||||||||||||||||||
| return Ok{}; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| template<typename HeapTypeT> | ||||||||||||||||||||||||||
|
|
@@ -2819,11 +2824,14 @@ struct ParseDefsCtx : TypeParserCtx<ParseDefsCtx>, AnnotationParserCtx { | |||||||||||||||||||||||||
| return withLoc(pos, irBuilder.makeStructWait(type, field)); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Result<> makeStructNotify(Index pos, | ||||||||||||||||||||||||||
| const std::vector<Annotation>& annotations, | ||||||||||||||||||||||||||
| HeapType type, | ||||||||||||||||||||||||||
| Index field) { | ||||||||||||||||||||||||||
| return withLoc(pos, irBuilder.makeStructNotify(type, field)); | ||||||||||||||||||||||||||
| Result<> makeWaitqueueNew(Index pos, | ||||||||||||||||||||||||||
| const std::vector<Annotation>& annotations) { | ||||||||||||||||||||||||||
| return withLoc(pos, irBuilder.makeWaitqueueNew()); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Result<> makeWaitqueueNotify(Index pos, | ||||||||||||||||||||||||||
| const std::vector<Annotation>& annotations) { | ||||||||||||||||||||||||||
| return withLoc(pos, irBuilder.makeWaitqueueNotify()); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Result<> makeArrayNew(Index pos, | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Other allocation instructions like
visitStructNeworvisitArrayNewhasAllocationCostin them. Does this not need it?