summaryrefslogtreecommitdiff
path: root/test/lit/wasm-split/passive.wast
blob: d335d79a831a9a66ce1de990ba5ea9ce402c4c56 (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
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.

;; RUN: wasm-split %s -all --split-funcs=second-in-table -g -o1 %t.1.wasm -o2 %t.2.wasm
;; RUN: wasm-dis -all %t.1.wasm | filecheck %s --check-prefix PRIMARY
;; RUN: wasm-dis -all %t.2.wasm | filecheck %s --check-prefix SECONDARY

(module
 (type $func-array (array (mut funcref)))

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

 ;; PRIMARY:      (import "placeholder" "0" (func $placeholder_0 (type $0)))

 ;; PRIMARY:      (table $table 3 funcref)
 (table $table 3 funcref)

 ;; PRIMARY:      (table $1 1 funcref)

 ;; PRIMARY:      (elem $passive func $in-table $1)
 (elem $passive func $in-table $second-in-table)

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

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

 ;; PRIMARY:      (export "table_1" (table $1))

 ;; PRIMARY:      (func $in-table (type $0)
 ;; PRIMARY-NEXT: )
 (func $in-table
  ;; This is in a passive segment, but it is in the main module so we need no
  ;; special handling.
 )

 ;; SECONDARY:      (type $0 (func))

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

 ;; SECONDARY:      (elem $0 (i32.const 0) $second-in-table)

 ;; SECONDARY:      (func $second-in-table (type $0)
 ;; SECONDARY-NEXT: )
 (func $second-in-table
  ;; This is in a passive segment, and it is in the secondary module, so we will
  ;; handle it by adding a trampoline from the segment as a new function "$1".
 )
)
;; PRIMARY:      (func $1 (type $0)
;; PRIMARY-NEXT:  (call_indirect $1 (type $0)
;; PRIMARY-NEXT:   (i32.const 0)
;; PRIMARY-NEXT:  )
;; PRIMARY-NEXT: )