Debian Codegraph @

tests/cli/lime1.wast

raw
1 ;; RUN: wast % -f lime1
2
3 ;; import/export of mutable globals is allowed
4 (module
5 (import "" "" (global (mut i32)))
6 (global (export "") (mut i32) (i32.const 0))
7 )
8
9 ;; saturating float-to-int instructions are allowed
10 (module
11 (func (param f32) (result i32)
12 local.get 0
13 i32.trunc_sat_f32_s)
14 )
15
16 ;; sign-extension is allowed
17 (module
18 (func (param i32) (result i32)
19 local.get 0
20 i32.extend8_s)
21 )
22
23 ;; multi-value is allowed
24 (module (type (func (result i32 i32))))
25
26 ;; memory.copy and memory.fill are allowed ...
27 (module
28 (memory 1)
29 (func (param i32 i32 i32)
30 local.get 0
31 local.get 1
32 local.get 2
33 memory.copy
34 local.get 0
35 local.get 1
36 local.get 2
37 memory.fill))
38
39 ;; ... but other bulk-memory features are not allowed
40 (assert_invalid
41 (module (data))
42 "passive data segments require the bulk-memory proposal")
43 (assert_invalid
44 (module (elem func))
45 "bulk memory must be enabled")
46 (assert_invalid
47 (module (func data.drop 0))
48 "bulk memory support is not enabled")
49 (assert_invalid
50 (module (func memory.init 0))
51 "bulk memory support is not enabled")
52 (assert_invalid
53 (module (func table.init 0))
54 "bulk memory support is not enabled")
55 (assert_invalid
56 (module (func elem.drop 0))
57 "bulk memory support is not enabled")
58 (assert_invalid
59 (module (func table.copy))
60 "bulk memory support is not enabled")
61
62 ;; SIMD is not included
63 (assert_invalid
64 (module (type (func (param v128))))
65 "SIMD support is not enabled")
66
67 ;; threads is not included
68 (assert_invalid
69 (module (memory 1 1 shared))
70 "threads must be enabled for shared memories")
71
72 ;; tail call not enabled
73 (assert_invalid
74 (module (func return_call 0))
75 "tail calls support is not enabled")
76
77 ;; floats are allowed
78 (module (func (param f32)))
79
80 ;; multi memory not enabled
81 (assert_invalid
82 (module (memory 1) (memory 1))
83 "multiple memories")
84
85 ;; exceptions not enabled
86 (assert_invalid
87 (module (tag))
88 "exceptions proposal not enabled")
89
90 ;; memory64 not enabled
91 (assert_invalid
92 (module (memory i64 1))
93 "memory64 must be enabled for 64-bit memories")
94
95 ;; extended const is allowed
96 (module
97 (global i32 (i32.add (i32.const 0) (i32.const 1))))
98
99 ;; GC is not allowed
100 (assert_invalid
101 (module (type (sub (func))))
102 "gc proposal must be enabled to use subtypes")
103
104 ;; reference types is mostly not allowed...
105 (assert_invalid
106 (module (type (func (param externref))))
107 "reference types support is not enabled")
108 (assert_invalid
109 (module (type (func (param funcref))))
110 "reference types support is not enabled")
111 (assert_invalid
112 (module (table 1 funcref) (table 1 funcref))
113 "multiple tables")
114
115 ;; ... but overlong encodings of `call_indirect` table immediates are allowed.
116 (module binary
117 "\00asm" "\01\00\00\00" ;; magic header
118 "\01\04" ;; type section, 4 bytes
119 "\01" ;; 1 type
120 "\60\00\00" ;; function type, no params, no results
121 "\03\02" ;; function section, 2 bytes
122 "\01" ;; 1 function
123 "\00" ;; function0 has type 0
124 "\04\04" ;; table section, 4 bytes
125 "\01" ;; 1 table
126 "\70\00\01" ;; funcref table, no flags, min 1 element
127 "\0a\0c" ;; code section, 12 bytes
128 "\01" ;; 1 function
129 "\0a" ;; function is 10 bytes
130 "\00" ;; no locals
131 "\41\00" ;; i32.const 0
132
133 ;; call_indirect opcode + (type 0) immediate
134 "\11\00"
135
136 ;; 4-byte encoding of the immediate 0, the table index for `call_indirect`
137 "\80\80\80\00"
138
139 "\0b" ;; end
140 )