diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/remove-imports.txt | 1 | ||||
-rw-r--r-- | test/passes/remove-imports.wast | 1 | ||||
-rw-r--r-- | test/reduce/destructive.wast | 10 | ||||
-rw-r--r-- | test/reduce/destructive.wast.txt | 9 | ||||
-rw-r--r-- | test/reduce/memory_table.wast | 31 | ||||
-rw-r--r-- | test/reduce/memory_table.wast.txt | 38 | ||||
-rw-r--r-- | test/reduce/simple.wast | 15 | ||||
-rw-r--r-- | test/reduce/simple.wast.txt | 9 |
8 files changed, 114 insertions, 0 deletions
diff --git a/test/passes/remove-imports.txt b/test/passes/remove-imports.txt index f195df7e7..da188e3aa 100644 --- a/test/passes/remove-imports.txt +++ b/test/passes/remove-imports.txt @@ -2,6 +2,7 @@ (type $FUNCSIG$v (func)) (type $FUNCSIG$i (func (result i32))) (type $FUNCSIG$d (func (result f64))) + (import "env" "memBase" (global $import$global0 i32)) (memory $0 1024 1024) (func $nada (type $FUNCSIG$v) (nop) diff --git a/test/passes/remove-imports.wast b/test/passes/remove-imports.wast index bae2e2fc6..d7c883d67 100644 --- a/test/passes/remove-imports.wast +++ b/test/passes/remove-imports.wast @@ -6,6 +6,7 @@ (import $waka "somewhere" "waka") (import $waka-ret "somewhere" "waka-ret" (result i32)) (import $waka-ret-d "somewhere" "waka-ret-d" (result f64)) + (import "env" "memBase" (global i32)) (func $nada (type $FUNCSIG$v) (call $waka) (drop diff --git a/test/reduce/destructive.wast b/test/reduce/destructive.wast new file mode 100644 index 000000000..65786502f --- /dev/null +++ b/test/reduce/destructive.wast @@ -0,0 +1,10 @@ +(module + (export "x" (func $x)) + (func $x (param $x i32) (result i32) + (if (i32.eq (get_local $x) (i32.const 98658746)) + (unreachable) ;; this can be removed destructively, since we do not sent this param + ) + (i32.const 100) + ) +) + diff --git a/test/reduce/destructive.wast.txt b/test/reduce/destructive.wast.txt new file mode 100644 index 000000000..b5776b35e --- /dev/null +++ b/test/reduce/destructive.wast.txt @@ -0,0 +1,9 @@ +(module + (type $0 (func (param i32) (result i32))) + (memory $0 0) + (export "x" (func $0)) + (func $0 (type $0) (param $var$0 i32) (result i32) + (i32.const 100) + ) +) + diff --git a/test/reduce/memory_table.wast b/test/reduce/memory_table.wast new file mode 100644 index 000000000..9e8ad4445 --- /dev/null +++ b/test/reduce/memory_table.wast @@ -0,0 +1,31 @@ +(module + (type $i (func (result i32))) + (memory $0 256 256) + (table 481 481 anyfunc) + (elem (i32.const 0) $f0 $f0 $f1 $f2 $f0 $f3 $f0) + (data (i32.const 0) "p\0bflkj") + (data (i32.const 10960) "1234hello") + (export "f1" (func $f1)) + (export "f2" (func $f2)) + (export "f4" (func $f4)) + (func $f0 (result i32) + (i32.const 1234) + ) + (func $f1 + (i32.store (i32.const 1000) (i32.const 65530)) ;; dead store + ) + (func $f2 (result i32) + (i32.store (i32.const 0) (i32.const 65530)) + (i32.load (i32.const 0)) ;; load the written stuff + ) + (func $f3 (result i32) + (i32.load (i32.const 10964)) ;; load the 'hell' + ) + (func $f4 (result i32) + (i32.add + (call_indirect $i (i32.const 3)) + (call_indirect $i (i32.const 0)) + ) + ) +) + diff --git a/test/reduce/memory_table.wast.txt b/test/reduce/memory_table.wast.txt new file mode 100644 index 000000000..08918c9f3 --- /dev/null +++ b/test/reduce/memory_table.wast.txt @@ -0,0 +1,38 @@ +(module + (type $0 (func (result i32))) + (type $1 (func)) + (table 481 481 anyfunc) + (elem (i32.const 0) $1 $1 $1 $3) + (memory $0 256 256) + (export "f1" (func $2)) + (export "f2" (func $3)) + (export "f4" (func $0)) + (func $0 (type $0) (result i32) + (i32.add + (call_indirect $0 + (i32.const 3) + ) + (call_indirect $0 + (i32.const 0) + ) + ) + ) + (func $1 (type $0) (result i32) + (i32.const 1234) + ) + (func $2 (type $1) + (nop) + ) + (func $3 (type $0) (result i32) + (block $label$0 (result i32) + (i32.store + (i32.const 0) + (i32.const 65530) + ) + (i32.load + (i32.const 0) + ) + ) + ) +) + diff --git a/test/reduce/simple.wast b/test/reduce/simple.wast new file mode 100644 index 000000000..e54424190 --- /dev/null +++ b/test/reduce/simple.wast @@ -0,0 +1,15 @@ +(module + (export "x" (func $x)) + (func $x (result i32) + (nop) + (nop) + (nop) + (drop (i32.const 1234)) + (i32.const 5678) ;; easily reducible + ) + (func $not-exported + (nop) + (unreachable) + ) +) + diff --git a/test/reduce/simple.wast.txt b/test/reduce/simple.wast.txt new file mode 100644 index 000000000..b5209d1bc --- /dev/null +++ b/test/reduce/simple.wast.txt @@ -0,0 +1,9 @@ +(module + (type $0 (func (result i32))) + (memory $0 0) + (export "x" (func $0)) + (func $0 (type $0) (result i32) + (i32.const 5678) + ) +) + |