forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemory-inbounds.wat
More file actions
112 lines (108 loc) · 3.14 KB
/
memory-inbounds.wat
File metadata and controls
112 lines (108 loc) · 3.14 KB
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
;;! target = "pulley64"
;;! test = "compile"
(module
(memory $m1 1 2)
(func $offset0 (result i32) (i32.const 0) i32.load $m1)
(func $offset100 (result i32) (i32.const 100) i32.load $m1)
(func $offset_mixed (result i32) (i32.const 100) i32.load $m1 offset=100)
(func $offset_just_ok (result i32) (i32.const 65532) i32.load $m1)
(func $offset_just_bad (result i32) (i32.const 65533) i32.load $m1)
(func $offset_just_ok_v2 (result i32) (i32.const 1) i32.load $m1 offset=65531)
(func $offset_just_bad_v2 (result i32) (i32.const 1) i32.load $m1 offset=65532)
(func $maybe_inbounds (result i32) (i32.const 131068) i32.load $m1)
(func $maybe_inbounds_v2 (result i32) (i32.const 0) i32.load $m1 offset=131068)
(func $never_inbounds (result i32) (i32.const 131069) i32.load $m1)
(func $never_inbounds_v2 (result i32) (i32.const 0) i32.load $m1 offset=131069)
)
;; wasm[0]::function[0]::offset0:
;; push_frame
;; xload64le_o32 x3, x0, 80
;; xload32le_z x0, x3, 0
;; pop_frame
;; ret
;;
;; wasm[0]::function[1]::offset100:
;; push_frame
;; xload64le_o32 x3, x0, 80
;; xload32le_z x0, x3, 100
;; pop_frame
;; ret
;;
;; wasm[0]::function[2]::offset_mixed:
;; push_frame
;; xload64le_o32 x3, x0, 80
;; xload32le_z x0, x3, 200
;; pop_frame
;; ret
;;
;; wasm[0]::function[3]::offset_just_ok:
;; push_frame
;; xload64le_o32 x3, x0, 80
;; xload32le_z x0, x3, 65532
;; pop_frame
;; ret
;;
;; wasm[0]::function[4]::offset_just_bad:
;; push_frame
;; xload64le_o32 x5, x0, 88
;; xconst32 x6, 65533
;; xload64le_o32 x7, x0, 80
;; xload32le_g32 x0, x7, x5, x6, 0
;; pop_frame
;; ret
;;
;; wasm[0]::function[5]::offset_just_ok_v2:
;; push_frame
;; xload64le_o32 x3, x0, 80
;; xload32le_z x0, x3, 65532
;; pop_frame
;; ret
;;
;; wasm[0]::function[6]::offset_just_bad_v2:
;; push_frame
;; xload64le_o32 x9, x0, 88
;; xzero x10
;; xload64le_o32 x11, x0, 80
;; xadd64_u32 x11, x11, 65533
;; xconst32 x7, 65536
;; xeq64 x9, x9, x7
;; xselect64 x11, x9, x10, x11
;; xload32le_z x0, x11, 0
;; pop_frame
;; ret
;;
;; wasm[0]::function[7]::maybe_inbounds:
;; push_frame
;; xload64le_o32 x5, x0, 88
;; xconst32 x6, 131068
;; xload64le_o32 x7, x0, 80
;; xload32le_g32 x0, x7, x5, x6, 0
;; pop_frame
;; ret
;;
;; wasm[0]::function[8]::maybe_inbounds_v2:
;; push_frame
;; xzero x10
;; xconst32 x11, 131072
;; xadd64_uoverflow_trap x11, x10, x11
;; xload64le_o32 x12, x0, 88
;; xload64le_o32 x13, x0, 80
;; xadd64_u32 x13, x13, 131068
;; xult64 x9, x12, x11
;; xselect64 x11, x9, x10, x13
;; xload32le_z x0, x11, 0
;; pop_frame
;; ret
;;
;; wasm[0]::function[9]::never_inbounds:
;; push_frame
;; xload64le_o32 x5, x0, 88
;; xconst32 x6, 131069
;; xload64le_o32 x7, x0, 80
;; xload32le_g32 x0, x7, x5, x6, 0
;; pop_frame
;; ret
;;
;; wasm[0]::function[10]::never_inbounds_v2:
;; push_frame
;; trap