diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/fuzzing/fuzzing.cpp | 14 | ||||
-rw-r--r-- | src/tools/fuzzing/heap-types.cpp | 9 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp index d9e0f6baf..07464af9d 100644 --- a/src/tools/fuzzing/fuzzing.cpp +++ b/src/tools/fuzzing/fuzzing.cpp @@ -2429,6 +2429,14 @@ Expression* TranslateToFuzzReader::makeBasicRef(Type type) { HeapType(Array(Field(Field::PackedType::i8, Immutable))); return builder.makeArrayNewFixed(trivialArray, {}); } + case HeapType::exn: { + auto null = builder.makeRefNull(HeapType::ext); + if (!type.isNullable()) { + assert(funcContext); + return builder.makeRefAs(RefAsNonNull, null); + } + return null; + } case HeapType::string: return builder.makeStringConst(std::to_string(upTo(1024))); case HeapType::stringview_wtf8: @@ -2437,7 +2445,8 @@ Expression* TranslateToFuzzReader::makeBasicRef(Type type) { WASM_UNREACHABLE("TODO: strings"); case HeapType::none: case HeapType::noext: - case HeapType::nofunc: { + case HeapType::nofunc: + case HeapType::noexn: { auto null = builder.makeRefNull(heapType); if (!type.isNullable()) { assert(funcContext); @@ -3888,6 +3897,8 @@ HeapType TranslateToFuzzReader::getSubType(HeapType type) { return pick(HeapType::struct_, HeapType::none); case HeapType::array: return pick(HeapType::array, HeapType::none); + case HeapType::exn: + return HeapType::exn; case HeapType::string: return HeapType::string; case HeapType::stringview_wtf8: @@ -3897,6 +3908,7 @@ HeapType TranslateToFuzzReader::getSubType(HeapType type) { case HeapType::none: case HeapType::noext: case HeapType::nofunc: + case HeapType::noexn: break; } } diff --git a/src/tools/fuzzing/heap-types.cpp b/src/tools/fuzzing/heap-types.cpp index 32a3fd960..13ad01474 100644 --- a/src/tools/fuzzing/heap-types.cpp +++ b/src/tools/fuzzing/heap-types.cpp @@ -378,8 +378,6 @@ struct HeapTypeGeneratorImpl { return type.getBottom(); } switch (type.getBasic()) { - case HeapType::ext: - return HeapType::ext; case HeapType::func: return pickSubFunc(); case HeapType::any: @@ -392,6 +390,8 @@ struct HeapTypeGeneratorImpl { return pickSubStruct(); case HeapType::array: return pickSubArray(); + case HeapType::ext: + case HeapType::exn: case HeapType::string: case HeapType::stringview_wtf8: case HeapType::stringview_wtf16: @@ -399,6 +399,7 @@ struct HeapTypeGeneratorImpl { case HeapType::none: case HeapType::noext: case HeapType::nofunc: + case HeapType::noexn: return type; } WASM_UNREACHABLE("unexpected type"); @@ -440,6 +441,7 @@ struct HeapTypeGeneratorImpl { switch (type.getBasic()) { case HeapType::ext: case HeapType::func: + case HeapType::exn: case HeapType::any: break; case HeapType::eq: @@ -464,6 +466,9 @@ struct HeapTypeGeneratorImpl { case HeapType::noext: candidates.push_back(HeapType::ext); break; + case HeapType::noexn: + candidates.push_back(HeapType::exn); + break; } assert(!candidates.empty()); return rand.pick(candidates); |