summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2020-04-16 19:30:06 -0700
committerGitHub <noreply@github.com>2020-04-16 19:30:06 -0700
commita308fc3239091c7dbfac1530f0c70eada740fe0a (patch)
treeebe4f61400c2bce3e200b98d54f4283036197e72 /src
parente30f52e59d2fdb578030685c19a60df5774e366e (diff)
downloadbinaryen-a308fc3239091c7dbfac1530f0c70eada740fe0a.tar.gz
binaryen-a308fc3239091c7dbfac1530f0c70eada740fe0a.tar.bz2
binaryen-a308fc3239091c7dbfac1530f0c70eada740fe0a.zip
Fix issues with Types and Features (#2773)
1. Only emit exnref as part of a subtype if exception-handling is enabled in the fuzzer. 2. Correctly report that funcref and nullref require reference-types to be enabled. 3. Re-enable multivalue as a normal feature in the fuzzer. Possibly fixes #2770.
Diffstat (limited to 'src')
-rw-r--r--src/tools/fuzzing.h4
-rw-r--r--src/wasm/wasm-type.cpp6
2 files changed, 7 insertions, 3 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h
index 91a808d32..fb83882c2 100644
--- a/src/tools/fuzzing.h
+++ b/src/tools/fuzzing.h
@@ -327,8 +327,10 @@ private:
options.push_back(type); // includes itself
switch (type.getSingle()) {
case Type::anyref:
+ if (wasm.features.hasExceptionHandling()) {
+ options.push_back(Type::exnref);
+ }
options.push_back(Type::funcref);
- options.push_back(Type::exnref);
// falls through
case Type::funcref:
case Type::exnref:
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp
index d1cdf6a81..7d51cc10e 100644
--- a/src/wasm/wasm-type.cpp
+++ b/src/wasm/wasm-type.cpp
@@ -199,14 +199,16 @@ Type Type::reinterpret() const {
}
FeatureSet Type::getFeatures() const {
- auto getSingleFeatures = [](Type t) {
+ auto getSingleFeatures = [](Type t) -> FeatureSet {
switch (t.getSingle()) {
case Type::v128:
return FeatureSet::SIMD;
+ case Type::funcref:
case Type::anyref:
+ case Type::nullref:
return FeatureSet::ReferenceTypes;
case Type::exnref:
- return FeatureSet::ExceptionHandling;
+ return FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling;
default:
return FeatureSet::MVP;
}