blob: 91ef66ebf61638ff783483fcbd9cb39fa849de93 (
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
|
(module
(import "env" "global-1" (global $g1 i32))
(global $g2 (mut i32) (global.get $g1))
(func $foo
(drop (global.get $g1))
(drop (global.get $g2))
)
)
(module
(import "env" "global-1" (global $g1 i32))
(global $g2 (mut i32) (global.get $g1))
(global $g3 (mut i32) (global.get $g2))
(global $g4 (mut i32) (global.get $g3))
(func $foo
(drop (global.get $g1))
(drop (global.get $g2))
(drop (global.get $g3))
(drop (global.get $g4))
)
)
(module
(import "env" "global-1" (global $g1 (mut i32)))
(global $g2 (mut i32) (global.get $g1))
)
(module
(import "env" "global-1" (global $g1 i32))
(global $g2 (mut i32) (global.get $g1))
(func $foo
(global.set $g2 (unreachable))
)
)
(module
(import "env" "global-1" (global $g1 (mut i32)))
(global $g2 (mut i32) (global.get $g1))
(export "global-2" (global $g2))
)
(module
(global $g1 i32 (i32.const 1))
(global $g2 i32 (global.get $g1))
(global $g3 f64 (f64.const -3.4))
(global $g4 (mut f64) (f64.const -2.8))
(global $g5 i32 (i32.const 2))
(global $g6 (mut i32) (global.get $g5))
(global $g7 (mut i32) (i32.const 3))
(global $g8 i32 (global.get $g7))
(global $g9 i32 (i32.const 4))
(global $ga (mut i32) (global.get $g9))
(global $gb (mut i32) (i32.const 5))
(global $gc i32 (global.get $gb))
(func $foo
(drop (global.get $g1))
(drop (global.get $g2))
(drop (global.get $g3))
(drop (global.get $g4))
(drop (global.get $g5))
(drop (global.get $g6))
(drop (global.get $g7))
(drop (global.get $g8))
(drop (global.get $g9))
(drop (global.get $ga))
(drop (global.get $gb))
(drop (global.get $gc))
(global.set $ga (i32.const 6))
(global.set $gb (i32.const 7))
)
)
(module
(global $g1 (mut i32) (i32.const 1))
(global $g2 (mut i32) (i32.const 1))
(func $f (param $x i32) (result i32)
(global.set $g1 (i32.const 100))
(global.set $g2 (local.get $x))
(if (local.get $x) (return (i32.const 0)))
(local.set $x
(i32.add
(global.get $g1)
(global.get $g2)
)
)
(if (local.get $x) (return (i32.const 1)))
(global.set $g1 (i32.const 200))
(global.set $g2 (local.get $x))
(local.set $x
(i32.add
(global.get $g1)
(global.get $g2)
)
)
(local.get $x)
)
)
(module
(global $g1 (mut i32) (i32.const 1))
(global $g2 (mut i32) (i32.const 1))
(func $f (param $x i32) (result i32)
(global.set $g1 (i32.const 100))
(global.set $g2 (local.get $x))
(local.set $x
(i32.add
(i32.add
(global.get $g1)
(global.get $g1)
)
(global.get $g2)
)
)
(local.get $x)
)
)
(module
(global $g1 (mut i32) (i32.const 1))
(global $g2 (mut i32) (i32.const 1))
(func $no (param $x i32) (result i32)
(global.set $g1 (i32.const 100))
(drop (call $no (i32.const 200))) ;; invalidate
(global.get $g1)
)
(func $no2 (param $x i32) (result i32)
(global.set $g1 (i32.const 100))
(global.set $g1 (local.get $x)) ;; invalidate
(global.get $g1)
)
(func $yes (param $x i32) (result i32)
(global.set $g1 (i32.const 100))
(global.set $g2 (local.get $x)) ;; almost invalidate
(global.get $g1)
)
)
|