diff options
-rw-r--r-- | src/tools/fuzzing.h | 53 | ||||
-rw-r--r-- | src/wasm-builder.h | 12 | ||||
-rw-r--r-- | src/wasm.h | 8 | ||||
-rw-r--r-- | src/wasm/wasm-binary.cpp | 2 | ||||
-rw-r--r-- | src/wasm/wasm.cpp | 14 | ||||
-rw-r--r-- | test/passes/translate-to-fuzz.txt | 1204 | ||||
-rw-r--r-- | test/passes/translate-to-fuzz_no-fuzz-nans.txt | 741 |
7 files changed, 1064 insertions, 970 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index b8434353a..7b47dea8f 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -255,6 +255,7 @@ private: } void setupMemory() { + // Add memory itself MemoryUtils::ensureExists(wasm.memory); if (features.hasBulkMemory()) { size_t memCovered = 0; @@ -283,6 +284,41 @@ private: wasm.memory.segments[0].data.push_back(value >= 256 ? 0 : (value & 0xff)); } } + // Add memory hasher helper (for the hash, see hash.h). The function looks like: + // function hashMemory() { + // hash = 5381; + // hash = ((hash << 5) + hash) ^ mem[0]; + // hash = ((hash << 5) + hash) ^ mem[1]; + // .. + // return hash; + // } + std::vector<Expression*> contents; + contents.push_back( + builder.makeSetLocal(0, builder.makeConst(Literal(uint32_t(5381)))) + ); + for (Index i = 0; i < USABLE_MEMORY; i++) { + contents.push_back( + builder.makeSetLocal(0, + builder.makeBinary(XorInt32, + builder.makeBinary(AddInt32, + builder.makeBinary(ShlInt32, + builder.makeGetLocal(0, i32), + builder.makeConst(Literal(uint32_t(5))) + ), + builder.makeGetLocal(0, i32) + ), + builder.makeLoad(1, false, i, 1, builder.makeConst(Literal(uint32_t(0))), i32) + ) + ) + ); + } + contents.push_back( + builder.makeGetLocal(0, i32) + ); + auto* body = builder.makeBlock(contents); + auto* hasher = wasm.addFunction(builder.makeFunction("hashMemory", std::vector<Type>{}, i32, { i32 }, body)); + hasher->type = ensureFunctionType(getSig(hasher), &wasm)->name; + wasm.addExport(builder.makeExport(hasher->name, hasher->name, ExternalKind::Function)); } void setupTable() { @@ -675,6 +711,10 @@ private: invoke = builder.makeDrop(invoke); } invocations.push_back(invoke); + // log out memory in some cases + if (oneIn(2)) { + invocations.push_back(makeMemoryHashLogging()); + } } if (invocations.empty()) return; auto* invoker = new Function; @@ -770,7 +810,13 @@ private: Expression* _makenone() { auto choice = upTo(100); - if (choice < LOGGING_PERCENT) return makeLogging(); + if (choice < LOGGING_PERCENT) { + if (choice < LOGGING_PERCENT / 2) { + return makeLogging(); + } else { + return makeMemoryHashLogging(); + } + } choice = upTo(100); if (choice < 50) return makeSetLocal(none); if (choice < 60) return makeBlock(none); @@ -1814,6 +1860,11 @@ private: return builder.makeCall(std::string("log-") + printType(type), { make(type) }, none); } + Expression* makeMemoryHashLogging() { + auto* hash = builder.makeCall(std::string("hashMemory"), {}, i32); + return builder.makeCall(std::string("log-i32"), { hash }, none); + } + // special getters Type getType() { diff --git a/src/wasm-builder.h b/src/wasm-builder.h index 8c50ff2dc..0bbc8eebc 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -40,7 +40,7 @@ public: Builder(MixedArena& allocator) : allocator(allocator) {} Builder(Module& wasm) : allocator(wasm.allocator) {} - // make* functions, create nodes + // make* functions, other globals Function* makeFunction(Name name, std::vector<Type>&& params, @@ -80,6 +80,16 @@ public: return func; } + Export* makeExport(Name name, Name value, ExternalKind kind) { + auto* export_ = new Export(); + export_->name = name; + export_->value = value; + export_->kind = ExternalKind::Function; + return export_; + } + + // IR nodes + Nop* makeNop() { return allocator.alloc<Nop>(); } diff --git a/src/wasm.h b/src/wasm.h index 763a4e764..700938ef9 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -947,10 +947,10 @@ public: Global* getGlobalOrNull(Name name); FunctionType* addFunctionType(std::unique_ptr<FunctionType> curr); - void addExport(Export* curr); - void addFunction(Function* curr); - void addFunction(std::unique_ptr<Function> curr); - void addGlobal(Global* curr); + Export* addExport(Export* curr); + Function* addFunction(Function* curr); + Function* addFunction(std::unique_ptr<Function> curr); + Global* addGlobal(Global* curr); void addStart(const Name& s); diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index b1fc03017..2ee528392 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -330,7 +330,7 @@ void WasmBinaryWriter::writeDataSegments() { writeExpression(segment.offset); o << int8_t(BinaryConsts::End); } - writeInlineBuffer(&segment.data[0], segment.data.size()); + writeInlineBuffer(segment.data.data(), segment.data.size()); } finishSection(start); } diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index ea1ff2a7c..8b8285e35 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -863,7 +863,7 @@ FunctionType* Module::addFunctionType(std::unique_ptr<FunctionType> curr) { return p; } -void Module::addExport(Export* curr) { +Export* Module::addExport(Export* curr) { if (!curr->name.is()) { Fatal() << "Module::addExport: empty name"; } @@ -872,10 +872,11 @@ void Module::addExport(Export* curr) { } exports.push_back(std::unique_ptr<Export>(curr)); exportsMap[curr->name] = curr; + return curr; } // TODO(@warchant): refactor all usages to use variant with unique_ptr -void Module::addFunction(Function* curr) { +Function* Module::addFunction(Function* curr) { if (!curr->name.is()) { Fatal() << "Module::addFunction: empty name"; } @@ -884,20 +885,22 @@ void Module::addFunction(Function* curr) { } functions.push_back(std::unique_ptr<Function>(curr)); functionsMap[curr->name] = curr; + return curr; } -void Module::addFunction(std::unique_ptr<Function> curr) { +Function* Module::addFunction(std::unique_ptr<Function> curr) { if (!curr->name.is()) { Fatal() << "Module::addFunction: empty name"; } if (getFunctionOrNull(curr->name)) { Fatal() << "Module::addFunction: " << curr->name << " already exists"; } - functionsMap[curr->name] = curr.get(); + auto* ret = functionsMap[curr->name] = curr.get(); functions.push_back(std::move(curr)); + return ret; } -void Module::addGlobal(Global* curr) { +Global* Module::addGlobal(Global* curr) { if (!curr->name.is()) { Fatal() << "Module::addGlobal: empty name"; } @@ -906,6 +909,7 @@ void Module::addGlobal(Global* curr) { } globals.push_back(std::unique_ptr<Global>(curr)); globalsMap[curr->name] = curr; + return curr; } void Module::addStart(const Name& s) { diff --git a/test/passes/translate-to-fuzz.txt b/test/passes/translate-to-fuzz.txt index 82a6c20bb..fe24e738e 100644 --- a/test/passes/translate-to-fuzz.txt +++ b/test/passes/translate-to-fuzz.txt @@ -1,30 +1,266 @@ (module + (type $FUNCSIG$i (func (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$vj (func (param i64))) (type $FUNCSIG$vf (func (param f32))) (type $FUNCSIG$vd (func (param f64))) (type $FUNCSIG$vjVdddV (func (param i64 v128 f64 f64 f64 v128))) + (type $FUNCSIG$ddVff (func (param f64 v128 f32 f32) (result f64))) + (type $FUNCSIG$VdVjf (func (param f64 v128 i64 f32) (result v128))) (type $FUNCSIG$v (func)) - (type $FUNCSIG$VidjVji (func (param i32 f64 i64 v128 i64 i32) (result v128))) - (type $FUNCSIG$f (func (result f32))) + (type $FUNCSIG$jjiV (func (param i64 i32 v128) (result i64))) (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))) (import "fuzzing-support" "log-f64" (func $log-f64 (param f64))) (memory $0 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 1 funcref) - (elem (i32.const 0) $func_7) + (table $0 8 funcref) + (elem (i32.const 0) $func_6 $func_6 $func_6 $func_6 $func_9 $func_9 $func_9 $func_9) (global $global$0 (mut i32) (i32.const 975664160)) (global $global$1 (mut i32) (i32.const -536870912)) (global $global$2 (mut f32) (f32.const 2147483648)) (global $global$3 (mut f32) (f32.const 1448959360)) (global $hangLimit (mut i32) (i32.const 10)) - (export "func_4" (func $func_4)) - (export "func_4_invoker" (func $func_4_invoker)) - (export "func_8" (func $func_8)) + (export "hashMemory" (func $hashMemory)) + (export "func_5" (func $func_5)) + (export "func_6" (func $func_6)) + (export "func_7" (func $func_7)) + (export "func_7_invoker" (func $func_7_invoker)) + (export "func_9" (func $func_9)) (export "hangLimitInitializer" (func $hangLimitInitializer)) - (func $func_4 (; 4 ;) (type $FUNCSIG$vjVdddV) (param $0 i64) (param $1 v128) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 v128) + (func $hashMemory (; 4 ;) (type $FUNCSIG$i) (result i32) + (local $0 i32) + (local.set $0 + (i32.const 5381) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=1 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=2 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=3 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=4 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=5 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=6 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=7 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=8 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=9 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=10 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=11 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=12 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=13 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=14 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=15 + (i32.const 0) + ) + ) + ) + (local.get $0) + ) + (func $func_5 (; 5 ;) (type $FUNCSIG$vjVdddV) (param $0 i64) (param $1 v128) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 v128) (block (if (i32.eqz @@ -41,37 +277,42 @@ ) (block $label$0 (call $log-f64 - (local.tee $3 - (local.tee $2 - (local.tee $4 - (f64.const -256) + (loop $label$1 (result f64) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block $label$2 (result f64) + (call $log-i32 + (call $hashMemory) + ) + (local.get $2) ) ) ) - (call $log-i64 - (i64.const 79) + (call $log-i32 + (call $hashMemory) ) ) ) - (func $func_4_invoker (; 5 ;) (type $FUNCSIG$v) - (call $func_4 - (i64.const 73) - (v128.const i32x4 0x4e58f5cd 0x337c2b33 0xff7fffff 0xcf000000) - (f64.const 2598385990079483892015151e117) - (f64.const 1797693134862315708145274e284) - (f64.const -256) - (v128.const i32x4 0xff641a00 0x010008b9 0x80004d00 0x594000b3) - ) - ) - (func $func_6 (; 6 ;) (result i64) + (func $func_6 (; 6 ;) (type $FUNCSIG$ddVff) (param $0 f64) (param $1 v128) (param $2 f32) (param $3 f32) (result f64) (block (if (i32.eqz (global.get $hangLimit) ) (return - (i64.const 2825486730639530279) + (local.get $0) ) ) (global.set $hangLimit @@ -81,20 +322,23 @@ ) ) ) - (i64.const 32) + (block $label$0 (result f64) + (call $log-i32 + (i32.const 84215045) + ) + (f64.const 8) + ) ) - (func $func_7 (; 7 ;) (type $FUNCSIG$VidjVji) (param $0 i32) (param $1 f64) (param $2 i64) (param $3 v128) (param $4 i64) (param $5 i32) (result v128) - (local $6 v128) - (local $7 v128) - (local $8 f32) - (local $9 i64) + (func $func_7 (; 7 ;) (type $FUNCSIG$VdVjf) (param $0 f64) (param $1 v128) (param $2 i64) (param $3 f32) (result v128) + (local $4 i32) + (local $5 f64) (block (if (i32.eqz (global.get $hangLimit) ) (return - (local.get $3) + (local.get $1) ) ) (global.set $hangLimit @@ -104,34 +348,82 @@ ) ) ) - (local.tee $6 - (block $label$0 - (call $log-i64 - (local.tee $9 - (local.get $9) - ) + (local.tee $1 + (local.tee $1 + (v128.const i32x4 0x6d484708 0x13e740fc 0x5849037f 0xe4000000) + ) + ) + ) + (func $func_7_invoker (; 8 ;) (type $FUNCSIG$v) + (drop + (call $func_7 + (f64.const 16986) + (v128.const i32x4 0x00000000 0x00000010 0xffffe000 0xffffffff) + (i64.const -12) + (f32.const 7243) + ) + ) + (drop + (call $func_7 + (f64.const -65536) + (v128.const i32x4 0x00007d1f 0x00000200 0xffff0000 0x7fffffff) + (i64.const 288230376151711744) + (f32.const 128) + ) + ) + (call $log-i32 + (call $hashMemory) + ) + (drop + (call $func_7 + (f64.const -nan:0xfffffffffffb5) + (v128.const i32x4 0x00000000 0x403a0000 0x00000000 0xb8100000) + (i64.const 66) + (f32.const -nan:0x7fffb0) + ) + ) + ) + (func $func_9 (; 9 ;) (type $FUNCSIG$jjiV) (param $0 i64) (param $1 i32) (param $2 v128) (result i64) + (block + (if + (i32.eqz + (global.get $hangLimit) ) (return - (local.get $3) + (local.get $0) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) ) ) ) + (i64.const 8) ) - (func $func_8 (; 8 ;) (type $FUNCSIG$f) (result f32) - (local $0 f32) - (local $1 i64) - (local $2 v128) - (local $3 i32) - (local $4 f32) + (func $func_10 (; 10 ;) (param $0 v128) (param $1 i64) (param $2 i64) (result v128) + (local $3 i64) + (local $4 v128) (local $5 f64) - (local $6 i32) + (local $6 f32) + (local $7 v128) + (local $8 f64) + (local $9 i64) + (local $10 f32) + (local $11 i32) + (local $12 f32) + (local $13 i32) + (local $14 v128) + (local $15 v128) + (local $16 f64) (block (if (i32.eqz (global.get $hangLimit) ) (return - (local.get $0) + (v128.const i32x4 0x80000000 0x80000001 0xffffffa1 0x00000000) ) ) (global.set $hangLimit @@ -141,18 +433,44 @@ ) ) ) - (block $label$0 (result f32) - (local.set $5 - (block $label$1 (result f64) - (local.set $4 - (loop $label$2 (result f32) + (block $label$0 + (local.set $8 + (f64.const 5382) + ) + (if + (i32.eqz + (local.tee $11 + (loop $label$72 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (local.get $15) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (i32.const -127) + ) + ) + ) + (block $label$19 + (block $label$20 + (loop $label$21 (block (if (i32.eqz (global.get $hangLimit) ) (return - (f32.const 256) + (v128.const i32x4 0x4598b000 0x4f000000 0x5f000000 0x4d30d0b0) ) ) (global.set $hangLimit @@ -162,108 +480,163 @@ ) ) ) - (block (result f32) - (block $label$3 - (nop) - (local.set $5 - (br_if $label$1 - (local.get $5) + (nop) + ) + (local.set $11 + (local.tee $13 + (i32.const 3088) + ) + ) + ) + (return + (local.get $0) + ) + ) + (block $label$43 + (loop $label$44 + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (local.get $4) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block + (block $label$45 + (if + (i32.eqz + (i32.const 536870912) + ) + (local.set $11 + (local.get $13) + ) + (block $label$46 + (global.set $global$3 + (f32.const 269239296) + ) + (local.tee $16 + (local.tee $16 + (block $label$47 + (br $label$46) + ) + ) + ) + ) + ) + (loop $label$48 + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (local.get $4) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block + (local.set $11 + (local.tee $13 + (i32.const 2097152) + ) + ) + (br_if $label$48 (i32.eqz - (i32.eqz - (if (result i32) - (i32.eqz - (local.get $6) + (local.tee $11 + (loop $label$49 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (local.get $0) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) ) - (block $label$44 (result i32) - (block $label$45 - (local.set $2 - (call_indirect (type $FUNCSIG$VidjVji) - (loop $label$46 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const -nan:0x7fffe6) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$47 (result i32) - (if - (i32.eqz - (local.tee $3 - (local.tee $3 - (if - (local.tee $3 - (i32.const 0) - ) - (block $label$48 - (local.set $2 - (i64x2.shr_u - (local.get $2) - (i32.const 1309412122) - ) - ) - (br $label$46) - ) - (block $label$49 - (local.set $0 - (local.tee $4 - (f32.const -4294967296) - ) - ) - (br $label$45) - ) - ) + (block (result i32) + (local.set $10 + (local.tee $12 + (local.tee $6 + (local.tee $12 + (local.get $12) + ) + ) + ) + ) + (br_if $label$49 + (i32.const 512) + ) + (loop $label$50 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (v128.const i32x4 0x0000002a 0xf801141f 0xfe1c005c 0xf1f27f14) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block $label$51 (result i32) + (local.set $11 + (if (result i32) + (i32.eqz + (if (result i32) + (if (result i32) + (if (result i32) + (i32.eqz + (i32.const 170) ) + (i32.const 170) + (i32.const 16) ) - ) - (block $label$50 - (if - (block $label$51 - (global.set $global$0 - (local.get $6) - ) - (br $label$46) - ) - (block $label$52 - (call $log-f32 - (local.get $4) - ) - ) - (local.tee $1 - (block $label$53 - (call $log-i64 - (local.tee $1 - (local.tee $1 - (i64.const 2147483647) - ) - ) - ) - (br $label$45) - ) - ) + (local.tee $11 + (local.get $13) ) - (local.set $4 - (local.get $0) + (block $label$52 + (local.set $13 + (local.get $11) + ) + (br $label$44) ) ) - (block $label$54 - (loop $label$55 + (block $label$53 + (loop $label$54 (block (if (i32.eqz (global.get $hangLimit) ) (return - (local.get $4) + (local.get $14) ) ) (global.set $hangLimit @@ -274,390 +647,104 @@ ) ) (block - (block $label$56 - (call $log-f64 - (f64.const 15) - ) - (local.set $2 - (v128.const i32x4 0x616a6b2b 0x2c343b35 0xfffff800 0x494b1217) - ) - ) - (br_if $label$55 - (br_if $label$44 - (local.tee $6 - (i32.const 4) - ) - (loop $label$57 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const 72) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block (result i32) - (block $label$58 - (call $log-i64 - (local.tee $1 - (local.tee $1 - (i64.const -134217728) - ) - ) - ) - (local.set $0 - (f32.const -2147483648) - ) - ) - (br_if $label$57 - (loop $label$59 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (local.get $0) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block (result i32) - (block $label$60 - (br_if $label$45 - (local.get $3) - ) - (local.set $2 - (local.get $2) - ) - ) - (br_if $label$59 - (local.get $6) - ) - (local.get $3) - ) - ) - ) - (loop $label$61 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const -9223372036854775808) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block (result i32) - (block $label$62 - (loop $label$63 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (local.get $4) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block - (local.set $2 - (v128.const i32x4 0x07070707 0x1e070707 0xfff80000 0xffffffff) - ) - (br_if $label$63 - (i32.eqz - (i32.const 1094730305) - ) - ) - (local.set $1 - (local.get $1) - ) - ) - ) - ) - (br_if $label$61 - (i32.eqz - (if (result i32) - (i32.eqz - (local.get $3) - ) - (i32.const 512) - (i32.const 128) - ) - ) - ) - (br_if $label$44 - (i32.const 26) - (i32.eqz - (i32.const 24857) - ) - ) - ) - ) - ) - ) + (nop) + (br_if $label$54 + (i32.eqz + (local.get $13) ) ) - (call $log-i32 - (i32.const 1937132399) - ) - ) - ) - (local.set $2 - (local.tee $2 - (local.tee $2 - (local.tee $2 - (local.tee $2 - (local.tee $2 - (v128.const i32x4 0x0000020b 0xfff4ff01 0xffc00000 0xff02fffe) - ) - ) - ) + (local.set $2 + (i64.const 112) ) ) ) + (br $label$49) ) - ) - (local.tee $3 - (local.tee $3 - (local.tee $3 - (i8x16.extract_lane_s 8 - (local.get $2) - ) + (local.tee $11 + (local.tee $13 + (local.get $11) ) ) ) ) - ) - (f64.const -0) - (local.get $1) - (local.tee $2 - (local.tee $2 - (local.get $2) - ) - ) - (if (result i64) - (local.get $6) - (block $label$65 (result i64) - (local.set $0 - (local.tee $0 - (f32.convert_i64_s - (local.tee $1 - (local.get $1) - ) + (block $label$55 (result i32) + (br_if $label$48 + (local.tee $11 + (local.tee $13 + (local.get $13) ) ) ) - (local.tee $1 - (if (result i64) - (i32.eqz - (loop $label$66 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const 4.714809874508602e-28) - ) + (br_if $label$51 + (local.tee $11 + (local.tee $13 + (i32.const -62) + ) + ) + (if (result i32) + (i32.const 86) + (block $label$56 (result i32) + (br_if $label$56 + (local.get $13) + (i32.const -84) + ) + ) + (loop $label$57 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) + (return + (local.get $14) ) ) - (block (result i32) - (block $label$67 - (local.tee $3 - (loop $label$68 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const 549755813888) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$69 - (if - (i32.eqz - (i32.const -96) - ) - (local.set $2 - (v128.const i32x4 0xcf400000 0x41d655d6 0x00000000 0x38100000) - ) - (local.set $5 - (f64.const 6767264718455265491139985e262) - ) - ) - (br $label$45) - ) - ) - ) - (local.set $2 - (v128.const i32x4 0x2235ce00 0x1d01000b 0x39290018 0x352b0000) - ) - ) - (br_if $label$66 - (i32.eqz - (local.get $3) - ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) ) - (i32.const 128) ) ) + (i32.const 34176355) ) - (i64.const 255) - (i64.const -46) ) ) ) - (block $label$70 (result i64) - (local.get $1) + (block $label$58 + (local.set $14 + (v128.const i32x4 0x0f0c0d04 0x0a020d43 0x1402026d 0x47130847) + ) + (br $label$49) ) ) - (local.get $3) - (i32.const 0) - ) - ) - (nop) - ) - (local.get $6) - ) - (i32.const 255) - ) - ) - ) - ) - ) - ) - (br_if $label$2 - (loop $label$4 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (local.get $4) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block (result i32) - (block $label$5 - (memory.fill - (i32.and - (local.tee $6 - (local.get $6) - ) - (local.get $6) - ) - (i32.and - (local.get $6) - (i32.const 15) - ) - (i32.const 1) - ) - (block $label$12 - (nop) - ) - ) - (br_if $label$4 - (if (result i32) - (local.get $3) - (block $label$13 (result i32) - (local.set $4 - (loop $label$14 (result f32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (local.get $0) - ) ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$15 (result f32) - (local.set $6 - (block $label$16 (result i32) + (loop $label$59 + (block (if - (i32.const 1275596062) - (nop) - (local.set $5 - (local.get $5) + (i32.eqz + (global.get $hangLimit) + ) + (return + (v128.const i32x4 0x00000000 0x43e00000 0x00000000 0xc1f00000) ) ) - (br_if $label$13 - (local.get $3) - (local.get $3) - ) - ) - ) - (br_if $label$15 - (local.tee $4 - (local.tee $0 - (local.get $0) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) ) ) - (i32.eqz - (loop $label$17 (result i32) + (block $label$60 + (loop $label$61 (block (if (i32.eqz (global.get $hangLimit) ) (return - (f32.const 2176.25048828125) + (v128.const i32x4 0x00007272 0x00000000 0x00000001 0x80000000) ) ) (global.set $hangLimit @@ -667,108 +754,97 @@ ) ) ) - (block (result i32) - (block $label$18 - (call $log-f32 - (local.get $0) - ) + (block $label$62 + (local.set $3 + (i64.const -2048) ) - (br_if $label$17 - (local.tee $6 - (i32.const 32) + (i64.store16 offset=3 align=1 + (i32.and + (local.tee $13 + (local.tee $13 + (local.tee $13 + (i32.const 64) + ) + ) + ) + (i32.const 15) ) - ) - (local.tee $6 - (local.tee $3 - (local.get $3) + (local.tee $9 + (loop $label$63 (result i64) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (v128.const i32x4 0x80000000 0x1e1e141e 0x00008000 0x000e010b) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block (result i64) + (local.set $9 + (local.get $3) + ) + (br_if $label$63 + (i32.const -256) + ) + (block $label$64 (result i64) + (local.set $16 + (f64.const 2147483648) + ) + (local.get $1) + ) + ) + ) ) ) ) ) + (return + (local.get $4) + ) ) ) ) ) ) - (br $label$2) ) - (i32.const 286919692) ) ) - (i32.const 1701143815) ) - ) - ) - (f32.const -nan:0x7fffbd) - ) - ) - ) - (return - (local.get $0) - ) - ) - ) - (br_if $label$0 - (f32.const 4.6423336564924e-40) - (i32.eqz - (local.tee $3 - (loop $label$37 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (local.get $4) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block (result i32) - (local.set $5 - (f64.const 151992138) - ) - (br_if $label$37 - (local.tee $3 - (local.tee $3 - (loop $label$38 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const 185622288) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) + (local.tee $13 + (local.tee $11 + (block $label$65 + (local.set $16 + (f64.const 5.487989131676445e-139) ) + (br $label$44) ) - (local.get $6) ) ) ) ) - (local.tee $3 - (i32.const 112) - ) + ) + (local.set $5 + (local.get $5) + ) + (local.set $11 + (local.get $11) ) ) ) + (unreachable) ) ) ) ) - (func $hangLimitInitializer (; 9 ;) + (func $hangLimitInitializer (; 11 ;) (global.set $hangLimit (i32.const 10) ) diff --git a/test/passes/translate-to-fuzz_no-fuzz-nans.txt b/test/passes/translate-to-fuzz_no-fuzz-nans.txt index ff8b1f26b..294b4f986 100644 --- a/test/passes/translate-to-fuzz_no-fuzz-nans.txt +++ b/test/passes/translate-to-fuzz_no-fuzz-nans.txt @@ -1,30 +1,268 @@ (module + (type $FUNCSIG$i (func (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$vj (func (param i64))) (type $FUNCSIG$vf (func (param f32))) (type $FUNCSIG$vd (func (param f64))) (type $FUNCSIG$vjVdddV (func (param i64 v128 f64 f64 f64 v128))) + (type $FUNCSIG$ddVff (func (param f64 v128 f32 f32) (result f64))) + (type $FUNCSIG$VdVjf (func (param f64 v128 i64 f32) (result v128))) (type $FUNCSIG$v (func)) - (type $FUNCSIG$VidjVji (func (param i32 f64 i64 v128 i64 i32) (result v128))) - (type $FUNCSIG$f (func (result f32))) + (type $FUNCSIG$jjiV (func (param i64 i32 v128) (result i64))) + (type $FUNCSIG$VVjj (func (param v128 i64 i64) (result v128))) (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))) (import "fuzzing-support" "log-f64" (func $log-f64 (param f64))) (memory $0 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 1 1 funcref) - (elem (i32.const 0) $func_7) + (table $0 8 8 funcref) + (elem (i32.const 0) $func_6 $func_6 $func_6 $func_6 $func_9 $func_9 $func_9 $func_9) (global $global$0 (mut i32) (i32.const 975664160)) (global $global$1 (mut i32) (i32.const -536870912)) (global $global$2 (mut f32) (f32.const 2147483648)) (global $global$3 (mut f32) (f32.const 1448959360)) (global $hangLimit (mut i32) (i32.const 10)) - (export "func_4" (func $func_4)) - (export "func_4_invoker" (func $func_4_invoker)) - (export "func_8" (func $func_8)) + (export "hashMemory" (func $hashMemory)) + (export "func_5" (func $func_5)) + (export "func_6" (func $func_6)) + (export "func_7" (func $func_7)) + (export "func_7_invoker" (func $func_7_invoker)) + (export "func_9" (func $func_9)) + (export "func_10" (func $func_10)) (export "hangLimitInitializer" (func $hangLimitInitializer)) - (func $func_4 (; 4 ;) (type $FUNCSIG$vjVdddV) (param $0 i64) (param $1 v128) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 v128) + (func $hashMemory (; 4 ;) (type $FUNCSIG$i) (result i32) + (local $0 i32) + (local.set $0 + (i32.const 5381) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=1 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=2 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=3 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=4 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=5 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=6 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=7 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=8 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=9 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=10 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=11 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=12 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=13 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=14 + (i32.const 0) + ) + ) + ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=15 + (i32.const 0) + ) + ) + ) + (local.get $0) + ) + (func $func_5 (; 5 ;) (type $FUNCSIG$vjVdddV) (param $0 i64) (param $1 v128) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 v128) (block (if (i32.eqz @@ -41,37 +279,42 @@ ) (block $label$0 (call $log-f64 - (local.tee $3 - (local.tee $2 - (local.tee $4 - (f64.const -256) + (loop $label$1 (result f64) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block $label$2 (result f64) + (call $log-i32 + (call $hashMemory) ) + (local.get $2) ) ) ) - (call $log-i64 - (i64.const 79) + (call $log-i32 + (call $hashMemory) ) ) ) - (func $func_4_invoker (; 5 ;) (type $FUNCSIG$v) - (call $func_4 - (i64.const 73) - (v128.const i32x4 0x4e58f5cd 0x337c2b33 0xff7fffff 0xcf000000) - (f64.const 2598385990079483892015151e117) - (f64.const 1797693134862315708145274e284) - (f64.const -256) - (v128.const i32x4 0xff641a00 0x010008b9 0x80004d00 0x594000b3) - ) - ) - (func $func_6 (; 6 ;) (result i64) + (func $func_6 (; 6 ;) (type $FUNCSIG$ddVff) (param $0 f64) (param $1 v128) (param $2 f32) (param $3 f32) (result f64) (block (if (i32.eqz (global.get $hangLimit) ) (return - (i64.const 2825486730639530279) + (local.get $0) ) ) (global.set $hangLimit @@ -81,20 +324,23 @@ ) ) ) - (i64.const 32) + (block $label$0 (result f64) + (call $log-i32 + (i32.const 84215045) + ) + (f64.const 8) + ) ) - (func $func_7 (; 7 ;) (type $FUNCSIG$VidjVji) (param $0 i32) (param $1 f64) (param $2 i64) (param $3 v128) (param $4 i64) (param $5 i32) (result v128) - (local $6 v128) - (local $7 v128) - (local $8 f32) - (local $9 i64) + (func $func_7 (; 7 ;) (type $FUNCSIG$VdVjf) (param $0 f64) (param $1 v128) (param $2 i64) (param $3 f32) (result v128) + (local $4 i32) + (local $5 f64) (block (if (i32.eqz (global.get $hangLimit) ) (return - (local.get $3) + (local.get $1) ) ) (global.set $hangLimit @@ -104,34 +350,49 @@ ) ) ) - (local.tee $6 - (block $label$0 - (call $log-i64 - (local.tee $9 - (local.get $9) - ) - ) - (return - (local.get $3) - ) + (local.tee $1 + (local.tee $1 + (v128.const i32x4 0x6d484708 0x13e740fc 0x5849037f 0xe4000000) ) ) ) - (func $func_8 (; 8 ;) (type $FUNCSIG$f) (result f32) - (local $0 f32) - (local $1 i64) - (local $2 v128) - (local $3 i32) - (local $4 f32) - (local $5 f64) - (local $6 i32) + (func $func_7_invoker (; 8 ;) (type $FUNCSIG$v) + (drop + (call $func_7 + (f64.const 16986) + (v128.const i32x4 0x00000000 0x00000010 0xffffe000 0xffffffff) + (i64.const -12) + (f32.const 7243) + ) + ) + (drop + (call $func_7 + (f64.const -65536) + (v128.const i32x4 0x00007d1f 0x00000200 0xffff0000 0x7fffffff) + (i64.const 288230376151711744) + (f32.const 128) + ) + ) + (call $log-i32 + (call $hashMemory) + ) + (drop + (call $func_7 + (f64.const 0) + (v128.const i32x4 0x00000000 0x403a0000 0x00000000 0xb8100000) + (i64.const 66) + (f32.const 0) + ) + ) + ) + (func $func_9 (; 9 ;) (type $FUNCSIG$jjiV) (param $0 i64) (param $1 i32) (param $2 v128) (result i64) (block (if (i32.eqz (global.get $hangLimit) ) (return - (local.get $4) + (local.get $0) ) ) (global.set $hangLimit @@ -141,357 +402,49 @@ ) ) ) - (block $label$0 (result f32) - (local.set $5 - (block $label$1 (result f64) - (local.tee $4 - (loop $label$2 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const 0) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block - (block $label$3 - (nop) - (local.set $5 - (local.get $5) - ) - ) - (br_if $label$2 - (loop $label$4 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const -2147483648) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block (result i32) - (block $label$5 - (local.set $1 - (local.get $1) - ) - (block $label$12 - (local.set $5 - (br_if $label$1 - (f64.const 1.7669274412651046e-284) - (local.get $6) - ) - ) - ) - ) - (br_if $label$4 - (if - (local.get $3) - (block $label$13 - (local.set $4 - (loop $label$14 (result f32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (local.get $4) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$15 (result f32) - (local.set $6 - (block $label$16 (result i32) - (if - (i32.const 1275596062) - (nop) - (local.set $5 - (local.get $5) - ) - ) - (i32.const -2048) - ) - ) - (br_if $label$15 - (local.tee $4 - (local.tee $0 - (local.get $0) - ) - ) - (i32.eqz - (loop $label$17 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (local.get $0) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block (result i32) - (block $label$18 - (call $log-f32 - (f32.const 0) - ) - ) - (br_if $label$17 - (local.tee $6 - (i32.const 32) - ) - ) - (local.tee $6 - (local.tee $3 - (local.get $3) - ) - ) - ) - ) - ) - ) - ) - ) - ) - (br $label$2) - ) - (block $label$19 - (local.set $5 - (local.get $5) - ) - (br $label$4) - ) - ) - ) - (loop $label$20 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (local.get $4) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$21 (result i32) - (local.set $4 - (global.get $global$2) - ) - (loop $label$22 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (local.get $4) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (local.get $6) - ) - ) - ) - ) - ) - ) - (block - (loop $label$34 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const 1.61674249926627e-27) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$35 - (local.set $1 - (local.tee $1 - (local.tee $1 - (local.tee $1 - (local.tee $1 - (i64.const -512) - ) - ) - ) - ) - ) - (local.tee $4 - (local.tee $4 - (local.tee $0 - (block $label$36 - (local.set $1 - (local.get $1) - ) - (br $label$2) - ) - ) - ) - ) - ) - ) - (drop - (i32.eqz - (if (result i32) - (i32.const 1633371484) - (i32.const 36) - (local.get $3) - ) - ) - ) - ) - ) - ) - ) - (return - (local.get $0) - ) + (i64.const 8) + ) + (func $func_10 (; 10 ;) (type $FUNCSIG$VVjj) (param $0 v128) (param $1 i64) (param $2 i64) (result v128) + (local $3 i64) + (local $4 v128) + (local $5 f64) + (local $6 f32) + (local $7 v128) + (local $8 f64) + (local $9 i64) + (local $10 f32) + (local $11 i32) + (local $12 f32) + (local $13 i32) + (local $14 v128) + (local $15 v128) + (local $16 f64) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (local.get $14) ) ) - (br_if $label$0 - (f32.const 4.6423336564924e-40) - (i32.eqz - (local.tee $3 - (loop $label$37 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const -536870912) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block (result i32) - (local.set $5 - (f64.const 151992138) - ) - (br_if $label$37 - (local.tee $3 - (local.tee $3 - (loop $label$38 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const -9223372036854775808) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block (result i32) - (block $label$39 - (local.set $2 - (local.get $2) - ) - (block $label$43 - (local.set $0 - (f32.const -9223372036854775808) - ) - (local.set $5 - (local.tee $5 - (local.tee $5 - (local.tee $5 - (f64.const 740889648) - ) - ) - ) - ) - ) - ) - (local.set $4 - (f32.const -18446744073709551615) - ) - (i32.const 36) - ) - ) - ) - ) - ) - (local.tee $3 - (local.tee $6 - (i32.const 2147483647) - ) - ) - ) - ) - ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) ) ) ) + (return + (local.get $14) + ) ) - (func $hangLimitInitializer (; 9 ;) + (func $hangLimitInitializer (; 11 ;) (global.set $hangLimit (i32.const 10) ) ) - (func $deNan32 (; 10 ;) (param $0 f32) (result f32) + (func $deNan32 (; 12 ;) (param $0 f32) (result f32) (if (result f32) (f32.eq (local.get $0) @@ -501,7 +454,7 @@ (f32.const 0) ) ) - (func $deNan64 (; 11 ;) (param $0 f64) (result f64) + (func $deNan64 (; 13 ;) (param $0 f64) (result f64) (if (result f64) (f64.eq (local.get $0) |