Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/tools/fuzzing.h
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ class TranslateToFuzzReader {
Expression* makeDataDrop();
Expression* makeMemoryCopy();
Expression* makeMemoryFill();
Expression* makeMemorySize(Type type);
Expression* makeMemoryGrow(Type type);
Expression* makeElemDrop();

// Getters for Types
Expand Down
21 changes: 21 additions & 0 deletions src/tools/fuzzing/fuzzing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2880,6 +2880,11 @@ Expression* TranslateToFuzzReader::_makeConcrete(Type type) {
}
if (type.isInteger()) {
options.add(FeatureSet::Atomics, &Self::makeAtomic);
// TODO: Support multiple memories.
if (allowMemory && type == wasm.memories[0]->addressType) {
options.add(
FeatureSet::MVP, &Self::makeMemorySize, &Self::makeMemoryGrow);
}
}
if (type == Type::i32) {
if (callExportCatchImportName || callRefCatchImportName) {
Expand Down Expand Up @@ -6584,6 +6589,22 @@ Expression* TranslateToFuzzReader::makeMemoryFill() {
return builder.makeMemoryFill(dest, value, size, wasm.memories[0]->name);
}

Expression* TranslateToFuzzReader::makeMemorySize(Type type) {
if (!allowMemory) {
return makeTrivial(type);
}
assert(type == wasm.memories[0]->addressType);
return builder.makeMemorySize(wasm.memories[0]->name);
}

Expression* TranslateToFuzzReader::makeMemoryGrow(Type type) {
if (!allowMemory) {
return makeTrivial(type);
}
assert(type == wasm.memories[0]->addressType);
return builder.makeMemoryGrow(make(type), wasm.memories[0]->name);
}

Expression* TranslateToFuzzReader::makeElemDrop() {
if (wasm.elementSegments.empty()) {
return makeTrivial(Type::none);
Expand Down
174 changes: 88 additions & 86 deletions test/passes/translate-to-fuzz_all-features_metrics_noprint.txt
Original file line number Diff line number Diff line change
@@ -1,99 +1,101 @@
Metrics
total
[exports] : 94
[funcs] : 176
[exports] : 183
[funcs] : 338
[globals] : 22
[imports] : 11
[memories] : 1
[memory-data] : 31
[table-data] : 45
[table-data] : 93
[tables] : 2
[tags] : 2
[total] : 75585
[vars] : 4083
ArrayCmpxchg : 11
ArrayCopy : 30
ArrayFill : 25
ArrayGet : 333
ArrayLen : 422
ArrayNew : 1468
ArrayNewFixed : 466
ArrayRMW : 4
ArraySet : 45
AtomicCmpxchg : 45
AtomicFence : 46
AtomicNotify : 20
AtomicRMW : 28
Binary : 3502
Block : 5492
BrOn : 484
Break : 753
Call : 813
CallIndirect : 100
CallRef : 195
Const : 10553
[total] : 79045
[vars] : 4334
ArrayCmpxchg : 12
ArrayCopy : 34
ArrayFill : 27
ArrayGet : 285
ArrayLen : 411
ArrayNew : 1475
ArrayNewFixed : 435
ArrayRMW : 7
ArraySet : 56
AtomicCmpxchg : 28
AtomicFence : 35
AtomicNotify : 28
AtomicRMW : 39
Binary : 3595
Block : 5719
BrOn : 467
Break : 679
Call : 917
CallIndirect : 104
CallRef : 153
Const : 11918
ContBind : 1
ContNew : 137
DataDrop : 9
Drop : 672
ElemDrop : 11
GlobalGet : 4094
GlobalSet : 1716
I31Get : 43
If : 1916
Load : 268
LocalGet : 6645
LocalSet : 3137
Loop : 675
MemoryCopy : 11
MemoryFill : 11
MemoryInit : 7
Nop : 506
Pop : 153
RefAs : 6630
RefCast : 573
RefEq : 210
RefFunc : 1194
RefGetDesc : 62
RefI31 : 567
RefIsNull : 34
RefNull : 7860
RefTest : 54
Return : 272
SIMDExtract : 132
SIMDLoad : 1
SIMDReplace : 2
SIMDShift : 3
SIMDShuffle : 4
ContNew : 123
DataDrop : 2
Drop : 653
ElemDrop : 9
GlobalGet : 4525
GlobalSet : 1943
I31Get : 42
If : 2022
Load : 264
LocalGet : 5874
LocalSet : 3053
Loop : 631
MemoryCopy : 6
MemoryFill : 8
MemoryGrow : 46
MemoryInit : 12
MemorySize : 35
Nop : 587
Pop : 140
RefAs : 6772
RefCast : 618
RefEq : 191
RefFunc : 1318
RefGetDesc : 81
RefI31 : 641
RefIsNull : 46
RefNull : 8464
RefTest : 44
Return : 371
SIMDExtract : 133
SIMDLoad : 2
SIMDReplace : 3
SIMDShift : 1
SIMDShuffle : 1
SIMDTernary : 2
Select : 270
Store : 91
StringConcat : 1
StringConst : 397
StringEncode : 49
StringEq : 52
StringMeasure : 51
StringNew : 7
Select : 236
Store : 102
StringConcat : 2
StringConst : 438
StringEncode : 36
StringEq : 53
StringMeasure : 39
StringNew : 5
StringSliceWTF : 2
StringWTF16Get : 44
StructCmpxchg : 46
StructGet : 358
StructNew : 7773
StructRMW : 52
StructSet : 40
StructWait : 39
Switch : 3
StructCmpxchg : 42
StructGet : 369
StructNew : 8327
StructRMW : 45
StructSet : 44
StructWait : 46
Switch : 5
TableGet : 1
TableSet : 50
Throw : 56
ThrowRef : 8
Try : 300
TryTable : 347
TupleExtract : 181
TupleMake : 164
Unary : 1590
Unreachable : 877
WaitqueueNew : 218
WaitqueueNotify: 45
WideIntAddSub : 15
WideIntMul : 11
TableSet : 57
Throw : 53
ThrowRef : 5
Try : 309
TryTable : 361
TupleExtract : 169
TupleMake : 158
Unary : 1676
Unreachable : 991
WaitqueueNew : 261
WaitqueueNotify: 49
WideIntAddSub : 16
WideIntMul : 16
Loading