-
Notifications
You must be signed in to change notification settings - Fork 786
[Shared-Everything] ArrayRMW and ArrayCmpxchg #7632
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
Conversation
src/ir/subtype-exprs.h
Outdated
return; | ||
} | ||
auto array = curr->ref->type.getHeapType().getArray(); | ||
self()->noteSubtype(curr->expected, array.element.type); |
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 doesn't seem right. The expected value should be allowed to be a supertype of the element type, so it should only be required to be a subtype of eq
. I see this is wrong for StructCmpxchg
as well.
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.
Fixed both. Though it seems the spec could be more strict here..?
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 way is actually better for us. See the discussion at WebAssembly/shared-everything-threads#92.
src/wasm/wasm.cpp
Outdated
// Like ArrayRMW, but the most precise possible field type is the LUB of | ||
// the expected and replacement values. | ||
type = Type::getLeastUpperBound(expected->type, replacement->type); |
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 can be just replacement->type
. I see this is wrong for StructCmpxchg
as well.
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.
Fixed both.
src/ir/child-typer.h
Outdated
auto type = ht->getArray().element.type; | ||
note(&curr->ref, Type(*ht, Nullable)); | ||
note(&curr->index, Type::i32); | ||
note(&curr->expected, type); |
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 should be eqref
if type
is a reference and type
otherwise. I see this is wrong for StructCmpxchg
as well.
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.
Fixed both.
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.
LGTM % last comment
src/ir/subtype-exprs.h
Outdated
@@ -337,7 +337,7 @@ struct SubtypingDiscoverer : public OverriddenVisitor<SubType> { | |||
return; | |||
} | |||
const auto& fields = curr->ref->type.getHeapType().getStruct().fields; | |||
self()->noteSubtype(curr->expected, fields[curr->index].type); | |||
self()->noteSubtype(curr->expected, Type(HeapType::eq, Nullable)); |
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.
These should also only be if the field type is a reference.
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.
Done.
No description provided.