diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/merge/fusing.wat | 39 | ||||
-rw-r--r-- | test/lit/merge/fusing.wat.second | 12 | ||||
-rw-r--r-- | test/lit/merge/memory_data.wat | 13 | ||||
-rw-r--r-- | test/lit/merge/memory_data.wat.second | 5 | ||||
-rw-r--r-- | test/lit/merge/renamings.wat | 6 | ||||
-rw-r--r-- | test/lit/merge/renamings.wat.second | 5 |
6 files changed, 72 insertions, 8 deletions
diff --git a/test/lit/merge/fusing.wat b/test/lit/merge/fusing.wat index 780cf1cf7..2680889e0 100644 --- a/test/lit/merge/fusing.wat +++ b/test/lit/merge/fusing.wat @@ -7,6 +7,9 @@ ;; We test functions and memories here, and not every possible entity in a ;; comprehensive way, since they all go through the same code path. (But we test ;; two to at least verify we differentiate them.) +;; +;; We also test importing memories and tags from another file than the +;; first one, which was initially broken. (module ;; The first two imports here will be resolved to direct calls into the @@ -25,19 +28,31 @@ ;; CHECK: (import "third" "missing" (func $other.missing (type $none_=>_none))) (import "third" "missing" (func $other.missing)) + ;; CHECK: (memory $first.mem 2) + ;; CHECK: (memory $second.mem 2) + ;; CHECK: (tag $exn (param)) + ;; CHECK: (export "foo" (func $first.foo)) ;; CHECK: (export "bar" (func $bar)) ;; CHECK: (export "keepalive" (func $keepalive)) - ;; CHECK: (export "mem" (memory $second.mem)) + ;; CHECK: (export "mem" (memory $first.mem)) + + ;; CHECK: (export "exn" (tag $exn)) - ;; CHECK: (export "foo_4" (func $second.foo)) + ;; CHECK: (export "mem_5" (memory $second.mem)) - ;; CHECK: (export "bar_5" (func $bar_6)) + ;; CHECK: (export "foo_6" (func $second.foo)) + + ;; CHECK: (export "bar_7" (func $bar_6)) + + ;; CHECK: (export "keepalive2" (func $keepalive2)) + + ;; CHECK: (export "keepalive3" (func $keepalive3)) ;; CHECK: (func $first.foo (type $none_=>_none) ;; CHECK-NEXT: (drop @@ -68,7 +83,7 @@ ) ;; CHECK: (func $keepalive (type $none_=>_i32) (result i32) - ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (i32.load $second.mem ;; CHECK-NEXT: (i32.const 10) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -78,6 +93,12 @@ (i32.const 10) ) ) + + (memory $first.mem 2) + + (export "mem" (memory $first.mem)) + + (tag $exn (export "exn")) ) ;; CHECK: (func $second.foo (type $none_=>_none) ;; CHECK-NEXT: (call $first.foo) @@ -92,3 +113,13 @@ ;; CHECK-NEXT: (i32.const 4) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) + +;; CHECK: (func $keepalive2 (type $none_=>_i32) (result i32) +;; CHECK-NEXT: (i32.load $first.mem +;; CHECK-NEXT: (i32.const 10) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) + +;; CHECK: (func $keepalive3 (type $none_=>_none) +;; CHECK-NEXT: (throw $exn) +;; CHECK-NEXT: ) diff --git a/test/lit/merge/fusing.wat.second b/test/lit/merge/fusing.wat.second index 387e57bb4..7ab9cc3f3 100644 --- a/test/lit/merge/fusing.wat.second +++ b/test/lit/merge/fusing.wat.second @@ -25,4 +25,16 @@ (i32.const 4) ) ) + + (import "first" "mem" (memory $other.mem 1)) + + (func $keepalive2 (export "keepalive2") (result i32) + ;; Load from the memory imported from the second module. + (i32.load $other.mem + (i32.const 10) + ) + ) + + (import "first" "exn" (tag $exn)) + (func $keepalive3 (export "keepalive3") (throw $exn)) ) diff --git a/test/lit/merge/memory_data.wat b/test/lit/merge/memory_data.wat index d796dc322..d2235c9ab 100644 --- a/test/lit/merge/memory_data.wat +++ b/test/lit/merge/memory_data.wat @@ -8,15 +8,19 @@ ;; such name changes. (module + ;; CHECK: (import "import" "mem" (memory $imported 10000)) + ;; CHECK: (memory $foo 1) (memory $foo 1) ;; CHECK: (memory $bar 10) (memory $bar 10) + (memory $shared 10) + ;; CHECK: (memory $other 100) - ;; CHECK: (memory $bar_2 1000) + ;; CHECK: (memory $bar_3 1000) ;; CHECK: (data $a (i32.const 0) "a") (data $a (memory $foo) (i32.const 0) "a") @@ -26,14 +30,17 @@ ;; CHECK: (data $a_2 (memory $other) (i32.const 0) "a2") - ;; CHECK: (data $b_2 (memory $bar_2) (i32.const 0) "b2") + ;; CHECK: (data $b_2 (memory $bar_3) (i32.const 0) "b2") ;; CHECK: (export "keepalive" (memory $foo)) (export "keepalive" (memory $foo)) ;; CHECK: (export "keepalive1" (memory $bar)) (export "keepalive1" (memory $bar)) + ) ;; CHECK: (export "keepalive_2" (memory $other)) -;; CHECK: (export "keepalive1_3" (memory $bar_2)) +;; CHECK: (export "keepalive1_3" (memory $bar_3)) + +;; CHECK: (export "keepalive2" (memory $imported)) diff --git a/test/lit/merge/memory_data.wat.second b/test/lit/merge/memory_data.wat.second index 0ea34dbcd..8af6ba36d 100644 --- a/test/lit/merge/memory_data.wat.second +++ b/test/lit/merge/memory_data.wat.second @@ -3,6 +3,9 @@ (memory $bar 1000) + ;; Test that the import remains + (import "import" "mem" (memory $imported 10000)) + (data $a (memory $other) (i32.const 0) "a2") (data $b (memory $bar) (i32.const 0) "b2") @@ -10,4 +13,6 @@ (export "keepalive" (memory $other)) (export "keepalive1" (memory $bar)) + + (export "keepalive2" (memory $imported)) ) diff --git a/test/lit/merge/renamings.wat b/test/lit/merge/renamings.wat index fd01803f2..32a8fb238 100644 --- a/test/lit/merge/renamings.wat +++ b/test/lit/merge/renamings.wat @@ -11,6 +11,8 @@ ;; will be renamed. ;; CHECK: (type $none_=>_none (func)) + ;; CHECK: (type $f64_=>_none (func (param f64))) + ;; CHECK: (type $ref|$array|_=>_none (func (param (ref $array)))) ;; CHECK: (type $i32_=>_none (func (param i32))) @@ -19,7 +21,7 @@ ;; CHECK: (type $f32_=>_none (func (param f32))) - ;; CHECK: (type $f64_=>_none (func (param f64))) + ;; CHECK: (import "elsewhere" "some.tag" (tag $imported (param f64))) ;; CHECK: (global $foo i32 (i32.const 1)) (global $foo i32 (i32.const 1)) @@ -108,6 +110,8 @@ ;; CHECK: (export "keepalive_5" (func $uses.second)) + ;; CHECK: (export "keepalive.tag" (tag $imported)) + ;; CHECK: (export "other-b" (func $other)) ;; CHECK: (func $foo (type $none_=>_none) diff --git a/test/lit/merge/renamings.wat.second b/test/lit/merge/renamings.wat.second index da02e0438..5c3c5d299 100644 --- a/test/lit/merge/renamings.wat.second +++ b/test/lit/merge/renamings.wat.second @@ -5,6 +5,9 @@ (tag $other (param f64)) + ;; Test that the import remains + (import "elsewhere" "some.tag" (tag $imported (param f64))) + (memory $foo 50 60) (memory $other 70 80) @@ -31,6 +34,8 @@ (export "keepalive" (func $uses.second)) + (export "keepalive.tag" (tag $imported)) + ;; Also test having a different name for the export as for the internal ;; thing it refers to, to test we don't assume they are identical. (export "other-b" (func $other)) |