summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ir/global-utils.h6
-rw-r--r--src/ir/properties.h18
-rw-r--r--src/literal.h2
-rw-r--r--src/tools/fuzzing.h39
-rw-r--r--src/wasm-builder.h4
-rw-r--r--src/wasm/literal.cpp8
-rw-r--r--src/wasm/wasm.cpp15
-rw-r--r--test/gc.wast32
-rw-r--r--test/gc.wast.from-wast46
-rw-r--r--test/gc.wast.fromBinary46
-rw-r--r--test/gc.wast.fromBinary.noDebugInfo46
-rw-r--r--test/passes/translate-to-fuzz_all-features.txt471
12 files changed, 502 insertions, 231 deletions
diff --git a/src/ir/global-utils.h b/src/ir/global-utils.h
index b575d6952..7dc4c6af3 100644
--- a/src/ir/global-utils.h
+++ b/src/ir/global-utils.h
@@ -56,15 +56,13 @@ getGlobalInitializedToImport(Module& wasm, Name module, Name base) {
inline bool canInitializeGlobal(const Expression* curr) {
if (auto* tuple = curr->dynCast<TupleMake>()) {
for (auto* op : tuple->operands) {
- if (!op->is<Const>() && !op->is<RefNull>() &&
- !op->is<RefFunc>() & !op->is<GlobalGet>()) {
+ if (!Properties::isSingleConstantExpression(op) && !op->is<GlobalGet>()) {
return false;
}
}
return true;
}
- return curr->is<Const>() || curr->is<RefNull>() || curr->is<RefFunc>() ||
- curr->is<GlobalGet>();
+ return Properties::isSingleConstantExpression(curr) || curr->is<GlobalGet>();
}
} // namespace GlobalUtils
diff --git a/src/ir/properties.h b/src/ir/properties.h
index 56723631a..d0495f4a9 100644
--- a/src/ir/properties.h
+++ b/src/ir/properties.h
@@ -79,13 +79,18 @@ inline bool isNamedControlFlow(Expression* curr) {
return false;
}
+inline bool isSingleConstantExpression(const Expression* curr) {
+ return curr->is<Const>() || curr->is<RefNull>() || curr->is<RefFunc>() ||
+ (curr->is<I31New>() && curr->cast<I31New>()->value->is<Const>());
+}
+
inline bool isConstantExpression(const Expression* curr) {
- if (curr->is<Const>() || curr->is<RefNull>() || curr->is<RefFunc>()) {
+ if (isSingleConstantExpression(curr)) {
return true;
}
if (auto* tuple = curr->dynCast<TupleMake>()) {
for (auto* op : tuple->operands) {
- if (!op->is<Const>() && !op->is<RefNull>() && !op->is<RefFunc>()) {
+ if (!isSingleConstantExpression(op)) {
return false;
}
}
@@ -101,13 +106,16 @@ inline Literal getSingleLiteral(const Expression* curr) {
return Literal(n->type);
} else if (auto* r = curr->dynCast<RefFunc>()) {
return Literal(r->func);
- } else {
- WASM_UNREACHABLE("non-constant expression");
+ } else if (auto* i = curr->dynCast<I31New>()) {
+ if (auto* c = i->value->dynCast<Const>()) {
+ return Literal::makeI31(c->value.geti32());
+ }
}
+ WASM_UNREACHABLE("non-constant expression");
}
inline Literals getLiterals(const Expression* curr) {
- if (curr->is<Const>() || curr->is<RefNull>() || curr->is<RefFunc>()) {
+ if (isSingleConstantExpression(curr)) {
return {getSingleLiteral(curr)};
} else if (auto* tuple = curr->dynCast<TupleMake>()) {
Literals literals;
diff --git a/src/literal.h b/src/literal.h
index c0e43eb88..eedccabcc 100644
--- a/src/literal.h
+++ b/src/literal.h
@@ -158,7 +158,7 @@ public:
assert(type == Type::i32);
return i32;
}
- int32_t geti31(bool signed_) const {
+ int32_t geti31(bool signed_ = true) const {
assert(type == Type::i31ref);
return signed_ ? (i32 << 1) >> 1 : i32;
}
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h
index cab33e3b5..ecc548e22 100644
--- a/src/tools/fuzzing.h
+++ b/src/tools/fuzzing.h
@@ -326,13 +326,13 @@ private:
}
if (wasm.features.hasGC()) {
options.push_back(Type::eqref);
- // TODO: i31ref
+ options.push_back(Type::i31ref);
}
}
break;
case Type::eqref:
if (wasm.features.hasGC()) {
- // TODO: i31ref
+ options.push_back(Type::i31ref);
}
break;
default:
@@ -893,11 +893,16 @@ private:
if (type == Type::i32) {
options.add(FeatureSet::ReferenceTypes, &Self::makeRefIsNull);
options.add(FeatureSet::ReferenceTypes | FeatureSet::GC,
- &Self::makeRefEq);
+ &Self::makeRefEq,
+ &Self::makeI31Get);
}
if (type.isTuple()) {
options.add(FeatureSet::Multivalue, &Self::makeTupleMake);
}
+ if (type == Type::i31ref) {
+ options.add(FeatureSet::ReferenceTypes | FeatureSet::GC,
+ &Self::makeI31New);
+ }
return (this->*pick(options))(type);
}
@@ -1786,6 +1791,9 @@ private:
}
return builder.makeRefFunc(target->name);
}
+ if (type == Type::i31ref) {
+ return builder.makeI31New(makeConst(Type::i32));
+ }
return builder.makeRefNull(type);
}
if (type.isTuple()) {
@@ -2652,6 +2660,20 @@ private:
return builder.makeRefEq(left, right);
}
+ Expression* makeI31New(Type type) {
+ assert(type == Type::i31ref);
+ assert(wasm.features.hasReferenceTypes() && wasm.features.hasGC());
+ auto* value = make(Type::i32);
+ return builder.makeI31New(value);
+ }
+
+ Expression* makeI31Get(Type type) {
+ assert(type == Type::i32);
+ assert(wasm.features.hasReferenceTypes() && wasm.features.hasGC());
+ auto* i31 = make(Type::i31ref);
+ return builder.makeI31Get(i31, bool(oneIn(2)));
+ }
+
Expression* makeMemoryInit() {
if (!allowMemory) {
return makeTrivial(Type::none);
@@ -2717,7 +2739,8 @@ private:
Type::exnref)
.add(FeatureSet::ReferenceTypes | FeatureSet::GC,
Type::anyref,
- Type::eqref)); // TODO: i31ref
+ Type::eqref,
+ Type::i31ref));
}
Type getSingleConcreteType() { return pick(getSingleConcreteTypes()); }
@@ -2730,15 +2753,15 @@ private:
Type::exnref)
.add(FeatureSet::ReferenceTypes | FeatureSet::GC,
Type::anyref,
- Type::eqref)); // TODO: i31ref
+ Type::eqref,
+ Type::i31ref));
}
Type getReferenceType() { return pick(getReferenceTypes()); }
std::vector<Type> getEqReferenceTypes() {
- return items(
- FeatureOptions<Type>().add(FeatureSet::ReferenceTypes | FeatureSet::GC,
- Type::eqref)); // TODO: i31ref
+ return items(FeatureOptions<Type>().add(
+ FeatureSet::ReferenceTypes | FeatureSet::GC, Type::eqref, Type::i31ref));
}
Type getEqReferenceType() { return pick(getEqReferenceTypes()); }
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index d78640200..d90ccb9ae 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -666,7 +666,7 @@ public:
assert(value.isNull() && "unexpected non-null reference type literal");
return makeRefNull(value.type);
case Type::i31ref:
- WASM_UNREACHABLE("TODO: i31ref");
+ return makeI31New(makeConst(value.geti31()));
default:
assert(value.type.isNumber());
return makeConst(value);
@@ -863,7 +863,7 @@ public:
case Type::eqref:
return ExpressionManipulator::refNull(curr, curr->type);
case Type::i31ref:
- WASM_UNREACHABLE("TODO: i31ref");
+ return makeI31New(makeConst(0));
case Type::none:
return ExpressionManipulator::nop(curr);
case Type::unreachable:
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp
index a7c14fdb6..d309be308 100644
--- a/src/wasm/literal.cpp
+++ b/src/wasm/literal.cpp
@@ -139,7 +139,11 @@ Literals Literal::makeZero(Type type) {
Literal Literal::makeSingleZero(Type type) {
assert(type.isSingle());
if (type.isRef()) {
- return makeNull(type);
+ if (type == Type::i31ref) {
+ return makeI31(0);
+ } else {
+ return makeNull(type);
+ }
} else {
return makeFromInt32(0, type);
}
@@ -438,7 +442,7 @@ std::ostream& operator<<(std::ostream& o, Literal literal) {
o << "eqref(null)";
break;
case Type::i31ref:
- o << "i31ref(" << literal.geti31(false) << ")";
+ o << "i31ref(" << literal.geti31() << ")";
break;
case Type::unreachable:
WASM_UNREACHABLE("invalid type");
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index c03a9b281..c857b202c 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -217,18 +217,15 @@ const char* getExpressionName(Expression* curr) {
}
Literal getSingleLiteralFromConstExpression(Expression* curr) {
- if (auto* c = curr->dynCast<Const>()) {
- return c->value;
- } else if (auto* n = curr->dynCast<RefNull>()) {
- return Literal::makeNull(n->type);
- } else if (auto* r = curr->dynCast<RefFunc>()) {
- return Literal::makeFunc(r->func);
- } else {
- WASM_UNREACHABLE("Not a constant expression");
- }
+ // TODO: Do we need this function given that Properties::getSingleLiteral
+ // (currently) does the same?
+ assert(Properties::isConstantExpression(curr));
+ return Properties::getSingleLiteral(curr);
}
Literals getLiteralsFromConstExpression(Expression* curr) {
+ // TODO: Do we need this function given that Properties::getLiterals
+ // (currently) does the same?
if (auto* t = curr->dynCast<TupleMake>()) {
Literals values;
for (auto* operand : t->operands) {
diff --git a/test/gc.wast b/test/gc.wast
index c3c561413..7ce6e01a9 100644
--- a/test/gc.wast
+++ b/test/gc.wast
@@ -1,21 +1,18 @@
;; A preliminary test for prototype GC types and instructions.
;; TODO: Move subtype tests from reference-types.wast here?
+;; TODO: The test assumes that `(i31.new (i32.const N))` is a valid constant
+;; initializer for i31ref types globals, which isn't yet specified.
(module
- ;; TODO: There are no trivial global initializers for i31ref globals because
- ;; i31ref is non-nullable, hence `(ref.null i31)` cannot be used. The test
- ;; currently works around this limitation by importing a constant value.
- (import "env" "trivial_i31ref" (global $trivial_i31ref i31ref))
-
;; Test global initializer expressions
(global $global_anyref (mut anyref) (ref.null any))
(global $global_eqref (mut eqref) (ref.null eq))
- (global $global_i31ref (mut i31ref) (global.get $trivial_i31ref)) ;; ^
+ (global $global_i31ref (mut i31ref) (i31.new (i32.const 0)))
;; Test subtype relationship in global initializer expressions
(global $global_anyref2 (mut anyref) (ref.null eq))
- (global $global_anyref3 (mut anyref) (global.get $trivial_i31ref)) ;; ^
- (global $global_eqref2 (mut eqref) (global.get $trivial_i31ref)) ;; ^
+ (global $global_anyref3 (mut anyref) (i31.new (i32.const 0)))
+ (global $global_eqref2 (mut eqref) (i31.new (i32.const 0)))
(func $test
(local $local_i32 i32)
@@ -32,7 +29,7 @@
(local.set $local_eqref (ref.null eq))
(local.set $local_i31ref (local.get $local_i31ref))
(local.set $local_i31ref (global.get $global_i31ref))
- (local.set $local_i31ref (global.get $trivial_i31ref)) ;; ^
+ (local.set $local_i31ref (i31.new (i32.const 0)))
;; Test subtype relationship for local.set
(local.set $local_anyref (local.get $local_eqref))
@@ -40,10 +37,10 @@
(local.set $local_anyref (ref.null eq))
(local.set $local_anyref (local.get $local_i31ref))
(local.set $local_anyref (global.get $global_i31ref))
- (local.set $local_anyref (global.get $trivial_i31ref)) ;; ^
+ (local.set $local_anyref (i31.new (i32.const 0)))
(local.set $local_eqref (local.get $local_i31ref))
(local.set $local_eqref (global.get $global_i31ref))
- (local.set $local_eqref (global.get $trivial_i31ref)) ;; ^
+ (local.set $local_eqref (i31.new (i32.const 0)))
;; Test types for global.get/set
(global.set $global_anyref (local.get $local_anyref))
@@ -54,7 +51,7 @@
(global.set $global_eqref (ref.null eq))
(global.set $global_i31ref (local.get $local_i31ref))
(global.set $global_i31ref (global.get $global_i31ref))
- (global.set $global_i31ref (global.get $trivial_i31ref)) ;; ^
+ (global.set $global_i31ref (i31.new (i32.const 0)))
;; Test subtype relationship for global.set
(global.set $global_anyref (local.get $local_eqref))
@@ -62,17 +59,10 @@
(global.set $global_anyref (ref.null eq))
(global.set $global_anyref (local.get $local_i31ref))
(global.set $global_anyref (global.get $global_i31ref))
- (global.set $global_anyref (global.get $trivial_i31ref)) ;; ^
+ (global.set $global_anyref (i31.new (i32.const 0)))
(global.set $global_eqref (local.get $local_i31ref))
(global.set $global_eqref (global.get $global_i31ref))
- (global.set $global_eqref (global.get $trivial_i31ref)) ;; ^
-
- ;; Test i31.new
- (local.set $local_i31ref (i31.new (i32.const 0)))
-
- ;; Test subtype relationship for i31.new
- (local.set $local_anyref (i31.new (i32.const 0)))
- (local.set $local_eqref (i31.new (i32.const 0)))
+ (global.set $global_eqref (i31.new (i32.const 0)))
;; Test i31.get_s/u
(local.set $local_i32 (i31.get_s (local.get $local_i31ref)))
diff --git a/test/gc.wast.from-wast b/test/gc.wast.from-wast
index 7a80cffe6..aeface521 100644
--- a/test/gc.wast.from-wast
+++ b/test/gc.wast.from-wast
@@ -1,12 +1,17 @@
(module
(type $none_=>_none (func))
- (import "env" "trivial_i31ref" (global $trivial_i31ref i31ref))
(global $global_anyref (mut anyref) (ref.null any))
(global $global_eqref (mut eqref) (ref.null eq))
- (global $global_i31ref (mut i31ref) (global.get $trivial_i31ref))
+ (global $global_i31ref (mut i31ref) (i31.new
+ (i32.const 0)
+ ))
(global $global_anyref2 (mut anyref) (ref.null eq))
- (global $global_anyref3 (mut anyref) (global.get $trivial_i31ref))
- (global $global_eqref2 (mut eqref) (global.get $trivial_i31ref))
+ (global $global_anyref3 (mut anyref) (i31.new
+ (i32.const 0)
+ ))
+ (global $global_eqref2 (mut eqref) (i31.new
+ (i32.const 0)
+ ))
(func $test
(local $local_i32 i32)
(local $local_anyref anyref)
@@ -37,7 +42,9 @@
(global.get $global_i31ref)
)
(local.set $local_i31ref
- (global.get $trivial_i31ref)
+ (i31.new
+ (i32.const 0)
+ )
)
(local.set $local_anyref
(local.get $local_eqref)
@@ -55,7 +62,9 @@
(global.get $global_i31ref)
)
(local.set $local_anyref
- (global.get $trivial_i31ref)
+ (i31.new
+ (i32.const 0)
+ )
)
(local.set $local_eqref
(local.get $local_i31ref)
@@ -64,7 +73,9 @@
(global.get $global_i31ref)
)
(local.set $local_eqref
- (global.get $trivial_i31ref)
+ (i31.new
+ (i32.const 0)
+ )
)
(global.set $global_anyref
(local.get $local_anyref)
@@ -91,7 +102,9 @@
(global.get $global_i31ref)
)
(global.set $global_i31ref
- (global.get $trivial_i31ref)
+ (i31.new
+ (i32.const 0)
+ )
)
(global.set $global_anyref
(local.get $local_eqref)
@@ -109,7 +122,9 @@
(global.get $global_i31ref)
)
(global.set $global_anyref
- (global.get $trivial_i31ref)
+ (i31.new
+ (i32.const 0)
+ )
)
(global.set $global_eqref
(local.get $local_i31ref)
@@ -118,19 +133,6 @@
(global.get $global_i31ref)
)
(global.set $global_eqref
- (global.get $trivial_i31ref)
- )
- (local.set $local_i31ref
- (i31.new
- (i32.const 0)
- )
- )
- (local.set $local_anyref
- (i31.new
- (i32.const 0)
- )
- )
- (local.set $local_eqref
(i31.new
(i32.const 0)
)
diff --git a/test/gc.wast.fromBinary b/test/gc.wast.fromBinary
index d86c08985..4d22c984f 100644
--- a/test/gc.wast.fromBinary
+++ b/test/gc.wast.fromBinary
@@ -1,12 +1,17 @@
(module
(type $none_=>_none (func))
- (import "env" "trivial_i31ref" (global $trivial_i31ref i31ref))
(global $global_anyref (mut anyref) (ref.null any))
(global $global_eqref (mut eqref) (ref.null eq))
- (global $global_i31ref (mut i31ref) (global.get $trivial_i31ref))
+ (global $global_i31ref (mut i31ref) (i31.new
+ (i32.const 0)
+ ))
(global $global_anyref2 (mut anyref) (ref.null eq))
- (global $global_anyref3 (mut anyref) (global.get $trivial_i31ref))
- (global $global_eqref2 (mut eqref) (global.get $trivial_i31ref))
+ (global $global_anyref3 (mut anyref) (i31.new
+ (i32.const 0)
+ ))
+ (global $global_eqref2 (mut eqref) (i31.new
+ (i32.const 0)
+ ))
(func $test
(local $local_i32 i32)
(local $local_anyref anyref)
@@ -37,7 +42,9 @@
(global.get $global_i31ref)
)
(local.set $local_i31ref
- (global.get $trivial_i31ref)
+ (i31.new
+ (i32.const 0)
+ )
)
(local.set $local_anyref
(local.get $local_eqref)
@@ -55,7 +62,9 @@
(global.get $global_i31ref)
)
(local.set $local_anyref
- (global.get $trivial_i31ref)
+ (i31.new
+ (i32.const 0)
+ )
)
(local.set $local_eqref
(local.get $local_i31ref)
@@ -64,7 +73,9 @@
(global.get $global_i31ref)
)
(local.set $local_eqref
- (global.get $trivial_i31ref)
+ (i31.new
+ (i32.const 0)
+ )
)
(global.set $global_anyref
(local.get $local_anyref)
@@ -91,7 +102,9 @@
(global.get $global_i31ref)
)
(global.set $global_i31ref
- (global.get $trivial_i31ref)
+ (i31.new
+ (i32.const 0)
+ )
)
(global.set $global_anyref
(local.get $local_eqref)
@@ -109,7 +122,9 @@
(global.get $global_i31ref)
)
(global.set $global_anyref
- (global.get $trivial_i31ref)
+ (i31.new
+ (i32.const 0)
+ )
)
(global.set $global_eqref
(local.get $local_i31ref)
@@ -118,19 +133,6 @@
(global.get $global_i31ref)
)
(global.set $global_eqref
- (global.get $trivial_i31ref)
- )
- (local.set $local_i31ref
- (i31.new
- (i32.const 0)
- )
- )
- (local.set $local_anyref
- (i31.new
- (i32.const 0)
- )
- )
- (local.set $local_eqref
(i31.new
(i32.const 0)
)
diff --git a/test/gc.wast.fromBinary.noDebugInfo b/test/gc.wast.fromBinary.noDebugInfo
index 9989a5ad8..9fd83ad04 100644
--- a/test/gc.wast.fromBinary.noDebugInfo
+++ b/test/gc.wast.fromBinary.noDebugInfo
@@ -1,12 +1,17 @@
(module
(type $none_=>_none (func))
- (import "env" "trivial_i31ref" (global $gimport$0 i31ref))
(global $global$0 (mut anyref) (ref.null any))
(global $global$1 (mut eqref) (ref.null eq))
- (global $global$2 (mut i31ref) (global.get $gimport$0))
+ (global $global$2 (mut i31ref) (i31.new
+ (i32.const 0)
+ ))
(global $global$3 (mut anyref) (ref.null eq))
- (global $global$4 (mut anyref) (global.get $gimport$0))
- (global $global$5 (mut eqref) (global.get $gimport$0))
+ (global $global$4 (mut anyref) (i31.new
+ (i32.const 0)
+ ))
+ (global $global$5 (mut eqref) (i31.new
+ (i32.const 0)
+ ))
(func $0
(local $0 i32)
(local $1 anyref)
@@ -37,7 +42,9 @@
(global.get $global$2)
)
(local.set $3
- (global.get $gimport$0)
+ (i31.new
+ (i32.const 0)
+ )
)
(local.set $1
(local.get $2)
@@ -55,7 +62,9 @@
(global.get $global$2)
)
(local.set $1
- (global.get $gimport$0)
+ (i31.new
+ (i32.const 0)
+ )
)
(local.set $2
(local.get $3)
@@ -64,7 +73,9 @@
(global.get $global$2)
)
(local.set $2
- (global.get $gimport$0)
+ (i31.new
+ (i32.const 0)
+ )
)
(global.set $global$0
(local.get $1)
@@ -91,7 +102,9 @@
(global.get $global$2)
)
(global.set $global$2
- (global.get $gimport$0)
+ (i31.new
+ (i32.const 0)
+ )
)
(global.set $global$0
(local.get $2)
@@ -109,7 +122,9 @@
(global.get $global$2)
)
(global.set $global$0
- (global.get $gimport$0)
+ (i31.new
+ (i32.const 0)
+ )
)
(global.set $global$1
(local.get $3)
@@ -118,19 +133,6 @@
(global.get $global$2)
)
(global.set $global$1
- (global.get $gimport$0)
- )
- (local.set $3
- (i31.new
- (i32.const 0)
- )
- )
- (local.set $1
- (i31.new
- (i32.const 0)
- )
- )
- (local.set $2
(i31.new
(i32.const 0)
)
diff --git a/test/passes/translate-to-fuzz_all-features.txt b/test/passes/translate-to-fuzz_all-features.txt
index 91c9dffe8..ab8ac7ca2 100644
--- a/test/passes/translate-to-fuzz_all-features.txt
+++ b/test/passes/translate-to-fuzz_all-features.txt
@@ -1,12 +1,21 @@
(module
- (type $f32_=>_none (func (param f32)))
(type $none_=>_none (func))
+ (type $none_=>_i32 (func (result i32)))
(type $i32_=>_none (func (param i32)))
(type $i64_=>_none (func (param i64)))
+ (type $f32_=>_none (func (param f32)))
(type $f64_=>_none (func (param f64)))
(type $v128_=>_none (func (param v128)))
(type $exnref_=>_none (func (param exnref)))
- (type $none_=>_i32 (func (result i32)))
+ (type $none_=>_i64 (func (result i64)))
+ (type $externref_eqref_funcref_=>_i64 (func (param externref eqref funcref) (result i64)))
+ (type $none_=>_f32 (func (result f32)))
+ (type $i32_i32_f32_exnref_=>_externref (func (param i32 i32 f32 exnref) (result externref)))
+ (type $externref_f64_f32_eqref_i31ref_anyref_=>_externref (func (param externref f64 f32 eqref i31ref anyref) (result externref)))
+ (type $exnref_f32_i31ref_externref_funcref_i31ref_i64_=>_exnref (func (param exnref f32 i31ref externref funcref i31ref i64) (result exnref)))
+ (type $none_=>_exnref_anyref_v128 (func (result exnref anyref v128)))
+ (type $externref_i32_eqref_v128_=>_exnref_anyref_v128 (func (param externref i32 eqref v128) (result exnref anyref v128)))
+ (type $none_=>_i31ref (func (result i31ref)))
(import "fuzzing-support" "log-i32" (func $log-i32 (param i32)))
(import "fuzzing-support" "log-i64" (func $log-i64 (param i64)))
(import "fuzzing-support" "log-f32" (func $log-f32 (param f32)))
@@ -15,22 +24,28 @@
(import "fuzzing-support" "log-exnref" (func $log-exnref (param exnref)))
(memory $0 (shared 1 1))
(data (i32.const 0) "N\0fN\f5\f9\b1\ff\fa\eb\e5\fe\a7\ec\fb\fc\f4\a6\e4\ea\f0\ae\e3")
- (table $0 0 0 funcref)
+ (table $0 5 5 funcref)
+ (elem (i32.const 0) $func_9 $func_9 $func_9 $func_10 $func_16)
(global $global$5 (mut eqref) (ref.null eq))
- (global $global$4 (mut externref) (ref.null extern))
- (global $global$3 (mut exnref) (ref.null exn))
- (global $global$2 (mut funcref) (ref.null func))
- (global $global$1 (mut (v128 funcref i64 anyref eqref exnref)) (tuple.make
- (v128.const i32x4 0x0c0d0c62 0x48060d0d 0x000000ff 0x00000000)
- (ref.null func)
- (i64.const -2199023255552)
- (ref.null any)
+ (global $global$4 (mut i32) (i32.const 470177031))
+ (global $global$3 (mut f64) (f64.const 2147483647))
+ (global $global$2 (mut (eqref f32 eqref funcref funcref i64)) (tuple.make
(ref.null eq)
- (ref.null exn)
+ (f32.const -2147483648)
+ (ref.null eq)
+ (ref.null func)
+ (ref.null func)
+ (i64.const -32)
))
+ (global $global$1 (mut f32) (f32.const -32769))
(global $hangLimit (mut i32) (i32.const 10))
(export "hashMemory" (func $hashMemory))
(export "memory" (memory $0))
+ (export "func_7_invoker" (func $func_7_invoker))
+ (export "func_9" (func $func_9))
+ (export "func_11_invoker" (func $func_11_invoker))
+ (export "func_14_invoker" (func $func_14_invoker))
+ (export "func_17" (func $func_17))
(export "hangLimitInitializer" (func $hangLimitInitializer))
(func $hashMemory (result i32)
(local $0 i32)
@@ -263,20 +278,53 @@
)
(local.get $0)
)
- (func $func_7 (param $0 f32)
- (local $1 (anyref externref))
- (local $2 i32)
- (local $3 i64)
- (local $4 funcref)
- (local $5 v128)
- (local $6 (funcref anyref f32 i32 exnref))
- (local $7 i32)
+ (func $func_7 (param $0 i32) (param $1 i32) (param $2 f32) (param $3 exnref) (result externref)
+ (local $4 i32)
(block
(if
(i32.eqz
(global.get $hangLimit)
)
- (return)
+ (return
+ (ref.null extern)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (ref.null extern)
+ )
+ (func $func_7_invoker
+ (drop
+ (call $func_7
+ (i32.const -127)
+ (i32.const -268435456)
+ (f32.const 1179405440)
+ (ref.null exn)
+ )
+ )
+ (call $log-i32
+ (call $hashMemory)
+ )
+ )
+ (func $func_9 (result f32)
+ (local $0 anyref)
+ (local $1 f64)
+ (local $2 (anyref anyref))
+ (local $3 eqref)
+ (local $4 externref)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (f32.const 1.4949444621624858e-31)
+ )
)
(global.set $hangLimit
(i32.sub
@@ -286,110 +334,307 @@
)
)
(block $label$0
- (call $log-f64
- (if (result f64)
- (i32.eqz
- (i32.const 32768)
- )
- (block $label$1
- (br_if $label$0
- (i32.eqz
- (ref.eq
- (ref.null eq)
- (loop $label$21
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
- )
- (return)
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block $label$22
- (nop)
- (br $label$21)
- )
- )
- )
- )
- )
- (if
- (i32.eqz
- (i32.const -33554432)
- )
- (block $label$2
- (br_if $label$2
- (i32.eqz
- (local.get $2)
- )
- )
- (call $log-i32
- (call $hashMemory)
- )
- )
- (drop
- (ref.null extern)
- )
- )
- (br $label$0)
+ (nop)
+ (block $label$1
+ (nop)
+ (return
+ (f32.const 7.396028525772014e-24)
+ )
+ )
+ )
+ )
+ (func $func_10 (param $0 externref) (param $1 f64) (param $2 f32) (param $3 eqref) (param $4 i31ref) (param $5 anyref) (result externref)
+ (local $6 i64)
+ (local $7 (anyref exnref f32 f64 f64))
+ (local $8 eqref)
+ (local $9 exnref)
+ (local $10 i64)
+ (local $11 f64)
+ (local $12 f32)
+ (local $13 v128)
+ (local $14 exnref)
+ (local $15 (funcref funcref v128 i31ref v128))
+ (local $16 anyref)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (ref.null extern)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (ref.null extern)
+ )
+ (func $func_11 (param $0 exnref) (param $1 f32) (param $2 i31ref) (param $3 externref) (param $4 funcref) (param $5 i31ref) (param $6 i64) (result exnref)
+ (local $7 (i32 i64 anyref externref externref eqref))
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (ref.null exn)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (ref.null exn)
+ )
+ (func $func_11_invoker
+ (drop
+ (call $func_11
+ (ref.null exn)
+ (f32.const -1022.1400146484375)
+ (i31.new
+ (i32.const -32766)
+ )
+ (ref.null extern)
+ (ref.null func)
+ (i31.new
+ (i32.const -65535)
+ )
+ (i64.const 3)
+ )
+ )
+ (call $log-i32
+ (call $hashMemory)
+ )
+ )
+ (func $func_13 (result i31ref)
+ (local $0 i31ref)
+ (local $1 (funcref f32 anyref f32 externref))
+ (local $2 f64)
+ (local $3 f64)
+ (local $4 (i32 v128))
+ (local $5 (anyref i64 v128 eqref funcref exnref))
+ (local $6 i32)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i31.new
+ (i32.const -28)
)
- (loop $label$4 (result f64)
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
- )
- (return)
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
- )
- )
- )
- (f64.const 82)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (i31.new
+ (i32.const 64)
+ )
+ )
+ (func $func_14 (result i32)
+ (local $0 i32)
+ (local $1 funcref)
+ (local $2 (anyref externref))
+ (local $3 funcref)
+ (local $4 i64)
+ (local $5 externref)
+ (local $6 (exnref f64))
+ (local $7 (anyref f64 f64))
+ (local $8 (i64 i32 eqref exnref))
+ (local $9 (v128 i64 funcref i32 anyref anyref))
+ (local $10 (i32 eqref f64 funcref))
+ (local $11 eqref)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const 471818526)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block $label$0 (result i32)
+ (nop)
+ (local.get $0)
+ )
+ )
+ (func $func_14_invoker
+ (drop
+ (call $func_14)
+ )
+ (call $log-i32
+ (call $hashMemory)
+ )
+ (drop
+ (call $func_14)
+ )
+ (drop
+ (call $func_14)
+ )
+ (drop
+ (call $func_14)
+ )
+ (drop
+ (call $func_14)
+ )
+ (drop
+ (call $func_14)
+ )
+ (call $log-i32
+ (call $hashMemory)
+ )
+ (drop
+ (call $func_14)
+ )
+ (call $log-i32
+ (call $hashMemory)
+ )
+ )
+ (func $func_16 (param $0 externref) (param $1 i32) (param $2 eqref) (param $3 v128) (result exnref anyref v128)
+ (local $4 exnref)
+ (local $5 i31ref)
+ (local $6 eqref)
+ (local $7 funcref)
+ (local $8 (i31ref eqref f64))
+ (local $9 v128)
+ (local $10 eqref)
+ (local $11 exnref)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (tuple.make
+ (ref.null exn)
+ (ref.null any)
+ (v128.const i32x4 0x0c1f021d 0x00020814 0x4742fffc 0x007f252c)
)
)
)
- (call $log-v128
- (if (result v128)
- (local.tee $7
- (block $label$23
- (nop)
- (return)
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block $label$0
+ (call $log-i32
+ (local.get $1)
+ )
+ (return
+ (tuple.make
+ (ref.null exn)
+ (ref.null any)
+ (v128.const i32x4 0x00010001 0xfff00000 0xffff8001 0x00000202)
+ )
+ )
+ )
+ )
+ (func $func_17 (result i64)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i64.const 590056222575119631)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (i64.const 650238098827575305)
+ )
+ (func $func_18 (param $0 externref) (param $1 eqref) (param $2 funcref) (result i64)
+ (local $3 f32)
+ (local $4 eqref)
+ (local $5 exnref)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i64.const -1)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block $label$0 (result i64)
+ (nop)
+ (local.set $5
+ (local.get $5)
+ )
+ (br_if $label$0
+ (if (result i64)
+ (i32.const 0)
+ (block $label$2 (result i64)
+ (nop)
+ (br_if $label$2
+ (i64.or
+ (i64.const -2147483648)
+ (i64.const 3088)
+ )
+ (i32.const -17)
)
)
- (loop $label$5
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
+ (block $label$11 (result i64)
+ (nop)
+ (call $log-f64
+ (f64.const 3848309694063512128130702e64)
+ )
+ (loop $label$12 (result i64)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i64.const -32768)
+ )
)
- (return)
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
)
)
- )
- (block $label$6
- (drop
- (ref.null extern)
- )
- (br $label$5)
+ (i64.const 4883)
)
)
- (v128.const i32x4 0x55490b31 0x1b002f01 0x00015c17 0x022a1b01)
)
+ (i32.const 8)
)
)
)