summaryrefslogtreecommitdiff
path: root/test/dump/reference-types.txt
blob: 9d29b10af25450177b66ab6db42892fc027360c3 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
;;; TOOL: run-objdump
;;; ARGS1: -x

(module
  (table $foo 1 externref)
  (table $bar 1 externref)
  (table $baz 1 funcref)
  (elem (table $baz) (i32.const 0) $f1)
  (elem funcref (ref.null func))

  (func $f1 (result externref)
    i32.const 0
    table.get $foo
  )
  (func (result externref)
    i32.const 0
    table.get $bar
  )

  (func (param externref)
    i32.const 0
    local.get 0
    table.set $foo
  )
  (func (param externref)
    i32.const 0
    local.get 0
    table.set $bar
  )

  (func (result i32)
    ref.null extern
    i32.const 0
    table.grow $foo
  )
  (func (result i32)
    ref.null extern
    i32.const 0
    table.grow $bar
  )

  (func (param externref) (result i32)
    local.get 0
    ref.is_null
  )


  (func (result i32)
    table.size $foo
  )
  (func (result i32)
    table.size $bar
  )
  (func (result i32)
    table.size $baz
  )
)
(;; STDOUT ;;;

reference-types.wasm:	file format wasm 0x1

Section Details:

Type[4]:
 - type[0] () -> externref
 - type[1] (externref) -> nil
 - type[2] () -> i32
 - type[3] (externref) -> i32
Function[10]:
 - func[0] sig=0
 - func[1] sig=0
 - func[2] sig=1
 - func[3] sig=1
 - func[4] sig=2
 - func[5] sig=2
 - func[6] sig=3
 - func[7] sig=2
 - func[8] sig=2
 - func[9] sig=2
Table[3]:
 - table[0] type=externref initial=1
 - table[1] type=externref initial=1
 - table[2] type=funcref initial=1
Elem[2]:
 - segment[0] flags=2 table=2 count=1 - init i32=0
  - elem[0] = ref.func:0
 - segment[1] flags=5 table=0 count=1
  - elem[0] = ref.null funcref
Code[10]:
 - func[0] size=6
 - func[1] size=6
 - func[2] size=8
 - func[3] size=8
 - func[4] size=9
 - func[5] size=9
 - func[6] size=5
 - func[7] size=5
 - func[8] size=5
 - func[9] size=5

Code Disassembly:

00004a func[0]:
 00004b: 41 00                      | i32.const 0
 00004d: 25 00                      | table.get 0
 00004f: 0b                         | end
000051 func[1]:
 000052: 41 00                      | i32.const 0
 000054: 25 01                      | table.get 1
 000056: 0b                         | end
000058 func[2]:
 000059: 41 00                      | i32.const 0
 00005b: 20 00                      | local.get 0
 00005d: 26 00                      | table.set 0
 00005f: 0b                         | end
000061 func[3]:
 000062: 41 00                      | i32.const 0
 000064: 20 00                      | local.get 0
 000066: 26 01                      | table.set 1
 000068: 0b                         | end
00006a func[4]:
 00006b: d0 6f                      | ref.null extern
 00006d: 41 00                      | i32.const 0
 00006f: fc 0f 00                   | table.grow 0
 000072: 0b                         | end
000074 func[5]:
 000075: d0 6f                      | ref.null extern
 000077: 41 00                      | i32.const 0
 000079: fc 0f 01                   | table.grow 1
 00007c: 0b                         | end
00007e func[6]:
 00007f: 20 00                      | local.get 0
 000081: d1                         | ref.is_null
 000082: 0b                         | end
000084 func[7]:
 000085: fc 10 00                   | table.size 0
 000088: 0b                         | end
00008a func[8]:
 00008b: fc 10 01                   | table.size 1
 00008e: 0b                         | end
000090 func[9]:
 000091: fc 10 02                   | table.size 2
 000094: 0b                         | end
;;; STDOUT ;;)