[threads] Update the fuzzer for shared types#6771
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.
Skipping V8 is pretty significant, how about 0.9 here?
There was a problem hiding this comment.
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.
| 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.
(also below, if this makes sense)
There was a problem hiding this comment.
Note the () after the lambda expression making this an IIFE meant to be executed once when the static local is initialized.
| 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.
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.
How about doing this as a follow-up? It could apply more broadly than just in these files.
| auto child = children[i]; | ||
| if (child.isRef() && child.getHeapType() == HeapType::ext && | ||
| if (child.isRef() && child.getHeapType().isBasic() && | ||
| child.getHeapType().getBasic(Unshared) == HeapType::ext && |
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.