-
Notifications
You must be signed in to change notification settings - Fork 793
[threads] Update the fuzzer for shared types #6771
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
scripts/fuzz_opt.py
Outdated
|
||
# The shared-everything feature is new and we want to fuzz it, but it | ||
# also currently disables fuzzing V8, so disable it half the time. | ||
if random.random() < 0.5: |
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.
Skipping V8 is pretty significant, how about 0.9 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.
Sure, I guess in my local fuzzing I can always comment this out.
static HeapType sharedTrivialStruct = []() { | ||
TypeBuilder builder(1); | ||
builder[0] = Struct{}; | ||
builder[0].setShared(); | ||
return (*builder.build())[0]; | ||
}(); | ||
auto ht = share == Shared ? sharedTrivialStruct : trivialStruct; |
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.
static HeapType sharedTrivialStruct = []() { | |
TypeBuilder builder(1); | |
builder[0] = Struct{}; | |
builder[0].setShared(); | |
return (*builder.build())[0]; | |
}(); | |
auto ht = share == Shared ? sharedTrivialStruct : trivialStruct; | |
static HeapType makeSharedTrivialStruct = []() { | |
TypeBuilder builder(1); | |
builder[0] = Struct{}; | |
builder[0].setShared(); | |
return (*builder.build())[0]; | |
}(); | |
auto ht = share == Shared ? makeSharedTrivialStruct() : trivialStruct; |
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.
(also below, if this makes sense)
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.
Note the ()
after the lambda expression making this an IIFE meant to be executed once when the static local is initialized.
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, I missed the static
.
@@ -759,7 +759,8 @@ void Inhabitator::markExternRefsNullable() { | |||
auto children = type.getTypeChildren(); | |||
for (size_t i = 0; i < children.size(); ++i) { | |||
auto child = children[i]; | |||
if (child.isRef() && child.getHeapType() == HeapType::ext && | |||
if (child.isRef() && child.getHeapType().isBasic() && | |||
child.getHeapType().getBasic(Unshared) == HeapType::ext && |
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.
Perhaps we should have a helper for this common pattern of x.isBasic() && x.getHeapType.getBasic(Unshared) == Y
, something like x.isEqualToUnsharedBasic(Y)
?
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.
How about doing this as a follow-up? It could apply more broadly than just in these files.
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.
sgtm
@@ -759,7 +759,8 @@ void Inhabitator::markExternRefsNullable() { | |||
auto children = type.getTypeChildren(); | |||
for (size_t i = 0; i < children.size(); ++i) { | |||
auto child = children[i]; | |||
if (child.isRef() && child.getHeapType() == HeapType::ext && | |||
if (child.isRef() && child.getHeapType().isBasic() && | |||
child.getHeapType().getBasic(Unshared) == HeapType::ext && |
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.
sgtm
36a96ef
to
79dfd9d
Compare
0774d77
to
2d87cd1
Compare
79dfd9d
to
0065859
Compare
2d87cd1
to
35c227f
Compare
This abbreviates a common pattern where we first had to check whether a heap type was basic, then if it was, get its unshared version and compare it to some expected BasicHeapType. Suggested in #6771 (comment).
0065859
to
0b0ce0d
Compare
35c227f
to
a6c1419
Compare
This abbreviates a common pattern where we first had to check whether a heap type was basic, then if it was, get its unshared version and compare it to some expected BasicHeapType. Suggested in #6771 (comment).
Update the fuzzer to both handle shared types in initial contents and create and use new shared types without crashing or producing invalid modules. Since V8 does not have a complete implementation of shared-everything-threads yet, disable fuzzing V8 when shared-everything is enabled. To avoid losing too much coverage of V8, disable shared-everything in the fuzzer more frequently than other features.
a6c1419
to
ec3bc3e
Compare
This abbreviates a common pattern where we first had to check whether a heap type was basic, then if it was, get its unshared version and compare it to some expected BasicHeapType. Suggested in #6771 (comment).
This abbreviates a common pattern where we first had to check whether a heap type was basic, then if it was, get its unshared version and compare it to some expected BasicHeapType. Suggested in #6771 (comment).
This abbreviates a common pattern where we first had to check whether a heap type was basic, then if it was, get its unshared version and compare it to some expected BasicHeapType. Suggested in #6771 (comment).
Update the fuzzer to both handle shared types in initial contents and
create and use new shared types without crashing or producing invalid
modules. Since V8 does not have a complete implementation of
shared-everything-threads yet, disable fuzzing V8 when shared-everything
is enabled. To avoid losing too much coverage of V8, disable
shared-everything in the fuzzer more frequently than other features.