summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-09-12 13:37:39 -0700
committerAlon Zakai <alonzakai@gmail.com>2017-09-27 13:07:55 -0700
commit27af98deb91d1d64be44cdf12f01833b677fbf34 (patch)
tree61aa683b01192259297bcc64db092a2e17009ac7
parentc69253378014ffc451adf916d017d8f21faae77c (diff)
downloadbinaryen-27af98deb91d1d64be44cdf12f01833b677fbf34.tar.gz
binaryen-27af98deb91d1d64be44cdf12f01833b677fbf34.tar.bz2
binaryen-27af98deb91d1d64be44cdf12f01833b677fbf34.zip
fuzzing improvements:
* randomize initial memory * low chance to have tiny blocks * decent chance to have a branch back to the loop top
-rw-r--r--src/tools/translate-to-fuzz.h31
-rw-r--r--src/wasm.h4
-rw-r--r--test/passes/translate-to-fuzz.txt1174
3 files changed, 426 insertions, 783 deletions
diff --git a/src/tools/translate-to-fuzz.h b/src/tools/translate-to-fuzz.h
index 95f2ee79e..821416d87 100644
--- a/src/tools/translate-to-fuzz.h
+++ b/src/tools/translate-to-fuzz.h
@@ -20,7 +20,6 @@
//
/*
-memory too
high chance for set at start of loop
high chance of get of a set local in the scope of that scope
high chance of a tee in that case => loop var
@@ -90,6 +89,7 @@ private:
// the memory that we use, a small portion so that we have a good chance of
// looking at writes (we also look outside of this region with small probability)
+ // this should be a power of 2
static const int USABLE_MEMORY = 32;
// the number of runtime iterations (function calls, loop backbranches) we
@@ -158,6 +158,13 @@ private:
wasm.memory.exists = true;
// use one page
wasm.memory.initial = wasm.memory.max = 1;
+ // init some data
+ wasm.memory.segments.emplace_back(builder.makeConst(Literal(int32_t(0))));
+ auto num = upTo(USABLE_MEMORY * 2);
+ for (size_t i = 0; i < num; i++) {
+ auto value = upTo(512);
+ wasm.memory.segments[0].data.push_back(value >= 256 ? 0 : (value & 0xff));
+ }
}
void setupTable() {
@@ -509,6 +516,10 @@ private:
num /= 2;
}
}
+ // not likely to have a block of size 1
+ if (num == 0 && !oneIn(10)) {
+ num++;
+ }
while (num > 0 && !finishedInput) {
ret->list.push_back(make(none));
num--;
@@ -540,7 +551,17 @@ private:
ret->name = makeLabel();
breakableStack.push_back(ret);
hangStack.push_back(ret);
- ret->body = makeMaybeBlock(type);
+ // either create random content, or do something more targeted
+ if (oneIn(2)) {
+ ret->body = makeMaybeBlock(type);
+ } else {
+ // ensure a branch back. also optionally create some loop vars
+ std::vector<Expression*> list;
+ list.push_back(makeMaybeBlock(none)); // primary contents
+ list.push_back(builder.makeBreak(ret->name, nullptr, makeCondition())); // possible branch back
+ list.push_back(make(type)); // final element, so we have the right type
+ ret->body = builder.makeBlock(list);
+ }
breakableStack.pop_back();
hangStack.pop_back();
if (HANG_LIMIT > 0) {
@@ -1147,6 +1168,12 @@ private:
return upTo(x) == 0;
}
+ bool onceEvery(Index x) {
+ static int counter = 0;
+ counter++;
+ return counter % x == 0;
+ }
+
// apply upTo twice, generating a skewed distribution towards
// low values
Index upToSquared(Index x) {
diff --git a/src/wasm.h b/src/wasm.h
index 50646e39f..c31aac9c1 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -654,8 +654,7 @@ public:
Expression* offset;
std::vector<Name> data;
Segment() {}
- Segment(Expression* offset) : offset(offset) {
- }
+ Segment(Expression* offset) : offset(offset) {}
Segment(Expression* offset, std::vector<Name>& init) : offset(offset) {
data.swap(init);
}
@@ -685,6 +684,7 @@ public:
Expression* offset;
std::vector<char> data; // TODO: optimize
Segment() {}
+ Segment(Expression* offset) : offset(offset) {}
Segment(Expression* offset, const char* init, Address size) : offset(offset) {
data.resize(size);
std::copy_n(init, size, data.begin());
diff --git a/test/passes/translate-to-fuzz.txt b/test/passes/translate-to-fuzz.txt
index c78ef2cbd..3b49f86c1 100644
--- a/test/passes/translate-to-fuzz.txt
+++ b/test/passes/translate-to-fuzz.txt
@@ -1,76 +1,22 @@
(module
- (type $FUNCSIG$i (func (result i32)))
- (type $FUNCSIG$ddfj (func (param f64 f32 i64) (result f64)))
(type $FUNCSIG$j (func (result i64)))
- (type $FUNCSIG$v (func))
- (type $FUNCSIG$ji (func (param i32) (result i64)))
(global $hangLimit (mut i32) (i32.const 100))
- (table 3 3 anyfunc)
- (elem (i32.const 0) $func_3 $func_5 $func_5)
+ (table 0 0 anyfunc)
+
(memory $0 1 1)
+ (data (i32.const 0) "\00C\00[\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
(export "func_0" (func $func_0))
- (export "func_2" (func $func_2))
- (export "func_5" (func $func_5))
- (export "func_6" (func $func_6))
(export "hangLimitInitializer" (func $hangLimitInitializer))
- (func $func_0 (type $FUNCSIG$i) (result i32)
- (local $0 f32)
- (local $1 i64)
- (local $2 f32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (i32.const -4096)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (loop $label$0
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (i32.const 53)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (i64.trunc_u/f64
- (drop
- (drop
- (unreachable)
- )
- )
- )
- )
- )
- (func $func_1 (result f32)
- (local $0 i64)
+ (func $func_0 (type $FUNCSIG$j) (result i64)
+ (local $0 i32)
(local $1 f64)
- (local $2 i32)
- (local $3 i32)
(block
(if
(i32.eqz
(get_global $hangLimit)
)
(return
- (f32.const -1)
+ (i64.const -68719476736)
)
)
(set_global $hangLimit
@@ -80,411 +26,157 @@
)
)
)
- (block $label$0 (result f32)
+ (block $label$0 (result i64)
+ (nop)
(br_if $label$0
- (br_if $label$0
- (f32.load offset=22 align=1
- (i32.and
- (block $label$3 (result i32)
- (tee_local $2
- (select
- (if (result i32)
- (i32.eqz
- (if (result i32)
- (i32.eqz
- (loop $label$6 (result i32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (f32.const 4294967296)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (i32.const 1073741824)
- )
- )
- (block $label$7 (result i32)
- (return
- (f32.const 1816)
- )
- )
- (block $label$8 (result i32)
- (if (result i32)
- (i32.eqz
- (i32.const -1073741824)
- )
- (i32.clz
- (block $label$9 (result i32)
- (return
- (f32.const 8)
- )
- )
- )
- (i32.div_u
- (get_local $2)
- (get_local $3)
- )
- )
- )
- )
- )
- (block $label$10 (result i32)
- (loop $label$11 (result i32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (f32.const -9223372036854775808)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block $label$12 (result i32)
- (br $label$11)
- )
- )
- )
- (i32.load offset=4 align=1
- (i32.and
- (loop $label$13 (result i32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (f32.const 1073741824)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (f32.lt
- (f32.const 512)
- (block $label$14 (result f32)
- (br $label$13)
- )
- )
- )
- (i32.const 31)
- )
- )
- )
- (i32.xor
- (tee_local $2
- (f64.lt
- (get_local $1)
- (call $deNan64
- (f64.promote/f32
- (f32.const 47)
- )
- )
- )
- )
- (if (result i32)
- (select
- (i32.const 32625)
- (i32.const -1)
- (get_local $2)
- )
- (block $label$15 (result i32)
- (i32.load16_u offset=4
- (i32.load16_u offset=3 align=1
- (get_local $3)
- )
- )
- )
- (block $label$16 (result i32)
- (return
- (f32.const 18446744073709551615)
- )
- )
- )
- )
- (i32.load8_u offset=3
- (i32.and
- (if (result i32)
- (get_local $2)
- (block $label$4 (result i32)
- (return
- (f32.const -2097152)
- )
- )
- (block $label$5 (result i32)
- (return
- (f32.const 8192)
- )
- )
- )
- (i32.const 31)
- )
- )
- )
+ (i64.const 127)
+ (i32.eqz
+ (loop $label$37 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (get_global $hangLimit)
)
- )
- (i32.const 31)
- )
- )
- (i32.wrap/i64
- (i64.const -83)
- )
- )
- (i32.load8_u offset=22
- (i32.and
- (i32.rotr
- (loop $label$1 (result i32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (f32.const 3402823466385288598117041e14)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
+ (return
+ (i64.const -524288)
)
- (block $label$2 (result i32)
- (return
- (f32.const 1)
- )
+ )
+ (set_global $hangLimit
+ (i32.sub
+ (get_global $hangLimit)
+ (i32.const 1)
)
)
- (i32.const 605820702)
)
- (i32.const 31)
- )
- )
- )
- )
- )
- (func $func_2 (type $FUNCSIG$ddfj) (param $0 f64) (param $1 f32) (param $2 i64) (result f64)
- (local $3 f64)
- (local $4 i64)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (get_local $3)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (get_local $3)
- )
- (func $func_3 (type $FUNCSIG$v)
- (local $0 f32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return)
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block $label$0
- (block $label$1
- (i32.reinterpret/f32
- (return)
- )
- )
- )
- )
- (func $func_4 (result i64)
- (local $0 i64)
- (local $1 f32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (get_local $0)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (i64.shr_s
- (get_local $0)
- (block $label$0 (result i64)
- (return
- (get_local $0)
- )
- )
- )
- )
- (func $func_5 (type $FUNCSIG$j) (result i64)
- (local $0 i32)
- (local $1 i64)
- (local $2 i64)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (i64.const -2147483648)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block $label$0 (result i64)
- (return
- (i64.const -562949953421312)
- )
- )
- )
- (func $func_6 (type $FUNCSIG$ji) (param $0 i32) (result i64)
- (local $1 f64)
- (local $2 f64)
- (local $3 i32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (i64.const 106)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block $label$0 (result i64)
- (i32.store offset=4 align=2
- (i32.and
- (select
- (if (result i32)
- (i32.eqz
- (loop $label$3 (result i32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (i64.const 227)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
+ (block $label$38 (result i32)
+ (if
+ (i32.eqz
+ (i32.wrap/i64
+ (i64.const -82)
+ )
+ )
+ (br_if $label$37
+ (i32.eqz
+ (i64.gt_u
+ (i64.const 79723535910970419)
+ (i64.const 255)
)
)
- (block $label$4 (result i32)
- (tee_local $3
- (if (result i32)
+ )
+ (block $label$39
+ (loop $label$40
+ (block
+ (if
(i32.eqz
- (get_local $0)
+ (get_global $hangLimit)
)
- (block $label$5 (result i32)
- (br $label$3)
+ (return
+ (i64.const 1073741824)
)
- (block $label$6 (result i32)
- (br $label$3)
+ )
+ (set_global $hangLimit
+ (i32.sub
+ (get_global $hangLimit)
+ (i32.const 1)
)
)
)
- )
- )
- )
- (block $label$7 (result i32)
- (call $func_0)
- )
- (block $label$8 (result i32)
- (f64.store offset=4
- (i32.and
- (tee_local $3
- (f64.eq
- (if (result f64)
- (get_local $0)
- (loop $label$9 (result f64)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
+ (set_local $1
+ (call $deNan64
+ (select
+ (call $deNan64
+ (f64.convert_s/i64
+ (i64.const 286791702)
+ )
+ )
+ (call $deNan64
+ (select
+ (tee_local $1
+ (block $label$44 (result f64)
+ (set_local $1
+ (get_local $1)
+ )
+ (get_local $1)
)
- (return
- (i64.const -8)
+ )
+ (call $deNan64
+ (f64.copysign
+ (call $deNan64
+ (select
+ (f64.const 18445)
+ (f64.const 251925010)
+ (i32.const 286004740)
+ )
+ )
+ (block $label$45 (result f64)
+ (nop)
+ (loop $label$46 (result f64)
+ (block
+ (if
+ (i32.eqz
+ (get_global $hangLimit)
+ )
+ (return
+ (i64.const -57)
+ )
+ )
+ (set_global $hangLimit
+ (i32.sub
+ (get_global $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (get_local $1)
+ )
+ )
)
)
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
+ (br_if $label$38
+ (i32.reinterpret/f32
+ (f32.const -9223372036854775808)
+ )
+ (i32.eqz
+ (get_local $0)
)
)
)
- (block $label$10 (result f64)
- (br $label$9)
- )
)
- (block $label$11 (result f64)
- (call $func_2
- (f64.load offset=3 align=1
- (i32.and
- (loop $label$12 (result i32)
+ (tee_local $0
+ (if (result i32)
+ (i32.trunc_u/f64
+ (get_local $1)
+ )
+ (block $label$41 (result i32)
+ (nop)
+ (br $label$40)
+ )
+ (loop $label$42 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (get_global $hangLimit)
+ )
+ (return
+ (i64.const 2241978001322417182)
+ )
+ )
+ (set_global $hangLimit
+ (i32.sub
+ (get_global $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block (result i32)
+ (loop $label$43
(block
(if
(i32.eqz
(get_global $hangLimit)
)
(return
- (i64.const 6425)
+ (i64.const -8796093022208)
)
)
(set_global $hangLimit
@@ -494,96 +186,55 @@
)
)
)
- (get_local $3)
- )
- (i32.const 31)
- )
- )
- (loop $label$13 (result f32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (i64.const 26)
+ (set_local $0
+ (select
+ (i32.const -70)
+ (get_local $0)
+ (get_local $0)
+ )
)
)
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
+ (br_if $label$42
+ (select
+ (get_local $0)
+ (get_local $0)
+ (get_local $0)
)
)
- )
- (f32.const 1.0365662579528108e-37)
- )
- (i64.load8_s offset=3
- (i32.and
- (select
- (i32.const -2)
- (i32.const -128)
- (get_local $3)
+ (f64.le
+ (call $deNan64
+ (f64.min
+ (get_local $1)
+ (get_local $1)
+ )
+ )
+ (get_local $1)
)
- (i32.const 31)
)
)
)
)
)
- (loop $label$14 (result f64)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (i64.const 262144)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block $label$15 (result f64)
- (return
- (i64.const 4294967269)
- )
- )
- )
)
)
- (i32.const 31)
)
- (call $deNan64
- (f64.copysign
- (call $deNan64
- (f64.reinterpret/i64
- (i64.ctz
- (i64.trunc_u/f32
- (f32.load offset=4
- (i32.and
- (get_local $0)
- (i32.const 31)
- )
- )
- )
+ (if
+ (i32.const 1142375256)
+ (block $label$47
+ (block $label$48
+ (nop)
+ (block $label$49
+ (set_local $0
+ (i32.const -1)
)
- )
- )
- (f64.load offset=3 align=2
- (i32.and
- (loop $label$16 (result i32)
+ (loop $label$50
(block
(if
(i32.eqz
(get_global $hangLimit)
)
(return
- (i64.const 1011068128099120680)
+ (i64.const 8589934592)
)
)
(set_global $hangLimit
@@ -593,329 +244,294 @@
)
)
)
- (block $label$17 (result i32)
- (select
- (br_if $label$17
- (get_local $3)
- (i32.clz
- (i64.le_u
- (i64.const -1)
- (i64.const 190)
+ (block $label$51
+ (loop $label$52
+ (block
+ (if
+ (i32.eqz
+ (get_global $hangLimit)
+ )
+ (return
+ (i64.const 15442)
+ )
+ )
+ (set_global $hangLimit
+ (i32.sub
+ (get_global $hangLimit)
+ (i32.const 1)
)
)
)
- (br_if $label$8
- (if (result i32)
- (i32.const 975184941)
- (get_local $3)
- (i32.const 8192)
+ (block
+ (f64.store offset=3 align=4
+ (i32.and
+ (select
+ (i32.const 255)
+ (br_if $label$38
+ (get_local $0)
+ (get_local $0)
+ )
+ (i32.const -4194304)
+ )
+ (i32.const 31)
+ )
+ (get_local $1)
)
- (i32.trunc_s/f32
- (f32.const 1)
+ (br_if $label$52
+ (i32.const 111)
)
+ (nop)
)
- (i32.trunc_s/f32
- (f32.const -1)
+ )
+ (set_local $0
+ (block $label$53 (result i32)
+ (set_local $0
+ (i32.const -512)
+ )
+ (br $label$47)
)
)
)
)
- (i32.const 31)
+ )
+ )
+ (block $label$54
+ (set_local $1
+ (f64.const 36028797018963968)
)
)
)
- )
- )
- (block $label$18
- (set_local $2
- (tee_local $1
- (call $deNan64
+ (if
+ (i32.eqz
(select
- (loop $label$20 (result f64)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
+ (get_local $0)
+ (block $label$60 (result i32)
+ (br_if $label$37
+ (i32.eqz
+ (i32.const -4194304)
+ )
+ )
+ (select
+ (br_if $label$60
+ (tee_local $0
+ (get_local $0)
)
- (return
- (i64.const 1177723566525259122)
+ (i32.eqz
+ (block $label$61 (result i32)
+ (nop)
+ (get_local $0)
+ )
)
)
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
+ (if (result i32)
+ (i32.eqz
+ (if (result i32)
+ (i32.eqz
+ (i64.ne
+ (i64.const -1024)
+ (i64.load32_u offset=4
+ (i32.and
+ (get_local $0)
+ (i32.const 31)
+ )
+ )
+ )
+ )
+ (block $label$62 (result i32)
+ (set_local $0
+ (get_local $0)
+ )
+ (loop $label$63 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (get_global $hangLimit)
+ )
+ (return
+ (i64.const -95)
+ )
+ )
+ (set_global $hangLimit
+ (i32.sub
+ (get_global $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block (result i32)
+ (set_local $1
+ (get_local $1)
+ )
+ (br_if $label$63
+ (get_local $0)
+ )
+ (i32.const 48)
+ )
+ )
+ )
+ (block $label$64 (result i32)
+ (if
+ (i32.eqz
+ (i32.wrap/i64
+ (loop $label$65 (result i64)
+ (block
+ (if
+ (i32.eqz
+ (get_global $hangLimit)
+ )
+ (return
+ (i64.const 470816280)
+ )
+ )
+ (set_global $hangLimit
+ (i32.sub
+ (get_global $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (i64.const 108)
+ )
+ )
+ )
+ (nop)
+ (drop
+ (f64.const 2075497995636940095578691e82)
+ )
+ )
+ (loop $label$66 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (get_global $hangLimit)
+ )
+ (return
+ (i64.const -27)
+ )
+ )
+ (set_global $hangLimit
+ (i32.sub
+ (get_global $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block (result i32)
+ (nop)
+ (br_if $label$66
+ (i32.const -36)
+ )
+ (get_local $0)
+ )
+ )
+ )
+ )
)
- )
- )
- (f64.const -nan:0xfffffffffff85)
- )
- (call $func_2
- (f64.const 1024)
- (if (result f32)
- (i32.eqz
- (select
- (i32.const -536870912)
- (i32.const 264)
- (i32.load16_s offset=22 align=1
+ (block $label$67 (result i32)
+ (f64.store offset=1
(i32.and
- (get_local $3)
+ (br_if $label$38
+ (get_local $0)
+ (i32.eqz
+ (i32.reinterpret/f32
+ (f32.const 2706.389892578125)
+ )
+ )
+ )
(i32.const 31)
)
+ (f64.const 68719476736)
)
+ (i32.const 25)
)
+ (i32.const 1449089114)
)
- (block $label$21 (result f32)
- (br $label$18)
- )
- (block $label$22 (result f32)
- (br $label$18)
- )
- )
- (call $func_4)
- )
- (i32.shr_u
- (tee_local $3
(get_local $0)
)
- (i64.ge_u
- (select
- (call $func_4)
- (if (result i64)
- (get_local $3)
- (i64.const 5425231479272327498)
- (i64.const 29)
- )
- (call $func_0)
- )
- (br_if $label$0
- (call_indirect $FUNCSIG$j
- (i32.const 1)
- )
- (i32.eqz
- (block $label$19 (result i32)
+ )
+ (select
+ (i32.const -4)
+ (i32.eqz
+ (loop $label$58 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (get_global $hangLimit)
+ )
(return
- (i64.const -9223372036854775808)
+ (i64.const 303239698)
+ )
+ )
+ (set_global $hangLimit
+ (i32.sub
+ (get_global $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block $label$59 (result i32)
+ (br_if $label$38
+ (i32.const 268435456)
+ (i32.eqz
+ (br_if $label$59
+ (get_local $0)
+ (get_local $0)
+ )
)
)
)
)
)
- )
- )
- )
- )
- )
- )
- (return
- (i64.const 16777216)
- )
- )
- )
- (get_local $3)
- (block $label$1 (result i32)
- (i32.trunc_u/f32
- (block $label$2 (result f32)
- (return
- (i64.const 263950)
- )
- )
- )
- )
- )
- (i32.const 31)
- )
- (i32.load16_u offset=22 align=1
- (i32.and
- (select
- (i32.const -128)
- (loop $label$32 (result i32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (i64.const 4096)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (if (result i32)
- (loop $label$33 (result i32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (i64.const 24)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block $label$34 (result i32)
- (i32.load8_u offset=4
- (i32.and
- (get_local $3)
- (i32.const 31)
- )
- )
- )
- )
- (i32.mul
- (i32.reinterpret/f32
- (call $deNan32
- (f32.copysign
- (f32.const 0)
- (f32.const -2147483648)
- )
- )
- )
- (block $label$35 (result i32)
- (i32.trunc_u/f64
- (f64.const 88)
- )
- )
- )
- (block $label$36 (result i32)
- (br $label$32)
- )
- )
- )
- (select
- (tee_local $0
- (i32.load8_s offset=22
- (i32.and
- (tee_local $3
- (if (result i32)
- (i32.const 30581)
- (i32.const 65536)
- (select
- (tee_local $3
- (i32.const 1)
- )
- (block $label$28 (result i32)
- (get_local $3)
+ (tee_local $0
+ (tee_local $0
+ (tee_local $0
+ (i32.const 975322409)
+ )
+ )
)
- (i32.const 127)
)
)
)
- (i32.const 31)
- )
- )
- )
- (loop $label$29 (result i32)
- (block
- (if
- (i32.eqz
- (get_global $hangLimit)
- )
- (return
- (i64.const 137438953472)
- )
- )
- (set_global $hangLimit
- (i32.sub
- (get_global $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block $label$30 (result i32)
- (block $label$31 (result i32)
- (f32.eq
- (f32.const 1048576)
- (f32.const -nan:0x7fffe5)
- )
- )
- )
- )
- (block $label$23 (result i32)
- (if (result i32)
- (i32.eqz
- (block $label$24 (result i32)
- (return
- (i64.const -128)
- )
- )
- )
- (block $label$25 (result i32)
- (return
- (i64.const 55)
- )
- )
- (br_if $label$23
- (br_if $label$23
- (block $label$27 (result i32)
- (select
- (get_local $3)
- (i32.const 134217728)
- (get_local $3)
- )
- )
- (i32.eqz
- (i32.lt_s
- (i64.ne
- (i64.const -1)
- (i64.load16_u offset=22 align=1
- (i32.and
- (block $label$26 (result i32)
- (return
- (i64.const -40)
- )
+ (block $label$68
+ (block $label$69
+ (br_if $label$39
+ (block $label$70 (result i32)
+ (if
+ (i32.clz
+ (br_if $label$38
+ (get_local $0)
+ (get_local $0)
)
- (i32.const 31)
)
+ (block $label$71
+ (set_local $1
+ (f64.const 1.1754943508222875e-38)
+ )
+ (set_local $0
+ (i32.const 32)
+ )
+ )
+ (nop)
)
+ (get_local $0)
)
- (get_local $0)
)
+ (nop)
)
+ (nop)
)
- (tee_local $3
- (i32.trunc_s/f64
- (get_local $1)
- )
+ (block $label$72
+ (nop)
)
)
)
)
)
- )
- (i32.const 31)
- )
- )
- )
- (if
- (i32.trunc_u/f32
- (f32.const 1.5356363518406743e-37)
- )
- (block $label$48
- (br_if $label$48
- (i32.eqz
- (select
- (get_local $3)
- (get_local $3)
- (get_local $3)
- )
+ (get_local $0)
)
)
)
- (nop)
)
- (i64.const -1)
)
)
(func $hangLimitInitializer