summaryrefslogtreecommitdiff
path: root/test/lit/ctor-eval/table.init.wat
blob: 7af2a09c6e1148c163b4f670b942c85c6af1e87a (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
60
61
62
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; RUN: wasm-ctor-eval %s --ctors=run --kept-exports=run --quiet -all -S -o - | filecheck %s

(module
 ;; CHECK:      (type $none_=>_none (func))
 (type $none_=>_none (func))

 ;; CHECK:      (table $table 22 funcref)
 (table $table 22 funcref)

 ;; CHECK:      (elem $init (i32.const 0) $nop)
 (elem $init (i32.const 0) $nop)

 ;; CHECK:      (elem $later func $trap)
 (elem $later $trap)

 (export "run" (func $run))

 (func $run (type $none_=>_none)
  ;; This call can be evalled away (it does nothing as the target is a nop).
  (call_indirect $table (type $none_=>_none)
   (i32.const 0)
  )

  ;; We stop at this table.init, which is not handled yet. The call after it
  ;; should also remain where it is.
  (table.init $table $later
   (i32.const 0)
   (i32.const 0)
   (i32.const 1)
  )
  (call_indirect $table (type $none_=>_none)
   (i32.const 0)
  )
 )

 ;; CHECK:      (export "run" (func $run_3))

 ;; CHECK:      (func $nop (type $none_=>_none)
 ;; CHECK-NEXT:  (nop)
 ;; CHECK-NEXT: )
 (func $nop (type $none_=>_none)
  (nop)
 )

 ;; CHECK:      (func $trap (type $none_=>_none)
 ;; CHECK-NEXT:  (unreachable)
 ;; CHECK-NEXT: )
 (func $trap (type $none_=>_none)
  (unreachable)
 )
)
;; CHECK:      (func $run_3 (type $none_=>_none)
;; CHECK-NEXT:  (table.init $table $later
;; CHECK-NEXT:   (i32.const 0)
;; CHECK-NEXT:   (i32.const 0)
;; CHECK-NEXT:   (i32.const 1)
;; CHECK-NEXT:  )
;; CHECK-NEXT:  (call_indirect $table (type $none_=>_none)
;; CHECK-NEXT:   (i32.const 0)
;; CHECK-NEXT:  )
;; CHECK-NEXT: )