summaryrefslogtreecommitdiff
path: root/src/tools/fuzzing.h
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-09-19 08:48:06 +0200
committerGitHub <noreply@github.com>2020-09-19 08:48:06 +0200
commite35cdb97adf6eb2ade2be7734d1c6c397d440dc1 (patch)
tree7a740e6fc54d286a05ca3e746ae1e7f3c4b783a8 /src/tools/fuzzing.h
parente308db569ab2582d3b0ea9accdbaa3b27abdb044 (diff)
downloadbinaryen-e35cdb97adf6eb2ade2be7734d1c6c397d440dc1.tar.gz
binaryen-e35cdb97adf6eb2ade2be7734d1c6c397d440dc1.tar.bz2
binaryen-e35cdb97adf6eb2ade2be7734d1c6c397d440dc1.zip
GC: Integrate eqref and i31ref types (#3141)
Adds the `eqref` and `i31ref` types to their respective code locations. Implements what can be implemented trivially and otherwise traps with a TODO for now. Integration of `eqref` is mostly complete due to it being nullable, just like `anyref`, but `i31ref` needs to remain disabled in the fuzzer because we are lacking the functionality to create trivial `i31ref` values, i.e. `(i31.new (i32.const 0))`, which is left for follow-ups to implement.
Diffstat (limited to 'src/tools/fuzzing.h')
-rw-r--r--src/tools/fuzzing.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h
index e6cc4e444..0783588cd 100644
--- a/src/tools/fuzzing.h
+++ b/src/tools/fuzzing.h
@@ -324,6 +324,15 @@ private:
if (wasm.features.hasExceptionHandling()) {
options.push_back(Type::exnref);
}
+ if (wasm.features.hasGC()) {
+ options.push_back(Type::eqref);
+ // TODO: i31ref
+ }
+ }
+ break;
+ case Type::eqref:
+ if (wasm.features.hasGC()) {
+ // TODO: i31ref
}
break;
default:
@@ -1362,6 +1371,8 @@ private:
case Type::externref:
case Type::exnref:
case Type::anyref:
+ case Type::eqref:
+ case Type::i31ref:
case Type::none:
case Type::unreachable:
WASM_UNREACHABLE("invalid type");
@@ -1466,6 +1477,8 @@ private:
case Type::externref:
case Type::exnref:
case Type::anyref:
+ case Type::eqref:
+ case Type::i31ref:
case Type::none:
case Type::unreachable:
WASM_UNREACHABLE("invalid type");
@@ -1595,6 +1608,8 @@ private:
case Type::externref:
case Type::exnref:
case Type::anyref:
+ case Type::eqref:
+ case Type::i31ref:
case Type::none:
case Type::unreachable:
WASM_UNREACHABLE("invalid type");
@@ -1640,6 +1655,8 @@ private:
case Type::externref:
case Type::exnref:
case Type::anyref:
+ case Type::eqref:
+ case Type::i31ref:
case Type::none:
case Type::unreachable:
WASM_UNREACHABLE("unexpected type");
@@ -1708,6 +1725,8 @@ private:
case Type::externref:
case Type::exnref:
case Type::anyref:
+ case Type::eqref:
+ case Type::i31ref:
case Type::none:
case Type::unreachable:
WASM_UNREACHABLE("unexpected type");
@@ -1735,6 +1754,8 @@ private:
case Type::externref:
case Type::exnref:
case Type::anyref:
+ case Type::eqref:
+ case Type::i31ref:
case Type::none:
case Type::unreachable:
WASM_UNREACHABLE("unexpected type");
@@ -1845,6 +1866,8 @@ private:
case Type::externref:
case Type::exnref:
case Type::anyref:
+ case Type::eqref:
+ case Type::i31ref:
return makeTrivial(type);
case Type::none:
case Type::unreachable:
@@ -1990,6 +2013,8 @@ private:
case Type::externref:
case Type::exnref:
case Type::anyref:
+ case Type::eqref:
+ case Type::i31ref:
case Type::none:
case Type::unreachable:
WASM_UNREACHABLE("unexpected type");
@@ -2227,6 +2252,8 @@ private:
case Type::externref:
case Type::exnref:
case Type::anyref:
+ case Type::eqref:
+ case Type::i31ref:
case Type::none:
case Type::unreachable:
WASM_UNREACHABLE("unexpected type");
@@ -2434,6 +2461,8 @@ private:
case Type::externref:
case Type::exnref:
case Type::anyref:
+ case Type::eqref:
+ case Type::i31ref:
case Type::none:
case Type::unreachable:
WASM_UNREACHABLE("unexpected type");
@@ -2674,7 +2703,9 @@ private:
.add(FeatureSet::ReferenceTypes, Type::funcref, Type::externref)
.add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling,
Type::exnref)
- .add(FeatureSet::ReferenceTypes | FeatureSet::GC, Type::anyref));
+ .add(FeatureSet::ReferenceTypes | FeatureSet::GC,
+ Type::anyref,
+ Type::eqref)); // TODO: i31ref
}
Type getSingleConcreteType() { return pick(getSingleConcreteTypes()); }
@@ -2685,7 +2716,9 @@ private:
.add(FeatureSet::ReferenceTypes, Type::funcref, Type::externref)
.add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling,
Type::exnref)
- .add(FeatureSet::ReferenceTypes | FeatureSet::GC, Type::anyref));
+ .add(FeatureSet::ReferenceTypes | FeatureSet::GC,
+ Type::anyref,
+ Type::eqref)); // TODO: i31ref
}
Type getReferenceType() { return pick(getReferenceTypes()); }