summaryrefslogtreecommitdiff
path: root/test/lit/wasm-split
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/wasm-split')
-rw-r--r--test/lit/wasm-split/basic.wast1
-rw-r--r--test/lit/wasm-split/initial-table-used.wast22
-rw-r--r--test/lit/wasm-split/initial-table.wast3
-rw-r--r--test/lit/wasm-split/jspi-secondary-export.wast2
-rw-r--r--test/lit/wasm-split/jspi.wast2
-rw-r--r--test/lit/wasm-split/minimized-exports.wast15
-rw-r--r--test/lit/wasm-split/module-names.wast2
-rw-r--r--test/lit/wasm-split/name-collision.wast14
-rw-r--r--test/lit/wasm-split/passive.wast4
-rw-r--r--test/lit/wasm-split/ref.func.wast8
-rw-r--r--test/lit/wasm-split/segments.wast31
11 files changed, 81 insertions, 23 deletions
diff --git a/test/lit/wasm-split/basic.wast b/test/lit/wasm-split/basic.wast
index 99bf17260..1390f1a63 100644
--- a/test/lit/wasm-split/basic.wast
+++ b/test/lit/wasm-split/basic.wast
@@ -174,7 +174,6 @@
;; KEEP-BOTH-PRIMARY-NEXT: )
;; KEEP-BOTH-SECONDARY: (module
-;; KEEP-BOTH-SECONDARY-NEXT: (import "primary" "%table" (table $table 1 1 funcref))
;; KEEP-BOTH-SECONDARY-NEXT: )
;; SPLIT-BAR-SUPERSEDE: warning: function bar was to be kept in primary module. However it will now be split out into secondary module.
diff --git a/test/lit/wasm-split/initial-table-used.wast b/test/lit/wasm-split/initial-table-used.wast
new file mode 100644
index 000000000..23ae068c6
--- /dev/null
+++ b/test/lit/wasm-split/initial-table-used.wast
@@ -0,0 +1,22 @@
+;; Test that the --initial-table flag works as expected when the secondary
+;; module uses the table.
+
+;; RUN: wasm-split %s --instrument --initial-table=1234 -S | filecheck %s
+
+;; RUN: wasm-split %s -g -o1 %t.1.wasm -o2 %t.2.wasm --split-funcs=use-table --initial-table=1234
+;; RUN: wasm-dis %t.1.wasm | filecheck %s
+;; RUN: wasm-dis %t.2.wasm | filecheck %s
+
+;; CHECK: (table $table 1234 funcref)
+
+(module
+ (table $table 3 funcref)
+ (func $use-table
+ (call_indirect
+ (i32.const 0)
+ )
+ )
+ (func $use-use-table
+ (call $use-table)
+ )
+)
diff --git a/test/lit/wasm-split/initial-table.wast b/test/lit/wasm-split/initial-table.wast
index 534f7f3a9..cd2de4c55 100644
--- a/test/lit/wasm-split/initial-table.wast
+++ b/test/lit/wasm-split/initial-table.wast
@@ -1,10 +1,9 @@
-;; Test that the --initial-table flag works as expected
+;; Test that the --initial-table flag works as expected.
;; RUN: wasm-split %s --instrument --initial-table=1234 -S | filecheck %s
;; RUN: wasm-split %s -g -o1 %t.1.wasm -o2 %t.2.wasm --initial-table=1234
;; RUN: wasm-dis %t.1.wasm | filecheck %s
-;; RUN: wasm-dis %t.2.wasm | filecheck %s
;; CHECK: (table $table 1234 funcref)
diff --git a/test/lit/wasm-split/jspi-secondary-export.wast b/test/lit/wasm-split/jspi-secondary-export.wast
index 553f0abd1..6e89bab28 100644
--- a/test/lit/wasm-split/jspi-secondary-export.wast
+++ b/test/lit/wasm-split/jspi-secondary-export.wast
@@ -48,8 +48,6 @@
;; SECONDARY: (import "primary" "%table" (table $timport$0 1 funcref))
- ;; SECONDARY: (import "primary" "load_secondary_module_status" (global $gimport$0 (mut i32)))
-
;; SECONDARY: (elem $0 (i32.const 0) $bar)
;; SECONDARY: (func $bar (param $0 i32) (result i32)
diff --git a/test/lit/wasm-split/jspi.wast b/test/lit/wasm-split/jspi.wast
index e7d6814b7..d86775c82 100644
--- a/test/lit/wasm-split/jspi.wast
+++ b/test/lit/wasm-split/jspi.wast
@@ -48,8 +48,6 @@
;; SECONDARY: (import "primary" "%table" (table $timport$0 1 funcref))
- ;; SECONDARY: (import "primary" "load_secondary_module_status" (global $gimport$0 (mut i32)))
-
;; SECONDARY: (import "primary" "foo" (func $foo (param i32) (result i32)))
;; SECONDARY: (elem $0 (i32.const 0) $bar)
diff --git a/test/lit/wasm-split/minimized-exports.wast b/test/lit/wasm-split/minimized-exports.wast
index 4ee73a35b..e938f4ab6 100644
--- a/test/lit/wasm-split/minimized-exports.wast
+++ b/test/lit/wasm-split/minimized-exports.wast
@@ -1,23 +1,34 @@
-;; RUN: wasm-split %s --keep-funcs=foo,bar --export-prefix='%' -o1 %t.1.wasm -o2 %t.2.wasm
+;; RUN: wasm-split %s --keep-funcs=foo,bar --export-prefix='%' -o1 %t.1.wasm -o2 %t.2.wasm --no-placeholders
;; RUN: wasm-dis %t.1.wasm | filecheck %s --check-prefix PRIMARY
;; RUN: wasm-dis %t.2.wasm | filecheck %s --check-prefix SECONDARY
;; PRIMARY: (module
;; PRIMARY-NEXT: (type $0 (func))
+;; PRIMARY-NEXT: (table $0 1 funcref)
+;; PRIMARY-NEXT: (elem $0 (table $0) (i32.const 0) funcref (item (ref.null nofunc)))
+;; PRIMARY-NEXT: (export "baz" (func $2)
;; PRIMARY-NEXT: (export "%a" (func $1))
;; PRIMARY-NEXT: (export "%b" (func $0))
+;; PRIMARY-NEXT: (export "%table" (table $0))
;; PRIMARY-NEXT: (func $0
;; PRIMARY-NEXT: (nop)
;; PRIMARY-NEXT: )
;; PRIMARY-NEXT: (func $1
;; PRIMARY-NEXT: (nop)
;; PRIMARY-NEXT: )
+;; PRIMARY-NEXT: (func $2
+;; PRIMARY-NEXT: (call_indirect (type $0)
+;; PRIMARY-NEXT: (i32.const 0)
+;; PRIMARY-NEXT: )
+;; PRIMARY-NEXT: )
;; PRIMARY-NEXT: )
;; SECONDARY: (module
;; SECONDARY-NEXT: (type $0 (func))
+;; SECONDARY-NEXT: (import "primary" "%table" (table $timport$0 1 funcref))
;; SECONDARY-NEXT: (import "primary" "%a" (func $fimport$0))
;; SECONDARY-NEXT: (import "primary" "%b" (func $fimport$1))
+;; SECONDARY-NEXT: (elem $0 (i32.const 0) $0)
;; SECONDARY-NEXT: (func $0
;; SECONDARY-NEXT: (call $fimport$1)
;; SECONDARY-NEXT: (call $fimport$0)
@@ -31,7 +42,7 @@
(func $bar
(nop)
)
- (func $baz
+ (func $baz (export "baz")
(call $foo)
(call $bar)
)
diff --git a/test/lit/wasm-split/module-names.wast b/test/lit/wasm-split/module-names.wast
index 9ed80ae7c..96dc96c3b 100644
--- a/test/lit/wasm-split/module-names.wast
+++ b/test/lit/wasm-split/module-names.wast
@@ -16,7 +16,7 @@
(module
(func $foo
- (nop)
+ (call $bar)
)
(func $bar
(nop)
diff --git a/test/lit/wasm-split/name-collision.wast b/test/lit/wasm-split/name-collision.wast
index ccb615906..bb227f415 100644
--- a/test/lit/wasm-split/name-collision.wast
+++ b/test/lit/wasm-split/name-collision.wast
@@ -2,7 +2,7 @@
;; non-function exports would result in the wrong import names being used in the
;; secondary module.
-;; RUN: wasm-split %s -o1 %t.1.wasm -o2 %t.2.wasm
+;; RUN: wasm-split %s -o1 %t.1.wasm -o2 %t.2.wasm --split-funcs=use
;; RUN: wasm-dis %t.2.wasm | filecheck %s
;; CHECK-NOT: (import "primary" "memory" (table
@@ -13,4 +13,16 @@
(memory $collide 1 1)
(export "table" (table $collide))
(export "memory" (memory $collide))
+ (func $use
+ (call_indirect
+ (i32.const 0)
+ )
+ (i32.store
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+ (func $use-use
+ (call $use)
+ )
)
diff --git a/test/lit/wasm-split/passive.wast b/test/lit/wasm-split/passive.wast
index 322288201..743d7d14e 100644
--- a/test/lit/wasm-split/passive.wast
+++ b/test/lit/wasm-split/passive.wast
@@ -37,9 +37,7 @@
;; SECONDARY: (import "primary" "table_1" (table $timport$0 1 funcref))
- ;; SECONDARY: (import "primary" "table" (table $table 3 funcref))
-
- ;; SECONDARY: (elem $0 (table $timport$0) (i32.const 0) func $second-in-table)
+ ;; SECONDARY: (elem $0 (i32.const 0) $second-in-table)
;; SECONDARY: (func $second-in-table (type $0)
;; SECONDARY-NEXT: (nop)
diff --git a/test/lit/wasm-split/ref.func.wast b/test/lit/wasm-split/ref.func.wast
index 39cce5dea..d9a30890a 100644
--- a/test/lit/wasm-split/ref.func.wast
+++ b/test/lit/wasm-split/ref.func.wast
@@ -65,15 +65,9 @@
;; SECONDARY: (import "primary" "table_2" (table $timport$0 2 funcref))
- ;; SECONDARY: (import "primary" "table" (table $table 1 1 funcref))
-
- ;; SECONDARY: (import "primary" "global" (global $glob1 (ref func)))
-
- ;; SECONDARY: (import "primary" "global_4" (global $glob2 (ref func)))
-
;; SECONDARY: (import "primary" "prime" (func $prime (type $0)))
- ;; SECONDARY: (elem $0 (table $timport$0) (i32.const 0) func $second $second-in-table)
+ ;; SECONDARY: (elem $0 (i32.const 0) $second $second-in-table)
;; SECONDARY: (elem declare func $prime)
diff --git a/test/lit/wasm-split/segments.wast b/test/lit/wasm-split/segments.wast
index 7a14afc42..215afd247 100644
--- a/test/lit/wasm-split/segments.wast
+++ b/test/lit/wasm-split/segments.wast
@@ -1,6 +1,6 @@
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
-;; RUN: wasm-split %s -all --keep-funcs=foo -g -o1 %t.1.wasm -o2 %t.2.wasm
+;; RUN: wasm-split %s -all --keep-funcs=use-funcs -g -o1 %t.1.wasm -o2 %t.2.wasm
;; RUN: wasm-dis %t.1.wasm | filecheck %s --check-prefix PRIMARY
;; RUN: wasm-dis %t.2.wasm | filecheck %s --check-prefix SECONDARY
@@ -14,17 +14,25 @@
;; PRIMARY: (type $elem-array (array externref))
(type $elem-array (array externref))
+ ;; PRIMARY: (import "placeholder" "0" (func $placeholder_0))
+
;; PRIMARY: (memory $mem 0)
(memory $mem 0)
;; PRIMARY: (data $data "hello world")
(data $data "hello world")
+ ;; PRIMARY: (table $0 1 funcref)
+
;; PRIMARY: (elem $elem externref)
(elem $elem externref)
+ ;; PRIMARY: (elem $1 (i32.const 0) $placeholder_0)
+
;; PRIMARY: (export "memory" (memory $mem))
+ ;; PRIMARY: (export "table" (table $0))
+
;; PRIMARY: (func $data.drop
;; PRIMARY-NEXT: (data.drop $data)
;; PRIMARY-NEXT: )
@@ -83,7 +91,9 @@
;; SECONDARY: (type $0 (func))
- ;; SECONDARY: (import "primary" "memory" (memory $mem 0))
+ ;; SECONDARY: (import "primary" "table" (table $timport$0 1 funcref))
+
+ ;; SECONDARY: (elem $0 (i32.const 0) $no-segment)
;; SECONDARY: (func $no-segment
;; SECONDARY-NEXT: (nop)
@@ -91,4 +101,21 @@
(func $no-segment
(nop)
)
+
+ ;; PRIMARY: (func $use-funcs
+ ;; PRIMARY-NEXT: (call $data.drop)
+ ;; PRIMARY-NEXT: (call $memory.init)
+ ;; PRIMARY-NEXT: (call $array.new_data)
+ ;; PRIMARY-NEXT: (call $array.new_elem)
+ ;; PRIMARY-NEXT: (call_indirect (type $0)
+ ;; PRIMARY-NEXT: (i32.const 0)
+ ;; PRIMARY-NEXT: )
+ ;; PRIMARY-NEXT: )
+ (func $use-funcs
+ (call $data.drop)
+ (call $memory.init)
+ (call $array.new_data)
+ (call $array.new_elem)
+ (call $no-segment)
+ )
)