github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/integration_test/spectest/v2/testdata/memory_fill.wast (about) 1 ;; 2 ;; Generated by ../meta/generate_memory_fill.js 3 ;; DO NOT EDIT THIS FILE. CHANGE THE SOURCE AND REGENERATE. 4 ;; 5 6 (module 7 (memory 1 1) 8 9 (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32) 10 (loop $cont 11 (if (i32.eq (local.get $from) (local.get $to)) 12 (then 13 (return (i32.const -1)))) 14 (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected)) 15 (then 16 (local.set $from (i32.add (local.get $from) (i32.const 1))) 17 (br $cont)))) 18 (return (local.get $from))) 19 20 (func (export "test") 21 (memory.fill (i32.const 0xFF00) (i32.const 0x55) (i32.const 256)))) 22 (invoke "test") 23 24 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 65280) (i32.const 0)) 25 (i32.const -1)) 26 (assert_return (invoke "checkRange" (i32.const 65280) (i32.const 65536) (i32.const 85)) 27 (i32.const -1)) 28 (module 29 (memory 1 1) 30 31 (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32) 32 (loop $cont 33 (if (i32.eq (local.get $from) (local.get $to)) 34 (then 35 (return (i32.const -1)))) 36 (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected)) 37 (then 38 (local.set $from (i32.add (local.get $from) (i32.const 1))) 39 (br $cont)))) 40 (return (local.get $from))) 41 42 (func (export "test") 43 (memory.fill (i32.const 0xFF00) (i32.const 0x55) (i32.const 257)))) 44 (assert_trap (invoke "test") "out of bounds memory access") 45 46 (module 47 (memory 1 1) 48 49 (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32) 50 (loop $cont 51 (if (i32.eq (local.get $from) (local.get $to)) 52 (then 53 (return (i32.const -1)))) 54 (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected)) 55 (then 56 (local.set $from (i32.add (local.get $from) (i32.const 1))) 57 (br $cont)))) 58 (return (local.get $from))) 59 60 (func (export "test") 61 (memory.fill (i32.const 0xFFFFFF00) (i32.const 0x55) (i32.const 257)))) 62 (assert_trap (invoke "test") "out of bounds memory access") 63 64 (module 65 (memory 1 1) 66 67 (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32) 68 (loop $cont 69 (if (i32.eq (local.get $from) (local.get $to)) 70 (then 71 (return (i32.const -1)))) 72 (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected)) 73 (then 74 (local.set $from (i32.add (local.get $from) (i32.const 1))) 75 (br $cont)))) 76 (return (local.get $from))) 77 78 (func (export "test") 79 (memory.fill (i32.const 0x12) (i32.const 0x55) (i32.const 0)))) 80 (invoke "test") 81 82 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 65536) (i32.const 0)) 83 (i32.const -1)) 84 (module 85 (memory 1 1) 86 87 (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32) 88 (loop $cont 89 (if (i32.eq (local.get $from) (local.get $to)) 90 (then 91 (return (i32.const -1)))) 92 (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected)) 93 (then 94 (local.set $from (i32.add (local.get $from) (i32.const 1))) 95 (br $cont)))) 96 (return (local.get $from))) 97 98 (func (export "test") 99 (memory.fill (i32.const 0x10000) (i32.const 0x55) (i32.const 0)))) 100 (invoke "test") 101 102 (module 103 (memory 1 1) 104 105 (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32) 106 (loop $cont 107 (if (i32.eq (local.get $from) (local.get $to)) 108 (then 109 (return (i32.const -1)))) 110 (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected)) 111 (then 112 (local.set $from (i32.add (local.get $from) (i32.const 1))) 113 (br $cont)))) 114 (return (local.get $from))) 115 116 (func (export "test") 117 (memory.fill (i32.const 0x20000) (i32.const 0x55) (i32.const 0)))) 118 (assert_trap (invoke "test") "out of bounds memory access") 119 120 (module 121 (memory 1 1) 122 123 (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32) 124 (loop $cont 125 (if (i32.eq (local.get $from) (local.get $to)) 126 (then 127 (return (i32.const -1)))) 128 (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected)) 129 (then 130 (local.set $from (i32.add (local.get $from) (i32.const 1))) 131 (br $cont)))) 132 (return (local.get $from))) 133 134 (func (export "test") 135 (memory.fill (i32.const 0x1) (i32.const 0xAA) (i32.const 0xFFFE)))) 136 (invoke "test") 137 138 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0)) 139 (i32.const -1)) 140 (assert_return (invoke "checkRange" (i32.const 1) (i32.const 65535) (i32.const 170)) 141 (i32.const -1)) 142 (assert_return (invoke "checkRange" (i32.const 65535) (i32.const 65536) (i32.const 0)) 143 (i32.const -1)) 144 145 (module 146 (memory 1 1) 147 148 (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32) 149 (loop $cont 150 (if (i32.eq (local.get $from) (local.get $to)) 151 (then 152 (return (i32.const -1)))) 153 (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected)) 154 (then 155 (local.set $from (i32.add (local.get $from) (i32.const 1))) 156 (br $cont)))) 157 (return (local.get $from))) 158 159 (func (export "test") 160 (memory.fill (i32.const 0x12) (i32.const 0x55) (i32.const 10)) 161 (memory.fill (i32.const 0x15) (i32.const 0xAA) (i32.const 4)))) 162 (invoke "test") 163 164 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 18) (i32.const 0)) 165 (i32.const -1)) 166 (assert_return (invoke "checkRange" (i32.const 18) (i32.const 21) (i32.const 85)) 167 (i32.const -1)) 168 (assert_return (invoke "checkRange" (i32.const 21) (i32.const 25) (i32.const 170)) 169 (i32.const -1)) 170 (assert_return (invoke "checkRange" (i32.const 25) (i32.const 28) (i32.const 85)) 171 (i32.const -1)) 172 (assert_return (invoke "checkRange" (i32.const 28) (i32.const 65536) (i32.const 0)) 173 (i32.const -1)) 174 (assert_invalid 175 (module 176 (func (export "testfn") 177 (memory.fill (i32.const 10) (i32.const 20) (i32.const 30)))) 178 "unknown memory 0") 179 180 (assert_invalid 181 (module 182 (memory 1 1) 183 (func (export "testfn") 184 (memory.fill (i32.const 10) (i32.const 20) (f32.const 30)))) 185 "type mismatch") 186 187 (assert_invalid 188 (module 189 (memory 1 1) 190 (func (export "testfn") 191 (memory.fill (i32.const 10) (i32.const 20) (i64.const 30)))) 192 "type mismatch") 193 194 (assert_invalid 195 (module 196 (memory 1 1) 197 (func (export "testfn") 198 (memory.fill (i32.const 10) (i32.const 20) (f64.const 30)))) 199 "type mismatch") 200 201 (assert_invalid 202 (module 203 (memory 1 1) 204 (func (export "testfn") 205 (memory.fill (i32.const 10) (f32.const 20) (i32.const 30)))) 206 "type mismatch") 207 208 (assert_invalid 209 (module 210 (memory 1 1) 211 (func (export "testfn") 212 (memory.fill (i32.const 10) (f32.const 20) (f32.const 30)))) 213 "type mismatch") 214 215 (assert_invalid 216 (module 217 (memory 1 1) 218 (func (export "testfn") 219 (memory.fill (i32.const 10) (f32.const 20) (i64.const 30)))) 220 "type mismatch") 221 222 (assert_invalid 223 (module 224 (memory 1 1) 225 (func (export "testfn") 226 (memory.fill (i32.const 10) (f32.const 20) (f64.const 30)))) 227 "type mismatch") 228 229 (assert_invalid 230 (module 231 (memory 1 1) 232 (func (export "testfn") 233 (memory.fill (i32.const 10) (i64.const 20) (i32.const 30)))) 234 "type mismatch") 235 236 (assert_invalid 237 (module 238 (memory 1 1) 239 (func (export "testfn") 240 (memory.fill (i32.const 10) (i64.const 20) (f32.const 30)))) 241 "type mismatch") 242 243 (assert_invalid 244 (module 245 (memory 1 1) 246 (func (export "testfn") 247 (memory.fill (i32.const 10) (i64.const 20) (i64.const 30)))) 248 "type mismatch") 249 250 (assert_invalid 251 (module 252 (memory 1 1) 253 (func (export "testfn") 254 (memory.fill (i32.const 10) (i64.const 20) (f64.const 30)))) 255 "type mismatch") 256 257 (assert_invalid 258 (module 259 (memory 1 1) 260 (func (export "testfn") 261 (memory.fill (i32.const 10) (f64.const 20) (i32.const 30)))) 262 "type mismatch") 263 264 (assert_invalid 265 (module 266 (memory 1 1) 267 (func (export "testfn") 268 (memory.fill (i32.const 10) (f64.const 20) (f32.const 30)))) 269 "type mismatch") 270 271 (assert_invalid 272 (module 273 (memory 1 1) 274 (func (export "testfn") 275 (memory.fill (i32.const 10) (f64.const 20) (i64.const 30)))) 276 "type mismatch") 277 278 (assert_invalid 279 (module 280 (memory 1 1) 281 (func (export "testfn") 282 (memory.fill (i32.const 10) (f64.const 20) (f64.const 30)))) 283 "type mismatch") 284 285 (assert_invalid 286 (module 287 (memory 1 1) 288 (func (export "testfn") 289 (memory.fill (f32.const 10) (i32.const 20) (i32.const 30)))) 290 "type mismatch") 291 292 (assert_invalid 293 (module 294 (memory 1 1) 295 (func (export "testfn") 296 (memory.fill (f32.const 10) (i32.const 20) (f32.const 30)))) 297 "type mismatch") 298 299 (assert_invalid 300 (module 301 (memory 1 1) 302 (func (export "testfn") 303 (memory.fill (f32.const 10) (i32.const 20) (i64.const 30)))) 304 "type mismatch") 305 306 (assert_invalid 307 (module 308 (memory 1 1) 309 (func (export "testfn") 310 (memory.fill (f32.const 10) (i32.const 20) (f64.const 30)))) 311 "type mismatch") 312 313 (assert_invalid 314 (module 315 (memory 1 1) 316 (func (export "testfn") 317 (memory.fill (f32.const 10) (f32.const 20) (i32.const 30)))) 318 "type mismatch") 319 320 (assert_invalid 321 (module 322 (memory 1 1) 323 (func (export "testfn") 324 (memory.fill (f32.const 10) (f32.const 20) (f32.const 30)))) 325 "type mismatch") 326 327 (assert_invalid 328 (module 329 (memory 1 1) 330 (func (export "testfn") 331 (memory.fill (f32.const 10) (f32.const 20) (i64.const 30)))) 332 "type mismatch") 333 334 (assert_invalid 335 (module 336 (memory 1 1) 337 (func (export "testfn") 338 (memory.fill (f32.const 10) (f32.const 20) (f64.const 30)))) 339 "type mismatch") 340 341 (assert_invalid 342 (module 343 (memory 1 1) 344 (func (export "testfn") 345 (memory.fill (f32.const 10) (i64.const 20) (i32.const 30)))) 346 "type mismatch") 347 348 (assert_invalid 349 (module 350 (memory 1 1) 351 (func (export "testfn") 352 (memory.fill (f32.const 10) (i64.const 20) (f32.const 30)))) 353 "type mismatch") 354 355 (assert_invalid 356 (module 357 (memory 1 1) 358 (func (export "testfn") 359 (memory.fill (f32.const 10) (i64.const 20) (i64.const 30)))) 360 "type mismatch") 361 362 (assert_invalid 363 (module 364 (memory 1 1) 365 (func (export "testfn") 366 (memory.fill (f32.const 10) (i64.const 20) (f64.const 30)))) 367 "type mismatch") 368 369 (assert_invalid 370 (module 371 (memory 1 1) 372 (func (export "testfn") 373 (memory.fill (f32.const 10) (f64.const 20) (i32.const 30)))) 374 "type mismatch") 375 376 (assert_invalid 377 (module 378 (memory 1 1) 379 (func (export "testfn") 380 (memory.fill (f32.const 10) (f64.const 20) (f32.const 30)))) 381 "type mismatch") 382 383 (assert_invalid 384 (module 385 (memory 1 1) 386 (func (export "testfn") 387 (memory.fill (f32.const 10) (f64.const 20) (i64.const 30)))) 388 "type mismatch") 389 390 (assert_invalid 391 (module 392 (memory 1 1) 393 (func (export "testfn") 394 (memory.fill (f32.const 10) (f64.const 20) (f64.const 30)))) 395 "type mismatch") 396 397 (assert_invalid 398 (module 399 (memory 1 1) 400 (func (export "testfn") 401 (memory.fill (i64.const 10) (i32.const 20) (i32.const 30)))) 402 "type mismatch") 403 404 (assert_invalid 405 (module 406 (memory 1 1) 407 (func (export "testfn") 408 (memory.fill (i64.const 10) (i32.const 20) (f32.const 30)))) 409 "type mismatch") 410 411 (assert_invalid 412 (module 413 (memory 1 1) 414 (func (export "testfn") 415 (memory.fill (i64.const 10) (i32.const 20) (i64.const 30)))) 416 "type mismatch") 417 418 (assert_invalid 419 (module 420 (memory 1 1) 421 (func (export "testfn") 422 (memory.fill (i64.const 10) (i32.const 20) (f64.const 30)))) 423 "type mismatch") 424 425 (assert_invalid 426 (module 427 (memory 1 1) 428 (func (export "testfn") 429 (memory.fill (i64.const 10) (f32.const 20) (i32.const 30)))) 430 "type mismatch") 431 432 (assert_invalid 433 (module 434 (memory 1 1) 435 (func (export "testfn") 436 (memory.fill (i64.const 10) (f32.const 20) (f32.const 30)))) 437 "type mismatch") 438 439 (assert_invalid 440 (module 441 (memory 1 1) 442 (func (export "testfn") 443 (memory.fill (i64.const 10) (f32.const 20) (i64.const 30)))) 444 "type mismatch") 445 446 (assert_invalid 447 (module 448 (memory 1 1) 449 (func (export "testfn") 450 (memory.fill (i64.const 10) (f32.const 20) (f64.const 30)))) 451 "type mismatch") 452 453 (assert_invalid 454 (module 455 (memory 1 1) 456 (func (export "testfn") 457 (memory.fill (i64.const 10) (i64.const 20) (i32.const 30)))) 458 "type mismatch") 459 460 (assert_invalid 461 (module 462 (memory 1 1) 463 (func (export "testfn") 464 (memory.fill (i64.const 10) (i64.const 20) (f32.const 30)))) 465 "type mismatch") 466 467 (assert_invalid 468 (module 469 (memory 1 1) 470 (func (export "testfn") 471 (memory.fill (i64.const 10) (i64.const 20) (i64.const 30)))) 472 "type mismatch") 473 474 (assert_invalid 475 (module 476 (memory 1 1) 477 (func (export "testfn") 478 (memory.fill (i64.const 10) (i64.const 20) (f64.const 30)))) 479 "type mismatch") 480 481 (assert_invalid 482 (module 483 (memory 1 1) 484 (func (export "testfn") 485 (memory.fill (i64.const 10) (f64.const 20) (i32.const 30)))) 486 "type mismatch") 487 488 (assert_invalid 489 (module 490 (memory 1 1) 491 (func (export "testfn") 492 (memory.fill (i64.const 10) (f64.const 20) (f32.const 30)))) 493 "type mismatch") 494 495 (assert_invalid 496 (module 497 (memory 1 1) 498 (func (export "testfn") 499 (memory.fill (i64.const 10) (f64.const 20) (i64.const 30)))) 500 "type mismatch") 501 502 (assert_invalid 503 (module 504 (memory 1 1) 505 (func (export "testfn") 506 (memory.fill (i64.const 10) (f64.const 20) (f64.const 30)))) 507 "type mismatch") 508 509 (assert_invalid 510 (module 511 (memory 1 1) 512 (func (export "testfn") 513 (memory.fill (f64.const 10) (i32.const 20) (i32.const 30)))) 514 "type mismatch") 515 516 (assert_invalid 517 (module 518 (memory 1 1) 519 (func (export "testfn") 520 (memory.fill (f64.const 10) (i32.const 20) (f32.const 30)))) 521 "type mismatch") 522 523 (assert_invalid 524 (module 525 (memory 1 1) 526 (func (export "testfn") 527 (memory.fill (f64.const 10) (i32.const 20) (i64.const 30)))) 528 "type mismatch") 529 530 (assert_invalid 531 (module 532 (memory 1 1) 533 (func (export "testfn") 534 (memory.fill (f64.const 10) (i32.const 20) (f64.const 30)))) 535 "type mismatch") 536 537 (assert_invalid 538 (module 539 (memory 1 1) 540 (func (export "testfn") 541 (memory.fill (f64.const 10) (f32.const 20) (i32.const 30)))) 542 "type mismatch") 543 544 (assert_invalid 545 (module 546 (memory 1 1) 547 (func (export "testfn") 548 (memory.fill (f64.const 10) (f32.const 20) (f32.const 30)))) 549 "type mismatch") 550 551 (assert_invalid 552 (module 553 (memory 1 1) 554 (func (export "testfn") 555 (memory.fill (f64.const 10) (f32.const 20) (i64.const 30)))) 556 "type mismatch") 557 558 (assert_invalid 559 (module 560 (memory 1 1) 561 (func (export "testfn") 562 (memory.fill (f64.const 10) (f32.const 20) (f64.const 30)))) 563 "type mismatch") 564 565 (assert_invalid 566 (module 567 (memory 1 1) 568 (func (export "testfn") 569 (memory.fill (f64.const 10) (i64.const 20) (i32.const 30)))) 570 "type mismatch") 571 572 (assert_invalid 573 (module 574 (memory 1 1) 575 (func (export "testfn") 576 (memory.fill (f64.const 10) (i64.const 20) (f32.const 30)))) 577 "type mismatch") 578 579 (assert_invalid 580 (module 581 (memory 1 1) 582 (func (export "testfn") 583 (memory.fill (f64.const 10) (i64.const 20) (i64.const 30)))) 584 "type mismatch") 585 586 (assert_invalid 587 (module 588 (memory 1 1) 589 (func (export "testfn") 590 (memory.fill (f64.const 10) (i64.const 20) (f64.const 30)))) 591 "type mismatch") 592 593 (assert_invalid 594 (module 595 (memory 1 1) 596 (func (export "testfn") 597 (memory.fill (f64.const 10) (f64.const 20) (i32.const 30)))) 598 "type mismatch") 599 600 (assert_invalid 601 (module 602 (memory 1 1) 603 (func (export "testfn") 604 (memory.fill (f64.const 10) (f64.const 20) (f32.const 30)))) 605 "type mismatch") 606 607 (assert_invalid 608 (module 609 (memory 1 1) 610 (func (export "testfn") 611 (memory.fill (f64.const 10) (f64.const 20) (i64.const 30)))) 612 "type mismatch") 613 614 (assert_invalid 615 (module 616 (memory 1 1) 617 (func (export "testfn") 618 (memory.fill (f64.const 10) (f64.const 20) (f64.const 30)))) 619 "type mismatch") 620 621 (module 622 (memory 1 1 ) 623 624 (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32) 625 (loop $cont 626 (if (i32.eq (local.get $from) (local.get $to)) 627 (then 628 (return (i32.const -1)))) 629 (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected)) 630 (then 631 (local.set $from (i32.add (local.get $from) (i32.const 1))) 632 (br $cont)))) 633 (return (local.get $from))) 634 635 (func (export "run") (param $offs i32) (param $val i32) (param $len i32) 636 (memory.fill (local.get $offs) (local.get $val) (local.get $len)))) 637 638 (assert_trap (invoke "run" (i32.const 65280) (i32.const 37) (i32.const 512)) 639 "out of bounds memory access") 640 641 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0)) 642 (i32.const -1)) 643 (module 644 (memory 1 1 ) 645 646 (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32) 647 (loop $cont 648 (if (i32.eq (local.get $from) (local.get $to)) 649 (then 650 (return (i32.const -1)))) 651 (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected)) 652 (then 653 (local.set $from (i32.add (local.get $from) (i32.const 1))) 654 (br $cont)))) 655 (return (local.get $from))) 656 657 (func (export "run") (param $offs i32) (param $val i32) (param $len i32) 658 (memory.fill (local.get $offs) (local.get $val) (local.get $len)))) 659 660 (assert_trap (invoke "run" (i32.const 65279) (i32.const 37) (i32.const 514)) 661 "out of bounds memory access") 662 663 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0)) 664 (i32.const -1)) 665 (module 666 (memory 1 1 ) 667 668 (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32) 669 (loop $cont 670 (if (i32.eq (local.get $from) (local.get $to)) 671 (then 672 (return (i32.const -1)))) 673 (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected)) 674 (then 675 (local.set $from (i32.add (local.get $from) (i32.const 1))) 676 (br $cont)))) 677 (return (local.get $from))) 678 679 (func (export "run") (param $offs i32) (param $val i32) (param $len i32) 680 (memory.fill (local.get $offs) (local.get $val) (local.get $len)))) 681 682 (assert_trap (invoke "run" (i32.const 65279) (i32.const 37) (i32.const 4294967295)) 683 "out of bounds memory access") 684 685 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0)) 686 (i32.const -1))