diff options
author | Daniel Wirtz <dcode@dcode.io> | 2020-08-24 20:13:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-24 11:13:02 -0700 |
commit | fa43b5070b9c46c88d725ceb76f61340324d2ea0 (patch) | |
tree | 90852037dd4fc6697b75963eb90a48bfb514d381 /src/tools/fuzzing.h | |
parent | d2e2521e55120465549ddbccc4660ff98e929008 (diff) | |
download | binaryen-fa43b5070b9c46c88d725ceb76f61340324d2ea0.tar.gz binaryen-fa43b5070b9c46c88d725ceb76f61340324d2ea0.tar.bz2 binaryen-fa43b5070b9c46c88d725ceb76f61340324d2ea0.zip |
Add new compound Signature, Struct and Array types (#3012)
Extends the `Type` hash-consing infrastructure to handle type-parameterized and constructed types introduced in the typed function references and GC proposals. This should be a non-functional change since the new types are not used anywhere yet. Recursive type construction and canonicalization is also left as future work.
Co-authored-by: Thomas Lively <tlively@google.com>
Diffstat (limited to 'src/tools/fuzzing.h')
-rw-r--r-- | src/tools/fuzzing.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 23ea6bbec..b3c1212d4 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -306,7 +306,7 @@ private: double getDouble() { return Literal(get64()).reinterpretf64(); } Type getSubType(Type type) { - if (type.isMulti()) { + if (type.isTuple()) { std::vector<Type> types; for (const auto& t : type) { types.push_back(getSubType(t)); @@ -850,7 +850,7 @@ private: Expression* _makeConcrete(Type type) { bool canMakeControlFlow = - !type.isMulti() || wasm.features.has(FeatureSet::Multivalue); + !type.isTuple() || wasm.features.has(FeatureSet::Multivalue); using Self = TranslateToFuzzReader; FeatureOptions<Expression* (Self::*)(Type)> options; using WeightedOption = decltype(options)::WeightedOption; @@ -886,7 +886,7 @@ private: if (type == Type::i32) { options.add(FeatureSet::ReferenceTypes, &Self::makeRefIsNull); } - if (type.isMulti()) { + if (type.isTuple()) { options.add(FeatureSet::Multivalue, &Self::makeTupleMake); } return (this->*pick(options))(type); @@ -1265,7 +1265,7 @@ private: Expression* makeTupleMake(Type type) { assert(wasm.features.hasMultivalue()); - assert(type.isMulti()); + assert(type.isTuple()); std::vector<Expression*> elements; for (const auto& t : type) { elements.push_back(make(t)); @@ -1765,7 +1765,7 @@ private: } return builder.makeRefNull(); } - if (type.isMulti()) { + if (type.isTuple()) { std::vector<Expression*> operands; for (const auto& t : type) { operands.push_back(makeConst(t)); @@ -1783,7 +1783,7 @@ private: } Expression* makeUnary(Type type) { - assert(!type.isMulti()); + assert(!type.isTuple()); if (type == Type::unreachable) { if (auto* unary = makeUnary(getSingleConcreteType())->dynCast<Unary>()) { return builder.makeUnary(unary->op, make(Type::unreachable)); @@ -2004,7 +2004,7 @@ private: } Expression* makeBinary(Type type) { - assert(!type.isMulti()); + assert(!type.isTuple()); if (type == Type::unreachable) { if (auto* binary = makeBinary(getSingleConcreteType())->dynCast<Binary>()) { |