diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2022-08-17 22:51:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-17 22:51:27 -0700 |
commit | 2d86d1f8fb217456d8bcc4b401ce7d143aa36ee9 (patch) | |
tree | ec852da20ed85c7e5f9be7a5e3fb0632d7caf949 /src/tools/fuzzing/fuzzing.cpp | |
parent | 3aff4c6e85623c970280219c6699a66bc9de5f9b (diff) | |
download | binaryen-2d86d1f8fb217456d8bcc4b401ce7d143aa36ee9.tar.gz binaryen-2d86d1f8fb217456d8bcc4b401ce7d143aa36ee9.tar.bz2 binaryen-2d86d1f8fb217456d8bcc4b401ce7d143aa36ee9.zip |
Restore the `extern` heap type (#4898)
The GC proposal has split `any` and `extern` back into two separate types, so
reintroduce `HeapType::ext` to represent `extern`. Before it was originally
removed in #4633, externref was a subtype of anyref, but now it is not. Now that
we have separate heaptype type hierarchies, make `HeapType::getLeastUpperBound`
fallible as well.
Diffstat (limited to 'src/tools/fuzzing/fuzzing.cpp')
-rw-r--r-- | src/tools/fuzzing/fuzzing.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp index cdefe29f1..cc64b3b6a 100644 --- a/src/tools/fuzzing/fuzzing.cpp +++ b/src/tools/fuzzing/fuzzing.cpp @@ -1968,6 +1968,10 @@ Expression* TranslateToFuzzReader::makeConstBasicRef(Type type) { assert(heapType.isBasic()); assert(wasm.features.hasReferenceTypes()); switch (heapType.getBasic()) { + case HeapType::ext: { + assert(type.isNullable() && "Cannot handle non-nullable externref"); + return builder.makeRefNull(type); + } case HeapType::func: { return makeRefFuncConst(type); } @@ -3089,13 +3093,14 @@ HeapType TranslateToFuzzReader::getSubType(HeapType type) { case HeapType::func: // TODO: Typed function references. return HeapType::func; + case HeapType::ext: + return HeapType::ext; case HeapType::any: // TODO: nontrivial types as well. return pick( FeatureOptions<HeapType>() - .add(FeatureSet::ReferenceTypes, HeapType::func, HeapType::any) + .add(FeatureSet::ReferenceTypes, HeapType::func /*, HeapType::ext*/) .add(FeatureSet::ReferenceTypes | FeatureSet::GC, - HeapType::func, HeapType::any, HeapType::eq, HeapType::i31, |