forked from AssemblyScript/assemblyscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathternary.debug.wat
146 lines (146 loc) · 3.25 KB
/
ternary.debug.wat
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
145
146
(module
(type $0 (func))
(type $1 (func (param i32 i32)))
(type $2 (func (param i32 i32 i32) (result i32)))
(type $3 (func (param i32)))
(type $4 (func (param i32 i32 i32 i32)))
(import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32)))
(global $ternary/a (mut i32) (i32.const 0))
(global $~argumentsLength (mut i32) (i32.const 0))
(global $~lib/memory/__data_end i32 (i32.const 44))
(global $~lib/memory/__stack_pointer (mut i32) (i32.const 32812))
(global $~lib/memory/__heap_base i32 (i32.const 32812))
(memory $0 1)
(data $0 (i32.const 12) "\1c\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\02\00\00\00a\00\00\00\00\00\00\00\00\00\00\00")
(table $0 1 1 funcref)
(elem $0 (i32.const 1))
(export "test" (func $ternary/test))
(export "testDropWithTypeMismatch" (func $ternary/testDropWithTypeMismatch))
(export "memory" (memory $0))
(export "testVoidInclTypeMismatch" (func $export:ternary/testVoidInclTypeMismatch))
(start $~start)
(func $start:ternary
i32.const 1
drop
i32.const 1
drop
i32.const 1
drop
i32.const 1
global.set $ternary/a
i32.const 1
global.set $ternary/a
i32.const 1
global.set $ternary/a
)
(func $ternary/test (param $x i32) (param $y i32) (param $z i32) (result i32)
local.get $x
if (result i32)
local.get $y
else
local.get $z
end
return
)
(func $ternary/testDropWithTypeMismatch (param $cond i32)
(local $x i32)
(local $y i32)
global.get $~lib/memory/__stack_pointer
i32.const 4
i32.sub
global.set $~lib/memory/__stack_pointer
call $~stack_check
global.get $~lib/memory/__stack_pointer
i32.const 0
i32.store
i32.const 1
local.set $x
global.get $~lib/memory/__stack_pointer
i32.const 32
local.tee $y
i32.store
local.get $cond
if
local.get $x
drop
else
local.get $y
drop
end
global.get $~lib/memory/__stack_pointer
i32.const 4
i32.add
global.set $~lib/memory/__stack_pointer
)
(func $ternary/testVoidInclTypeMismatch (param $cond i32) (param $nop i32)
local.get $cond
if
i32.const 0
global.set $~argumentsLength
local.get $nop
i32.load
call_indirect (type $0)
else
i32.const 0
global.set $~argumentsLength
local.get $nop
i32.load
call_indirect (type $0)
end
local.get $cond
if
i32.const 0
global.set $~argumentsLength
local.get $nop
i32.load
call_indirect (type $0)
else
i32.const 1
drop
end
local.get $cond
if
i32.const 1
drop
else
i32.const 0
global.set $~argumentsLength
local.get $nop
i32.load
call_indirect (type $0)
end
)
(func $~start
call $start:ternary
)
(func $~stack_check
global.get $~lib/memory/__stack_pointer
global.get $~lib/memory/__data_end
i32.lt_s
if
i32.const 32832
i32.const 32880
i32.const 1
i32.const 1
call $~lib/builtins/abort
unreachable
end
)
(func $export:ternary/testVoidInclTypeMismatch (param $0 i32) (param $1 i32)
global.get $~lib/memory/__stack_pointer
i32.const 4
i32.sub
global.set $~lib/memory/__stack_pointer
call $~stack_check
global.get $~lib/memory/__stack_pointer
local.get $1
i32.store
local.get $0
local.get $1
call $ternary/testVoidInclTypeMismatch
global.get $~lib/memory/__stack_pointer
i32.const 4
i32.add
global.set $~lib/memory/__stack_pointer
)
)