summaryrefslogtreecommitdiff
path: root/test/wasm-only.fromasm
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-05-18 10:47:23 -0700
committerGitHub <noreply@github.com>2017-05-18 10:47:23 -0700
commit9c6b8e0f626ade30cee113294019edbdbf29dd36 (patch)
treeda088ba8eef1d3d20f1f0e9fa3b5af2c8dbeba1d /test/wasm-only.fromasm
parentbb1c44a3f975bf8fb72216b9c04bcd34e31bd815 (diff)
downloadbinaryen-9c6b8e0f626ade30cee113294019edbdbf29dd36.tar.gz
binaryen-9c6b8e0f626ade30cee113294019edbdbf29dd36.tar.bz2
binaryen-9c6b8e0f626ade30cee113294019edbdbf29dd36.zip
Validate finalization (#1014)
* validate that types are properly finalized, when in pass-debug mode (BINARYEN_PASS_DEBUG env var): check after each pass is run that the type of each node is equal to the proper type (when finalizing it, i.e., fully recomputing the type). * fix many fuzz bugs found by that. * in particular, fix dce bugs with type changes not being fully updated during code removal. add a new TypeUpdater helper class that lets a pass update types efficiently, by the helper tracking deps between blocks and branches etc., and updating/propagating type changes only as necessary.
Diffstat (limited to 'test/wasm-only.fromasm')
-rw-r--r--test/wasm-only.fromasm331
1 files changed, 331 insertions, 0 deletions
diff --git a/test/wasm-only.fromasm b/test/wasm-only.fromasm
index 6fa30ba12..3a98e84a3 100644
--- a/test/wasm-only.fromasm
+++ b/test/wasm-only.fromasm
@@ -365,6 +365,325 @@
)
)
)
+ (func $switch64TOOMUCH (param $0 i64) (result i32)
+ (local $1 i32)
+ (local $2 i64)
+ (block $switch-default
+ (if
+ (i64.ne
+ (tee_local $2
+ (get_local $0)
+ )
+ (i64.const -9223372036854775808)
+ )
+ (br_if $switch-default
+ (i64.ne
+ (get_local $2)
+ (i64.const 4611686018427387904)
+ )
+ )
+ )
+ (return
+ (i32.const 40)
+ )
+ )
+ (block $switch-default4
+ (if
+ (i32.ne
+ (tee_local $1
+ (i32.const 100)
+ )
+ (i32.const 214748364)
+ )
+ (br_if $switch-default4
+ (i32.ne
+ (get_local $1)
+ (i32.const 107374182)
+ )
+ )
+ )
+ (return
+ (i32.const 41)
+ )
+ )
+ (block $switch5
+ (if
+ (i64.ne
+ (get_local $0)
+ (i64.const -9223372036854775808)
+ )
+ (br_if $switch5
+ (i64.ne
+ (get_local $0)
+ (i64.const 4611686018427387904)
+ )
+ )
+ )
+ (return
+ (i32.const 42)
+ )
+ )
+ (block $switch8
+ (if
+ (i32.ne
+ (tee_local $1
+ (i32.const 100)
+ )
+ (i32.const 214748364)
+ )
+ (br_if $switch8
+ (i32.ne
+ (get_local $1)
+ (i32.const 107374182)
+ )
+ )
+ )
+ (return
+ (i32.const 43)
+ )
+ )
+ (i32.const 44)
+ )
+ (func $_memchr (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
+ (local $3 i32)
+ (local $4 i32)
+ (local $5 i32)
+ (set_local $5
+ (i32.and
+ (get_local $1)
+ (i32.const 255)
+ )
+ )
+ (block $label$break$L8
+ (block $__rjti$2
+ (if
+ (i32.and
+ (tee_local $4
+ (i32.ne
+ (get_local $2)
+ (i32.const 0)
+ )
+ )
+ (i32.ne
+ (i32.and
+ (get_local $0)
+ (i32.const 3)
+ )
+ (i32.const 0)
+ )
+ )
+ (block
+ (set_local $4
+ (i32.and
+ (get_local $1)
+ (i32.const 255)
+ )
+ )
+ (set_local $3
+ (get_local $2)
+ )
+ (set_local $2
+ (get_local $0)
+ )
+ (loop $while-in
+ (if
+ (i32.eq
+ (i32.load8_u
+ (get_local $2)
+ )
+ (i32.and
+ (get_local $4)
+ (i32.const 255)
+ )
+ )
+ (block
+ (set_local $0
+ (get_local $3)
+ )
+ (br $__rjti$2)
+ )
+ )
+ (br_if $while-in
+ (i32.and
+ (tee_local $0
+ (i32.ne
+ (tee_local $3
+ (i32.add
+ (get_local $3)
+ (i32.const -1)
+ )
+ )
+ (i32.const 0)
+ )
+ )
+ (i32.ne
+ (i32.and
+ (tee_local $2
+ (i32.add
+ (get_local $2)
+ (i32.const 1)
+ )
+ )
+ (i32.const 3)
+ )
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ )
+ (block
+ (set_local $3
+ (get_local $2)
+ )
+ (set_local $2
+ (get_local $0)
+ )
+ (set_local $0
+ (get_local $4)
+ )
+ )
+ )
+ (if
+ (get_local $0)
+ (block
+ (set_local $0
+ (get_local $3)
+ )
+ (br $__rjti$2)
+ )
+ (set_local $0
+ (i32.const 0)
+ )
+ )
+ (br $label$break$L8)
+ )
+ (if
+ (i32.ne
+ (i32.load8_u
+ (get_local $2)
+ )
+ (tee_local $1
+ (i32.and
+ (get_local $1)
+ (i32.const 255)
+ )
+ )
+ )
+ (block
+ (set_local $3
+ (i32.mul
+ (get_local $5)
+ (i32.const 16843009)
+ )
+ )
+ (block $__rjto$0
+ (block $__rjti$0
+ (br_if $__rjti$0
+ (i32.le_u
+ (get_local $0)
+ (i32.const 3)
+ )
+ )
+ (loop $while-in3
+ (if
+ (i32.eqz
+ (i32.and
+ (i32.xor
+ (i32.and
+ (tee_local $4
+ (i32.xor
+ (i32.load
+ (get_local $2)
+ )
+ (get_local $3)
+ )
+ )
+ (i32.const -2139062144)
+ )
+ (i32.const -2139062144)
+ )
+ (i32.add
+ (get_local $4)
+ (i32.const -16843009)
+ )
+ )
+ )
+ (block
+ (set_local $2
+ (i32.add
+ (get_local $2)
+ (i32.const 4)
+ )
+ )
+ (br_if $while-in3
+ (i32.gt_u
+ (tee_local $0
+ (i32.add
+ (get_local $0)
+ (i32.const -4)
+ )
+ )
+ (i32.const 3)
+ )
+ )
+ (br $__rjti$0)
+ )
+ )
+ )
+ (br $__rjto$0)
+ )
+ (if
+ (i32.eqz
+ (get_local $0)
+ )
+ (block
+ (set_local $0
+ (i32.const 0)
+ )
+ (br $label$break$L8)
+ )
+ )
+ )
+ (loop $while-in5
+ (br_if $label$break$L8
+ (i32.eq
+ (i32.load8_u
+ (get_local $2)
+ )
+ (i32.and
+ (get_local $1)
+ (i32.const 255)
+ )
+ )
+ )
+ (set_local $2
+ (i32.add
+ (get_local $2)
+ (i32.const 1)
+ )
+ )
+ (br_if $while-in5
+ (tee_local $0
+ (i32.add
+ (get_local $0)
+ (i32.const -1)
+ )
+ )
+ )
+ (set_local $0
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ )
+ (select
+ (get_local $2)
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
(func $keepAlive
(call $loads)
(call $stores)
@@ -410,6 +729,18 @@
(i32.const 0)
(i32.const 0)
)
+ (drop
+ (call $_memchr
+ (i32.const 0)
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+ (drop
+ (call $switch64TOOMUCH
+ (i64.const 0)
+ )
+ )
)
(func $legalstub$illegalParam (param $0 i32) (param $1 i32) (param $2 i32) (param $3 f64)
(call $illegalParam