summaryrefslogtreecommitdiff
path: root/test/lit/wasm-split/jspi-secondary-export.wast
blob: 4358634384966a8da584091b7adb8719a6179646 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.1.wasm -o2 %t.2.wasm --jspi --split-funcs=foo,bar
;; RUN: wasm-dis %t.1.wasm | filecheck %s --check-prefix PRIMARY
;; RUN: wasm-dis %t.2.wasm | filecheck %s --check-prefix SECONDARY

;; Ensure exported functions are not moved to secondary module when JSPI is
;; enabled.

(module
 ;; PRIMARY:      (type $0 (func (param i32) (result i32)))

 ;; PRIMARY:      (type $1 (func))

 ;; PRIMARY:      (import "env" "__load_secondary_module" (func $fimport$0))

 ;; PRIMARY:      (import "placeholder" "0" (func $placeholder_0 (param i32) (result i32)))

 ;; PRIMARY:      (global $global$0 (mut i32) (i32.const 0))

 ;; PRIMARY:      (table $0 1 funcref)

 ;; PRIMARY:      (elem $0 (i32.const 0) $placeholder_0)

 ;; PRIMARY:      (export "foo" (func $foo))
 (export "foo" (func $foo))
 ;; PRIMARY:      (export "load_secondary_module_status" (global $global$0))

 ;; PRIMARY:      (export "%table" (table $0))

 ;; PRIMARY:      (func $foo (param $0 i32) (result i32)
 ;; PRIMARY-NEXT:  (if
 ;; PRIMARY-NEXT:   (i32.eqz
 ;; PRIMARY-NEXT:    (global.get $global$0)
 ;; PRIMARY-NEXT:   )
 ;; PRIMARY-NEXT:   (then
 ;; PRIMARY-NEXT:    (call $fimport$0)
 ;; PRIMARY-NEXT:   )
 ;; PRIMARY-NEXT:  )
 ;; PRIMARY-NEXT:  (call_indirect (type $0)
 ;; PRIMARY-NEXT:   (local.get $0)
 ;; PRIMARY-NEXT:   (i32.const 0)
 ;; PRIMARY-NEXT:  )
 ;; PRIMARY-NEXT: )
 (func $foo (param i32) (result i32)
  (call $bar (local.get 0))
 )
 ;; SECONDARY:      (type $0 (func (param i32) (result i32)))

 ;; SECONDARY:      (import "primary" "%table" (table $timport$0 1 funcref))

 ;; SECONDARY:      (elem $0 (i32.const 0) $bar)

 ;; SECONDARY:      (func $bar (param $0 i32) (result i32)
 ;; SECONDARY-NEXT:  (i32.const 0)
 ;; SECONDARY-NEXT: )
 (func $bar (param i32) (result i32)
  (i32.const 0)
 )
)