| 1 |
/* Copyright 2021 Mozilla Foundation |
| 2 |
* |
| 3 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
* you may not use this file except in compliance with the License. |
| 5 |
* You may obtain a copy of the License at |
| 6 |
* |
| 7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
* |
| 9 |
* Unless required by applicable law or agreed to in writing, software |
| 10 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
* See the License for the specific language governing permissions and |
| 13 |
* limitations under the License. |
| 14 |
*/ |
| 15 |
|
| 16 |
// ./test/core/load.wast |
| 17 |
|
| 18 |
// ./test/core/load.wast:3 |
| 19 |
let $0 = instantiate(`(module |
| 20 |
(memory 1) |
| 21 |
|
| 22 |
(func (export "as-br-value") (result i32) |
| 23 |
(block (result i32) (br 0 (i32.load (i32.const 0)))) |
| 24 |
) |
| 25 |
|
| 26 |
(func (export "as-br_if-cond") |
| 27 |
(block (br_if 0 (i32.load (i32.const 0)))) |
| 28 |
) |
| 29 |
(func (export "as-br_if-value") (result i32) |
| 30 |
(block (result i32) |
| 31 |
(drop (br_if 0 (i32.load (i32.const 0)) (i32.const 1))) (i32.const 7) |
| 32 |
) |
| 33 |
) |
| 34 |
(func (export "as-br_if-value-cond") (result i32) |
| 35 |
(block (result i32) |
| 36 |
(drop (br_if 0 (i32.const 6) (i32.load (i32.const 0)))) (i32.const 7) |
| 37 |
) |
| 38 |
) |
| 39 |
|
| 40 |
(func (export "as-br_table-index") |
| 41 |
(block (br_table 0 0 0 (i32.load (i32.const 0)))) |
| 42 |
) |
| 43 |
(func (export "as-br_table-value") (result i32) |
| 44 |
(block (result i32) |
| 45 |
(br_table 0 0 0 (i32.load (i32.const 0)) (i32.const 1)) (i32.const 7) |
| 46 |
) |
| 47 |
) |
| 48 |
(func (export "as-br_table-value-index") (result i32) |
| 49 |
(block (result i32) |
| 50 |
(br_table 0 0 (i32.const 6) (i32.load (i32.const 0))) (i32.const 7) |
| 51 |
) |
| 52 |
) |
| 53 |
|
| 54 |
(func (export "as-return-value") (result i32) |
| 55 |
(return (i32.load (i32.const 0))) |
| 56 |
) |
| 57 |
|
| 58 |
(func (export "as-if-cond") (result i32) |
| 59 |
(if (result i32) (i32.load (i32.const 0)) |
| 60 |
(then (i32.const 0)) (else (i32.const 1)) |
| 61 |
) |
| 62 |
) |
| 63 |
(func (export "as-if-then") (result i32) |
| 64 |
(if (result i32) (i32.const 1) |
| 65 |
(then (i32.load (i32.const 0))) (else (i32.const 0)) |
| 66 |
) |
| 67 |
) |
| 68 |
(func (export "as-if-else") (result i32) |
| 69 |
(if (result i32) (i32.const 0) |
| 70 |
(then (i32.const 0)) (else (i32.load (i32.const 0))) |
| 71 |
) |
| 72 |
) |
| 73 |
|
| 74 |
(func (export "as-select-first") (param i32 i32) (result i32) |
| 75 |
(select (i32.load (i32.const 0)) (local.get 0) (local.get 1)) |
| 76 |
) |
| 77 |
(func (export "as-select-second") (param i32 i32) (result i32) |
| 78 |
(select (local.get 0) (i32.load (i32.const 0)) (local.get 1)) |
| 79 |
) |
| 80 |
(func (export "as-select-cond") (result i32) |
| 81 |
(select (i32.const 0) (i32.const 1) (i32.load (i32.const 0))) |
| 82 |
) |
| 83 |
|
| 84 |
(func $$f (param i32 i32 i32) (result i32) (i32.const -1)) |
| 85 |
(func (export "as-call-first") (result i32) |
| 86 |
(call $$f (i32.load (i32.const 0)) (i32.const 2) (i32.const 3)) |
| 87 |
) |
| 88 |
(func (export "as-call-mid") (result i32) |
| 89 |
(call $$f (i32.const 1) (i32.load (i32.const 0)) (i32.const 3)) |
| 90 |
) |
| 91 |
(func (export "as-call-last") (result i32) |
| 92 |
(call $$f (i32.const 1) (i32.const 2) (i32.load (i32.const 0))) |
| 93 |
) |
| 94 |
|
| 95 |
(type $$sig (func (param i32 i32 i32) (result i32))) |
| 96 |
(table funcref (elem $$f)) |
| 97 |
(func (export "as-call_indirect-first") (result i32) |
| 98 |
(call_indirect (type $$sig) |
| 99 |
(i32.load (i32.const 0)) (i32.const 2) (i32.const 3) (i32.const 0) |
| 100 |
) |
| 101 |
) |
| 102 |
(func (export "as-call_indirect-mid") (result i32) |
| 103 |
(call_indirect (type $$sig) |
| 104 |
(i32.const 1) (i32.load (i32.const 0)) (i32.const 3) (i32.const 0) |
| 105 |
) |
| 106 |
) |
| 107 |
(func (export "as-call_indirect-last") (result i32) |
| 108 |
(call_indirect (type $$sig) |
| 109 |
(i32.const 1) (i32.const 2) (i32.load (i32.const 0)) (i32.const 0) |
| 110 |
) |
| 111 |
) |
| 112 |
(func (export "as-call_indirect-index") (result i32) |
| 113 |
(call_indirect (type $$sig) |
| 114 |
(i32.const 1) (i32.const 2) (i32.const 3) (i32.load (i32.const 0)) |
| 115 |
) |
| 116 |
) |
| 117 |
|
| 118 |
(func (export "as-local.set-value") (local i32) |
| 119 |
(local.set 0 (i32.load (i32.const 0))) |
| 120 |
) |
| 121 |
(func (export "as-local.tee-value") (result i32) (local i32) |
| 122 |
(local.tee 0 (i32.load (i32.const 0))) |
| 123 |
) |
| 124 |
(global $$g (mut i32) (i32.const 0)) |
| 125 |
(func (export "as-global.set-value") (local i32) |
| 126 |
(global.set $$g (i32.load (i32.const 0))) |
| 127 |
) |
| 128 |
|
| 129 |
(func (export "as-load-address") (result i32) |
| 130 |
(i32.load (i32.load (i32.const 0))) |
| 131 |
) |
| 132 |
(func (export "as-loadN-address") (result i32) |
| 133 |
(i32.load8_s (i32.load (i32.const 0))) |
| 134 |
) |
| 135 |
|
| 136 |
(func (export "as-store-address") |
| 137 |
(i32.store (i32.load (i32.const 0)) (i32.const 7)) |
| 138 |
) |
| 139 |
(func (export "as-store-value") |
| 140 |
(i32.store (i32.const 2) (i32.load (i32.const 0))) |
| 141 |
) |
| 142 |
|
| 143 |
(func (export "as-storeN-address") |
| 144 |
(i32.store8 (i32.load8_s (i32.const 0)) (i32.const 7)) |
| 145 |
) |
| 146 |
(func (export "as-storeN-value") |
| 147 |
(i32.store16 (i32.const 2) (i32.load (i32.const 0))) |
| 148 |
) |
| 149 |
|
| 150 |
(func (export "as-unary-operand") (result i32) |
| 151 |
(i32.clz (i32.load (i32.const 100))) |
| 152 |
) |
| 153 |
|
| 154 |
(func (export "as-binary-left") (result i32) |
| 155 |
(i32.add (i32.load (i32.const 100)) (i32.const 10)) |
| 156 |
) |
| 157 |
(func (export "as-binary-right") (result i32) |
| 158 |
(i32.sub (i32.const 10) (i32.load (i32.const 100))) |
| 159 |
) |
| 160 |
|
| 161 |
(func (export "as-test-operand") (result i32) |
| 162 |
(i32.eqz (i32.load (i32.const 100))) |
| 163 |
) |
| 164 |
|
| 165 |
(func (export "as-compare-left") (result i32) |
| 166 |
(i32.le_s (i32.load (i32.const 100)) (i32.const 10)) |
| 167 |
) |
| 168 |
(func (export "as-compare-right") (result i32) |
| 169 |
(i32.ne (i32.const 10) (i32.load (i32.const 100))) |
| 170 |
) |
| 171 |
|
| 172 |
(func (export "as-memory.grow-size") (result i32) |
| 173 |
(memory.grow (i32.load (i32.const 100))) |
| 174 |
) |
| 175 |
)`); |
| 176 |
|
| 177 |
// ./test/core/load.wast:161 |
| 178 |
assert_return(() => invoke($0, `as-br-value`, []), [value("i32", 0)]); |
| 179 |
|
| 180 |
// ./test/core/load.wast:163 |
| 181 |
assert_return(() => invoke($0, `as-br_if-cond`, []), []); |
| 182 |
|
| 183 |
// ./test/core/load.wast:164 |
| 184 |
assert_return(() => invoke($0, `as-br_if-value`, []), [value("i32", 0)]); |
| 185 |
|
| 186 |
// ./test/core/load.wast:165 |
| 187 |
assert_return(() => invoke($0, `as-br_if-value-cond`, []), [value("i32", 7)]); |
| 188 |
|
| 189 |
// ./test/core/load.wast:167 |
| 190 |
assert_return(() => invoke($0, `as-br_table-index`, []), []); |
| 191 |
|
| 192 |
// ./test/core/load.wast:168 |
| 193 |
assert_return(() => invoke($0, `as-br_table-value`, []), [value("i32", 0)]); |
| 194 |
|
| 195 |
// ./test/core/load.wast:169 |
| 196 |
assert_return(() => invoke($0, `as-br_table-value-index`, []), [value("i32", 6)]); |
| 197 |
|
| 198 |
// ./test/core/load.wast:171 |
| 199 |
assert_return(() => invoke($0, `as-return-value`, []), [value("i32", 0)]); |
| 200 |
|
| 201 |
// ./test/core/load.wast:173 |
| 202 |
assert_return(() => invoke($0, `as-if-cond`, []), [value("i32", 1)]); |
| 203 |
|
| 204 |
// ./test/core/load.wast:174 |
| 205 |
assert_return(() => invoke($0, `as-if-then`, []), [value("i32", 0)]); |
| 206 |
|
| 207 |
// ./test/core/load.wast:175 |
| 208 |
assert_return(() => invoke($0, `as-if-else`, []), [value("i32", 0)]); |
| 209 |
|
| 210 |
// ./test/core/load.wast:177 |
| 211 |
assert_return(() => invoke($0, `as-select-first`, [0, 1]), [value("i32", 0)]); |
| 212 |
|
| 213 |
// ./test/core/load.wast:178 |
| 214 |
assert_return(() => invoke($0, `as-select-second`, [0, 0]), [value("i32", 0)]); |
| 215 |
|
| 216 |
// ./test/core/load.wast:179 |
| 217 |
assert_return(() => invoke($0, `as-select-cond`, []), [value("i32", 1)]); |
| 218 |
|
| 219 |
// ./test/core/load.wast:181 |
| 220 |
assert_return(() => invoke($0, `as-call-first`, []), [value("i32", -1)]); |
| 221 |
|
| 222 |
// ./test/core/load.wast:182 |
| 223 |
assert_return(() => invoke($0, `as-call-mid`, []), [value("i32", -1)]); |
| 224 |
|
| 225 |
// ./test/core/load.wast:183 |
| 226 |
assert_return(() => invoke($0, `as-call-last`, []), [value("i32", -1)]); |
| 227 |
|
| 228 |
// ./test/core/load.wast:185 |
| 229 |
assert_return(() => invoke($0, `as-call_indirect-first`, []), [value("i32", -1)]); |
| 230 |
|
| 231 |
// ./test/core/load.wast:186 |
| 232 |
assert_return(() => invoke($0, `as-call_indirect-mid`, []), [value("i32", -1)]); |
| 233 |
|
| 234 |
// ./test/core/load.wast:187 |
| 235 |
assert_return(() => invoke($0, `as-call_indirect-last`, []), [value("i32", -1)]); |
| 236 |
|
| 237 |
// ./test/core/load.wast:188 |
| 238 |
assert_return(() => invoke($0, `as-call_indirect-index`, []), [value("i32", -1)]); |
| 239 |
|
| 240 |
// ./test/core/load.wast:190 |
| 241 |
assert_return(() => invoke($0, `as-local.set-value`, []), []); |
| 242 |
|
| 243 |
// ./test/core/load.wast:191 |
| 244 |
assert_return(() => invoke($0, `as-local.tee-value`, []), [value("i32", 0)]); |
| 245 |
|
| 246 |
// ./test/core/load.wast:192 |
| 247 |
assert_return(() => invoke($0, `as-global.set-value`, []), []); |
| 248 |
|
| 249 |
// ./test/core/load.wast:194 |
| 250 |
assert_return(() => invoke($0, `as-load-address`, []), [value("i32", 0)]); |
| 251 |
|
| 252 |
// ./test/core/load.wast:195 |
| 253 |
assert_return(() => invoke($0, `as-loadN-address`, []), [value("i32", 0)]); |
| 254 |
|
| 255 |
// ./test/core/load.wast:196 |
| 256 |
assert_return(() => invoke($0, `as-store-address`, []), []); |
| 257 |
|
| 258 |
// ./test/core/load.wast:197 |
| 259 |
assert_return(() => invoke($0, `as-store-value`, []), []); |
| 260 |
|
| 261 |
// ./test/core/load.wast:198 |
| 262 |
assert_return(() => invoke($0, `as-storeN-address`, []), []); |
| 263 |
|
| 264 |
// ./test/core/load.wast:199 |
| 265 |
assert_return(() => invoke($0, `as-storeN-value`, []), []); |
| 266 |
|
| 267 |
// ./test/core/load.wast:201 |
| 268 |
assert_return(() => invoke($0, `as-unary-operand`, []), [value("i32", 32)]); |
| 269 |
|
| 270 |
// ./test/core/load.wast:203 |
| 271 |
assert_return(() => invoke($0, `as-binary-left`, []), [value("i32", 10)]); |
| 272 |
|
| 273 |
// ./test/core/load.wast:204 |
| 274 |
assert_return(() => invoke($0, `as-binary-right`, []), [value("i32", 10)]); |
| 275 |
|
| 276 |
// ./test/core/load.wast:206 |
| 277 |
assert_return(() => invoke($0, `as-test-operand`, []), [value("i32", 1)]); |
| 278 |
|
| 279 |
// ./test/core/load.wast:208 |
| 280 |
assert_return(() => invoke($0, `as-compare-left`, []), [value("i32", 1)]); |
| 281 |
|
| 282 |
// ./test/core/load.wast:209 |
| 283 |
assert_return(() => invoke($0, `as-compare-right`, []), [value("i32", 1)]); |
| 284 |
|
| 285 |
// ./test/core/load.wast:211 |
| 286 |
assert_return(() => invoke($0, `as-memory.grow-size`, []), [value("i32", 1)]); |
| 287 |
|
| 288 |
// ./test/core/load.wast:213 |
| 289 |
assert_malformed( |
| 290 |
() => instantiate(`(memory 1) (func (param i32) (result i32) (i32.load32 (local.get 0))) `), |
| 291 |
`unknown operator`, |
| 292 |
); |
| 293 |
|
| 294 |
// ./test/core/load.wast:220 |
| 295 |
assert_malformed( |
| 296 |
() => instantiate(`(memory 1) (func (param i32) (result i32) (i32.load32_u (local.get 0))) `), |
| 297 |
`unknown operator`, |
| 298 |
); |
| 299 |
|
| 300 |
// ./test/core/load.wast:227 |
| 301 |
assert_malformed( |
| 302 |
() => instantiate(`(memory 1) (func (param i32) (result i32) (i32.load32_s (local.get 0))) `), |
| 303 |
`unknown operator`, |
| 304 |
); |
| 305 |
|
| 306 |
// ./test/core/load.wast:234 |
| 307 |
assert_malformed( |
| 308 |
() => instantiate(`(memory 1) (func (param i32) (result i32) (i32.load64 (local.get 0))) `), |
| 309 |
`unknown operator`, |
| 310 |
); |
| 311 |
|
| 312 |
// ./test/core/load.wast:241 |
| 313 |
assert_malformed( |
| 314 |
() => instantiate(`(memory 1) (func (param i32) (result i32) (i32.load64_u (local.get 0))) `), |
| 315 |
`unknown operator`, |
| 316 |
); |
| 317 |
|
| 318 |
// ./test/core/load.wast:248 |
| 319 |
assert_malformed( |
| 320 |
() => instantiate(`(memory 1) (func (param i32) (result i32) (i32.load64_s (local.get 0))) `), |
| 321 |
`unknown operator`, |
| 322 |
); |
| 323 |
|
| 324 |
// ./test/core/load.wast:256 |
| 325 |
assert_malformed( |
| 326 |
() => instantiate(`(memory 1) (func (param i32) (result i64) (i64.load64 (local.get 0))) `), |
| 327 |
`unknown operator`, |
| 328 |
); |
| 329 |
|
| 330 |
// ./test/core/load.wast:263 |
| 331 |
assert_malformed( |
| 332 |
() => instantiate(`(memory 1) (func (param i32) (result i64) (i64.load64_u (local.get 0))) `), |
| 333 |
`unknown operator`, |
| 334 |
); |
| 335 |
|
| 336 |
// ./test/core/load.wast:270 |
| 337 |
assert_malformed( |
| 338 |
() => instantiate(`(memory 1) (func (param i32) (result i64) (i64.load64_s (local.get 0))) `), |
| 339 |
`unknown operator`, |
| 340 |
); |
| 341 |
|
| 342 |
// ./test/core/load.wast:278 |
| 343 |
assert_malformed( |
| 344 |
() => instantiate(`(memory 1) (func (param i32) (result f32) (f32.load32 (local.get 0))) `), |
| 345 |
`unknown operator`, |
| 346 |
); |
| 347 |
|
| 348 |
// ./test/core/load.wast:285 |
| 349 |
assert_malformed( |
| 350 |
() => instantiate(`(memory 1) (func (param i32) (result f32) (f32.load64 (local.get 0))) `), |
| 351 |
`unknown operator`, |
| 352 |
); |
| 353 |
|
| 354 |
// ./test/core/load.wast:293 |
| 355 |
assert_malformed( |
| 356 |
() => instantiate(`(memory 1) (func (param i32) (result f64) (f64.load32 (local.get 0))) `), |
| 357 |
`unknown operator`, |
| 358 |
); |
| 359 |
|
| 360 |
// ./test/core/load.wast:300 |
| 361 |
assert_malformed( |
| 362 |
() => instantiate(`(memory 1) (func (param i32) (result f64) (f64.load64 (local.get 0))) `), |
| 363 |
`unknown operator`, |
| 364 |
); |
| 365 |
|
| 366 |
// ./test/core/load.wast:311 |
| 367 |
assert_invalid( |
| 368 |
() => instantiate(`(module (memory 1) (func $$load_i32 (i32.load (i32.const 0))))`), |
| 369 |
`type mismatch`, |
| 370 |
); |
| 371 |
|
| 372 |
// ./test/core/load.wast:315 |
| 373 |
assert_invalid( |
| 374 |
() => instantiate(`(module (memory 1) (func $$load8_s_i32 (i32.load8_s (i32.const 0))))`), |
| 375 |
`type mismatch`, |
| 376 |
); |
| 377 |
|
| 378 |
// ./test/core/load.wast:319 |
| 379 |
assert_invalid( |
| 380 |
() => instantiate(`(module (memory 1) (func $$load8_u_i32 (i32.load8_u (i32.const 0))))`), |
| 381 |
`type mismatch`, |
| 382 |
); |
| 383 |
|
| 384 |
// ./test/core/load.wast:323 |
| 385 |
assert_invalid( |
| 386 |
() => instantiate(`(module (memory 1) (func $$load16_s_i32 (i32.load16_s (i32.const 0))))`), |
| 387 |
`type mismatch`, |
| 388 |
); |
| 389 |
|
| 390 |
// ./test/core/load.wast:327 |
| 391 |
assert_invalid( |
| 392 |
() => instantiate(`(module (memory 1) (func $$load16_u_i32 (i32.load16_u (i32.const 0))))`), |
| 393 |
`type mismatch`, |
| 394 |
); |
| 395 |
|
| 396 |
// ./test/core/load.wast:331 |
| 397 |
assert_invalid( |
| 398 |
() => instantiate(`(module (memory 1) (func $$load_i64 (i64.load (i32.const 0))))`), |
| 399 |
`type mismatch`, |
| 400 |
); |
| 401 |
|
| 402 |
// ./test/core/load.wast:335 |
| 403 |
assert_invalid( |
| 404 |
() => instantiate(`(module (memory 1) (func $$load8_s_i64 (i64.load8_s (i32.const 0))))`), |
| 405 |
`type mismatch`, |
| 406 |
); |
| 407 |
|
| 408 |
// ./test/core/load.wast:339 |
| 409 |
assert_invalid( |
| 410 |
() => instantiate(`(module (memory 1) (func $$load8_u_i64 (i64.load8_u (i32.const 0))))`), |
| 411 |
`type mismatch`, |
| 412 |
); |
| 413 |
|
| 414 |
// ./test/core/load.wast:343 |
| 415 |
assert_invalid( |
| 416 |
() => instantiate(`(module (memory 1) (func $$load16_s_i64 (i64.load16_s (i32.const 0))))`), |
| 417 |
`type mismatch`, |
| 418 |
); |
| 419 |
|
| 420 |
// ./test/core/load.wast:347 |
| 421 |
assert_invalid( |
| 422 |
() => instantiate(`(module (memory 1) (func $$load16_u_i64 (i64.load16_u (i32.const 0))))`), |
| 423 |
`type mismatch`, |
| 424 |
); |
| 425 |
|
| 426 |
// ./test/core/load.wast:351 |
| 427 |
assert_invalid( |
| 428 |
() => instantiate(`(module (memory 1) (func $$load32_s_i64 (i64.load32_s (i32.const 0))))`), |
| 429 |
`type mismatch`, |
| 430 |
); |
| 431 |
|
| 432 |
// ./test/core/load.wast:355 |
| 433 |
assert_invalid( |
| 434 |
() => instantiate(`(module (memory 1) (func $$load32_u_i64 (i64.load32_u (i32.const 0))))`), |
| 435 |
`type mismatch`, |
| 436 |
); |
| 437 |
|
| 438 |
// ./test/core/load.wast:359 |
| 439 |
assert_invalid( |
| 440 |
() => instantiate(`(module (memory 1) (func $$load_f32 (f32.load (i32.const 0))))`), |
| 441 |
`type mismatch`, |
| 442 |
); |
| 443 |
|
| 444 |
// ./test/core/load.wast:363 |
| 445 |
assert_invalid( |
| 446 |
() => instantiate(`(module (memory 1) (func $$load_f64 (f64.load (i32.const 0))))`), |
| 447 |
`type mismatch`, |
| 448 |
); |
| 449 |
|
| 450 |
// ./test/core/load.wast:371 |
| 451 |
assert_invalid( |
| 452 |
() => instantiate(`(module (memory 1) (func (result i32) (i32.load (f32.const 0))))`), |
| 453 |
`type mismatch`, |
| 454 |
); |
| 455 |
|
| 456 |
// ./test/core/load.wast:372 |
| 457 |
assert_invalid( |
| 458 |
() => instantiate(`(module (memory 1) (func (result i32) (i32.load8_s (f32.const 0))))`), |
| 459 |
`type mismatch`, |
| 460 |
); |
| 461 |
|
| 462 |
// ./test/core/load.wast:373 |
| 463 |
assert_invalid( |
| 464 |
() => instantiate(`(module (memory 1) (func (result i32) (i32.load8_u (f32.const 0))))`), |
| 465 |
`type mismatch`, |
| 466 |
); |
| 467 |
|
| 468 |
// ./test/core/load.wast:374 |
| 469 |
assert_invalid( |
| 470 |
() => instantiate(`(module (memory 1) (func (result i32) (i32.load16_s (f32.const 0))))`), |
| 471 |
`type mismatch`, |
| 472 |
); |
| 473 |
|
| 474 |
// ./test/core/load.wast:375 |
| 475 |
assert_invalid( |
| 476 |
() => instantiate(`(module (memory 1) (func (result i32) (i32.load16_u (f32.const 0))))`), |
| 477 |
`type mismatch`, |
| 478 |
); |
| 479 |
|
| 480 |
// ./test/core/load.wast:376 |
| 481 |
assert_invalid( |
| 482 |
() => instantiate(`(module (memory 1) (func (result i64) (i64.load (f32.const 0))))`), |
| 483 |
`type mismatch`, |
| 484 |
); |
| 485 |
|
| 486 |
// ./test/core/load.wast:377 |
| 487 |
assert_invalid( |
| 488 |
() => instantiate(`(module (memory 1) (func (result i64) (i64.load8_s (f32.const 0))))`), |
| 489 |
`type mismatch`, |
| 490 |
); |
| 491 |
|
| 492 |
// ./test/core/load.wast:378 |
| 493 |
assert_invalid( |
| 494 |
() => instantiate(`(module (memory 1) (func (result i64) (i64.load8_u (f32.const 0))))`), |
| 495 |
`type mismatch`, |
| 496 |
); |
| 497 |
|
| 498 |
// ./test/core/load.wast:379 |
| 499 |
assert_invalid( |
| 500 |
() => instantiate(`(module (memory 1) (func (result i64) (i64.load16_s (f32.const 0))))`), |
| 501 |
`type mismatch`, |
| 502 |
); |
| 503 |
|
| 504 |
// ./test/core/load.wast:380 |
| 505 |
assert_invalid( |
| 506 |
() => instantiate(`(module (memory 1) (func (result i64) (i64.load16_u (f32.const 0))))`), |
| 507 |
`type mismatch`, |
| 508 |
); |
| 509 |
|
| 510 |
// ./test/core/load.wast:381 |
| 511 |
assert_invalid( |
| 512 |
() => instantiate(`(module (memory 1) (func (result i64) (i64.load32_s (f32.const 0))))`), |
| 513 |
`type mismatch`, |
| 514 |
); |
| 515 |
|
| 516 |
// ./test/core/load.wast:382 |
| 517 |
assert_invalid( |
| 518 |
() => instantiate(`(module (memory 1) (func (result i64) (i64.load32_u (f32.const 0))))`), |
| 519 |
`type mismatch`, |
| 520 |
); |
| 521 |
|
| 522 |
// ./test/core/load.wast:383 |
| 523 |
assert_invalid( |
| 524 |
() => instantiate(`(module (memory 1) (func (result f32) (f32.load (f32.const 0))))`), |
| 525 |
`type mismatch`, |
| 526 |
); |
| 527 |
|
| 528 |
// ./test/core/load.wast:384 |
| 529 |
assert_invalid( |
| 530 |
() => instantiate(`(module (memory 1) (func (result f64) (f64.load (f32.const 0))))`), |
| 531 |
`type mismatch`, |
| 532 |
); |
| 533 |
|
| 534 |
// ./test/core/load.wast:387 |
| 535 |
assert_invalid( |
| 536 |
() => instantiate(`(module |
| 537 |
(memory 0) |
| 538 |
(func $$type-address-empty |
| 539 |
(i32.load) (drop) |
| 540 |
) |
| 541 |
)`), |
| 542 |
`type mismatch`, |
| 543 |
); |
| 544 |
|
| 545 |
// ./test/core/load.wast:396 |
| 546 |
assert_invalid( |
| 547 |
() => instantiate(`(module |
| 548 |
(memory 0) |
| 549 |
(func $$type-address-empty-in-block |
| 550 |
(i32.const 0) |
| 551 |
(block (i32.load) (drop)) |
| 552 |
) |
| 553 |
)`), |
| 554 |
`type mismatch`, |
| 555 |
); |
| 556 |
|
| 557 |
// ./test/core/load.wast:406 |
| 558 |
assert_invalid( |
| 559 |
() => instantiate(`(module |
| 560 |
(memory 0) |
| 561 |
(func $$type-address-empty-in-loop |
| 562 |
(i32.const 0) |
| 563 |
(loop (i32.load) (drop)) |
| 564 |
) |
| 565 |
)`), |
| 566 |
`type mismatch`, |
| 567 |
); |
| 568 |
|
| 569 |
// ./test/core/load.wast:416 |
| 570 |
assert_invalid( |
| 571 |
() => instantiate(`(module |
| 572 |
(memory 0) |
| 573 |
(func $$type-address-empty-in-then |
| 574 |
(i32.const 0) (i32.const 0) |
| 575 |
(if (then (i32.load) (drop))) |
| 576 |
) |
| 577 |
)`), |
| 578 |
`type mismatch`, |
| 579 |
); |
| 580 |
|
| 581 |
// ./test/core/load.wast:426 |
| 582 |
assert_invalid( |
| 583 |
() => instantiate(`(module |
| 584 |
(memory 0) |
| 585 |
(func $$type-address-empty-in-else |
| 586 |
(i32.const 0) (i32.const 0) |
| 587 |
(if (result i32) (then (i32.const 0)) (else (i32.load))) (drop) |
| 588 |
) |
| 589 |
)`), |
| 590 |
`type mismatch`, |
| 591 |
); |
| 592 |
|
| 593 |
// ./test/core/load.wast:436 |
| 594 |
assert_invalid( |
| 595 |
() => instantiate(`(module |
| 596 |
(memory 0) |
| 597 |
(func $$type-address-empty-in-br |
| 598 |
(i32.const 0) |
| 599 |
(block (br 0 (i32.load)) (drop)) |
| 600 |
) |
| 601 |
)`), |
| 602 |
`type mismatch`, |
| 603 |
); |
| 604 |
|
| 605 |
// ./test/core/load.wast:446 |
| 606 |
assert_invalid( |
| 607 |
() => instantiate(`(module |
| 608 |
(memory 0) |
| 609 |
(func $$type-address-empty-in-br_if |
| 610 |
(i32.const 0) |
| 611 |
(block (br_if 0 (i32.load) (i32.const 1)) (drop)) |
| 612 |
) |
| 613 |
)`), |
| 614 |
`type mismatch`, |
| 615 |
); |
| 616 |
|
| 617 |
// ./test/core/load.wast:456 |
| 618 |
assert_invalid( |
| 619 |
() => instantiate(`(module |
| 620 |
(memory 0) |
| 621 |
(func $$type-address-empty-in-br_table |
| 622 |
(i32.const 0) |
| 623 |
(block (br_table 0 (i32.load)) (drop)) |
| 624 |
) |
| 625 |
)`), |
| 626 |
`type mismatch`, |
| 627 |
); |
| 628 |
|
| 629 |
// ./test/core/load.wast:466 |
| 630 |
assert_invalid( |
| 631 |
() => instantiate(`(module |
| 632 |
(memory 0) |
| 633 |
(func $$type-address-empty-in-return |
| 634 |
(return (i32.load)) (drop) |
| 635 |
) |
| 636 |
)`), |
| 637 |
`type mismatch`, |
| 638 |
); |
| 639 |
|
| 640 |
// ./test/core/load.wast:475 |
| 641 |
assert_invalid( |
| 642 |
() => instantiate(`(module |
| 643 |
(memory 0) |
| 644 |
(func $$type-address-empty-in-select |
| 645 |
(select (i32.load) (i32.const 1) (i32.const 2)) (drop) |
| 646 |
) |
| 647 |
)`), |
| 648 |
`type mismatch`, |
| 649 |
); |
| 650 |
|
| 651 |
// ./test/core/load.wast:484 |
| 652 |
assert_invalid( |
| 653 |
() => instantiate(`(module |
| 654 |
(memory 0) |
| 655 |
(func $$type-address-empty-in-call |
| 656 |
(call 1 (i32.load)) (drop) |
| 657 |
) |
| 658 |
(func (param i32) (result i32) (local.get 0)) |
| 659 |
)`), |
| 660 |
`type mismatch`, |
| 661 |
); |
| 662 |
|
| 663 |
// ./test/core/load.wast:494 |
| 664 |
assert_invalid( |
| 665 |
() => instantiate(`(module |
| 666 |
(memory 0) |
| 667 |
(func $$f (param i32) (result i32) (local.get 0)) |
| 668 |
(type $$sig (func (param i32) (result i32))) |
| 669 |
(table funcref (elem $$f)) |
| 670 |
(func $$type-address-empty-in-call_indirect |
| 671 |
(block (result i32) |
| 672 |
(call_indirect (type $$sig) |
| 673 |
(i32.load) (i32.const 0) |
| 674 |
) |
| 675 |
(drop) |
| 676 |
) |
| 677 |
) |
| 678 |
)`), |
| 679 |
`type mismatch`, |
| 680 |
); |
| 681 |
|
| 682 |
// ./test/core/load.wast:511 |
| 683 |
assert_invalid( |
| 684 |
() => instantiate(`(module |
| 685 |
(memory 0) |
| 686 |
(func $$type-address-empty-in-local.set |
| 687 |
(local i32) |
| 688 |
(local.set 0 (i32.load)) (local.get 0) (drop) |
| 689 |
) |
| 690 |
)`), |
| 691 |
`type mismatch`, |
| 692 |
); |
| 693 |
|
| 694 |
// ./test/core/load.wast:521 |
| 695 |
assert_invalid( |
| 696 |
() => instantiate(`(module |
| 697 |
(memory 0) |
| 698 |
(func $$type-address-empty-in-local.tee |
| 699 |
(local i32) |
| 700 |
(local.tee 0 (i32.load)) (drop) |
| 701 |
) |
| 702 |
)`), |
| 703 |
`type mismatch`, |
| 704 |
); |
| 705 |
|
| 706 |
// ./test/core/load.wast:531 |
| 707 |
assert_invalid( |
| 708 |
() => instantiate(`(module |
| 709 |
(memory 0) |
| 710 |
(global $$x (mut i32) (i32.const 0)) |
| 711 |
(func $$type-address-empty-in-global.set |
| 712 |
(global.set $$x (i32.load)) (global.get $$x) (drop) |
| 713 |
) |
| 714 |
)`), |
| 715 |
`type mismatch`, |
| 716 |
); |
| 717 |
|
| 718 |
// ./test/core/load.wast:541 |
| 719 |
assert_invalid( |
| 720 |
() => instantiate(`(module |
| 721 |
(memory 0) |
| 722 |
(func $$type-address-empty-in-memory.grow |
| 723 |
(memory.grow (i32.load)) (drop) |
| 724 |
) |
| 725 |
)`), |
| 726 |
`type mismatch`, |
| 727 |
); |
| 728 |
|
| 729 |
// ./test/core/load.wast:550 |
| 730 |
assert_invalid( |
| 731 |
() => instantiate(`(module |
| 732 |
(memory 0) |
| 733 |
(func $$type-address-empty-in-load |
| 734 |
(i32.load (i32.load)) (drop) |
| 735 |
) |
| 736 |
)`), |
| 737 |
`type mismatch`, |
| 738 |
); |
| 739 |
|
| 740 |
// ./test/core/load.wast:559 |
| 741 |
assert_invalid( |
| 742 |
() => instantiate(`(module |
| 743 |
(memory 1) |
| 744 |
(func $$type-address-empty-in-store |
| 745 |
(i32.store (i32.load) (i32.const 1)) |
| 746 |
) |
| 747 |
)`), |
| 748 |
`type mismatch`, |
| 749 |
); |