1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14definitions: 15 - name: java 16 template: | 17 .language Java 18 19tests: 20 - file-name: "initobj.range" 21 isa: 22 title: Create new object and call initializer 23 description: | 24 Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their 25 default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to 26 the newly created object into accumulator. method_id should resolve to an initializer. 27 For methods with more arguments range kinds of instruction are to be used, which takes the needed number of 28 arguments starting from 'vs' register. 29 instructions: 30 - sig: initobj.range method_id, v:in:none 31 acc: out:ref 32 format: [op_v_8_id_16] 33 commands: 34 35 - file-name: "invalid_syntax" 36 isa: 37 verification: 38 - method_id_non_static 39 - method_id_accessible 40 - method_init_obj 41 runner-options: [compile-failure] 42 description: Check 'initobj.range' instruction with invalid method id. 43 header-template: [] 44 code-template: | 45 .record A { 46 i32 f32 47 A fA 48 i32[] f32Array 49 A[] fAArray 50 } 51 .function void A.c2(A a0, u32 a1, u32 a2) <ctor> { 52 return.void 53 } 54 .function void A.c1(A a0, u64 a1) <ctor> { 55 return.void 56 } 57 .function void A.c0(A a0) <ctor> { 58 return.void 59 } 60 .function void A.aFunc(A a0) { 61 return.void 62 } 63 .function i32 main() { 64 begin: 65 initobj.range %s 66 check-type: exit-positive 67 cases: 68 - values: 69 - "" 70 - values: 71 - "label:" 72 - values: 73 - "begin, v1" 74 - values: 75 - "{}" 76 - values: 77 - "}" 78 - values: 79 - "# comment" 80 - values: 81 - "null" 82 - values: 83 - "0, v1" 84 - values: 85 - "v0, v1" 86 - values: 87 - "i32, v1" 88 - values: 89 - i32[], v1 90 - values: 91 - "\"A\", v1" 92 - values: 93 - A, v1 94 - values: 95 - "A.f32, v1" 96 - values: 97 - "A.fA, v1" 98 - values: 99 - "A.f32Array, v1" 100 - values: 101 - "A.fAArray, v1" 102 - values: 103 - "A[], v1" 104 - values: 105 - "panda.Object[], v1" 106 - values: 107 - "aFunc, v1" 108 - values: 109 - "Object, v1" 110 - values: 111 - A.c2, v1, v2 112 - values: 113 - A.c2, a1, a2 114 - values: 115 - A.c2, 0, 1 116 - values: 117 - A.c1, a1, a2 118 - values: 119 - A.c1, v1, v2 120 - values: 121 - A.c1 122 - values: 123 - A.c0 124 125 126 - file-name: "uninitialized_regs_p" 127 isa: 128 instructions: 129 - sig: initobj.range method_id, v:in:none 130 acc: out:ref 131 format: [op_v_8_id_16] 132 runner-options: ['verifier-failure', 'verifier-debug-config'] 133 tags: [verifier] 134 description: Check 'initobj.range' instruction with uninitialized registers in PandaAssembly context. 135 header-template: [] 136 code-template: | 137 .record panda.Object <external> 138 .record panda.String <external> 139 .record R {} 140 .function void R.ctor(R a0, %s) <ctor> { 141 return.void 142 } 143 .function i32 main() { 144 %s 145 check-type: exit-positive 146 cases: 147 - values: 148 # v1 not initialized 149 - i32 a1 150 - initobj.range R.ctor, v1 151 - values: 152 # v2 not initialized 153 - i64 a1, f64 a2 154 - | 155 # 156 movi.64 v1, 1 157 initobj.range R.ctor, v1 158 - values: 159 # v3 not initialized 160 - i32[] a1, panda.Object a2, R[] a3 161 - | 162 # 163 movi v1, 10 164 newarr v1, v1, i32[] 165 mov.null v2 166 initobj.range R.ctor, v1 167 - values: 168 # v130 not initialized 169 - R a1, panda.String a2, f64 a3, panda.Object a4 170 - | 171 # 172 mov.null v127 173 lda.str "test string" 174 sta.obj v128 175 fmovi.64 v129, 3.14 176 initobj.range R.ctor, v127 177 - values: 178 # v252, v253, v254, v255 not initialized 179 - u1 a1, u8 a2, u16 a3, u32 a4 180 - initobj.range R.ctor, v252 181 182 183 - file-name: "reg_v_invalid" 184 isa: 185 instructions: 186 - sig: initobj.range method_id, v:in:none 187 acc: out:ref 188 format: [op_v_8_id_16] 189 runner-options: [compile-failure] 190 description: Check 'initobj.range' instruction with invalid 'v' register numbers. 191 header-template: [] 192 code-template: | 193 .record R {} 194 .function void R.c(R a0, i32 a1, i32 a2, i32 a3, i32 a4, i32 a5) <ctor> { 195 return.void 196 } 197 # 198 .function i32 main() { 199 initobj.range R.c, %s 200 check-type: exit-positive 201 cases: 202 - values: 203 - v252 204 runner-options: ['verifier-failure', 'verifier-debug-config'] 205 tags: [verifier] 206 - values: 207 - v255 208 runner-options: ['verifier-failure', 'verifier-debug-config'] 209 tags: [verifier] 210 - values: 211 - v256 212 - values: 213 - v65532 214 - values: 215 - v65535 216 - values: 217 - v65536 218 219 220 - file-name: "reg_a_invalid" 221 isa: 222 instructions: 223 - sig: initobj.range method_id, v:in:none 224 acc: out:ref 225 format: [op_v_8_id_16] 226 runner-options: [compile-failure] 227 description: Check 'initobj.range' instruction with invalid 'a' register numbers. 228 header-template: [] 229 code-template: | 230 .record R {} 231 .function void R.c(R a0, i32 a1, i32 a2, i32 a3, i32 a4) <ctor> { 232 return.void 233 } 234 .function void func(i32 a0, i32 a1, i32 a2, i32 a3, i32 a4, i32 a5, i32 a6, i32 a7, i32 a8, i32 a9, i32 a10, i32 a11, i32 a12, i32 a13, i32 a14, i32 a15) { 235 initobj.range R.c, %s 236 return.void 237 } 238 # 239 .function i32 main() { 240 call.range func, v0 241 check-type: exit-positive 242 cases: 243 - values: 244 - a13 245 runner-options: ['verifier-failure', 'verifier-debug-config'] 246 tags: [verifier] 247 - values: 248 - a14 249 runner-options: ['verifier-failure', 'verifier-debug-config'] 250 tags: [verifier] 251 - values: 252 - a16 253 - values: 254 - a255 255 - values: 256 - a256 257 - values: 258 - a65535 259 - values: 260 - a65536 261 262 263 - file-name: "reg_v_valid" 264 isa: 265 instructions: 266 - sig: initobj.range method_id, v:in:none 267 acc: out:ref 268 format: [op_v_8_id_16] 269 description: Check 'initobj.range' instruction with valid 'v' register numbers. 270 header-template: [] 271 code-template: | 272 .record R {} 273 .function void R.c(R a0, i32 a1, i32 a2, i32 a3, i32 a4, i32 a5) <ctor> { 274 return.void 275 } 276 # 277 .function i32 main() { 278 movi %s, 100 279 movi %s, 200 280 movi %s, 300 281 movi %s, 400 282 movi %s, 500 283 lda.null 284 initobj.range R.c, %s 285 jnez.obj ok 286 ldai 1 287 return 288 ok: 289 check-type: exit-positive 290 cases: 291 - values: [v0, v1, v2, v3, v4, v0] 292 - values: [v100, v101, v102, v103, v104, v100] 293 - values: [v200, v201, v202, v203, v204, v200] 294 - values: [v251, v252, v253, v254, v255, v251] 295 296 297 - file-name: "reg_a_valid" 298 isa: 299 instructions: 300 - sig: initobj.range method_id, v:in:none 301 acc: out:ref 302 format: [op_v_8_id_16] 303 runner-options: ['verifier-only', 'verifier-debug-config'] 304 tags: ['verifier'] 305 description: Check 'initobj.range' instruction with valid 'a' register numbers. 306 header-template: [] 307 code-template: | 308 .record R {} 309 .function void R.c5(R a0, i32 a1, i32 a2, i32 a3, i32 a4, i32 a5) <ctor> { 310 return.void 311 } 312 .function void R.c16(R a0, i32 a1, i32 a2, i32 a3, i32 a4, i32 a5, i32 a6, i32 a7, i32 a8, i32 a9, i32 a10, i32 a11, i32 a12, i32 a13, i32 a14, i32 a15) <ctor> { 313 return.void 314 } 315 .function void func(i32 a0, i32 a1, i32 a2, i32 a3, i32 a4, i32 a5, i32 a6, i32 a7, i32 a8, i32 a9, i32 a10, i32 a11, i32 a12, i32 a13, i32 a14, i32 a15) { 316 initobj.range R.c5, a0 317 initobj.range R.c5, a11 318 initobj.range R.c16, a0 319 return.void 320 } 321 # 322 .function i32 main() { 323 movi v0, 0 324 movi v1, 1 325 movi v2, 2 326 movi v3, 3 327 movi v4, 4 328 movi v5, 5 329 movi v6, 6 330 movi v7, 7 331 movi v8, 8 332 movi v9, 9 333 movi v10, 10 334 movi v11, 11 335 movi v12, 12 336 movi v13, 13 337 movi v14, 14 338 movi v15, 15 339 call.range func, v0 340 check-type: exit-positive 341 342 343 - file-name: "invalid_ctor_p" 344 isa: 345 verification: 346 - method_id_non_static 347 - method_id_accessible 348 - method_init_obj 349 runner-options: ['verifier-failure', 'verifier-debug-config'] 350 tags: [verifier] 351 description: Check 'initobj.range' instruction with invalid initializer in PandaAssembly context. 352 header-template: [] 353 code-template: | 354 .record R {} 355 %s 356 .function i32 main() { 357 %s 358 check-type: exit-positive 359 cases: 360 # static functions 361 - values: 362 - "" 363 - | 364 # 365 movi v1, 1 366 initobj.range main, v1 367 bugid: ['3585'] 368 ignore: true 369 - values: 370 - | 371 .function void R.cctor() <cctor> { 372 return.void 373 } 374 - | 375 # 376 movi v255, 0 377 initobj.range R.cctor, v255 378 bugid: ['3585'] 379 ignore: true 380 - values: 381 - | 382 .function void R.cctor(i32 a0) <cctor> { 383 return.void 384 } 385 - | 386 # 387 movi v1, 1 388 initobj.range R.cctor, v1 389 - values: 390 - | 391 .function void R.ctor() <ctor> { 392 return.void 393 } 394 .function void R.cctor(R a0, i32 a1) <cctor> { 395 return.void 396 } 397 - | 398 # 399 initobj R.ctor 400 sta.obj v0 401 movi v1, 1 402 initobj.range R.cctor, v0 403 - values: 404 - | 405 .function void R.cctor(R a0, i32 a1) <cctor> { 406 return.void 407 } 408 - | 409 # 410 movi v1, 1 411 initobj.range R.cctor, v1 412 bugid: ['3585'] 413 ignore: true 414 - values: 415 - | 416 .function void R.statFunc() <static> { 417 return.void 418 } 419 - | 420 # 421 movi v1, 0 422 initobj.range R.statFunc, v1 423 bugid: ['3585'] 424 ignore: true 425 - values: 426 - | 427 .function void R.statFunc(i32 a0) <static> { 428 return.void 429 } 430 - | 431 # 432 movi v1, 0 433 initobj.range R.statFunc, v1 434 - values: 435 - | 436 .function void R.ctor() <ctor> { 437 return.void 438 } 439 .function void R.statFunc(R a0, i32 a1) <static> { 440 return.void 441 } 442 - | 443 # 444 initobj R.ctor 445 sta.obj v0 446 movi v1, 0 447 initobj.range R.statFunc, v0 448 - values: 449 - | 450 .function void R.statFunc(R a0, i32 a1) <static> { 451 return.void 452 } 453 - | 454 # 455 movi v1, 0 456 initobj.range R.statFunc, v1 457 bugid: ['3585'] 458 ignore: true 459 # virtual functions, not initializers 460 - values: 461 - | 462 .function void R.virtFunc(R a0, i32 a1) { 463 return.void 464 } 465 - | 466 # 467 movi v7, 0 468 initobj.range R.virtFunc, v7 469 bugid: ['3585'] 470 ignore: true 471 - values: 472 - | 473 .function void R.ctor() <ctor> { 474 return.void 475 } 476 .function void R.virtFunc(R a0, i32 a1) { 477 return.void 478 } 479 - | 480 # 481 initobj R.ctor # should be ok 482 sta.obj v0 483 movi v1, 1 484 initobj.range R.virtFunc, v0 # should fail 485 bugid: ['3585'] 486 ignore: true 487 - values: 488 - | 489 .record panda.NullPointerException <external> 490 .record panda.String <external> 491 .function panda.String panda.NullPointerException.getMessage(panda.NullPointerException a0) <external> 492 - | 493 # 494 mov.null v1 495 initobj.range panda.NullPointerException.getMessage, v1 496 bugid: ['3585'] 497 ignore: true 498 - values: 499 - | 500 .function void R.ctor() <ctor> { 501 return.void 502 } 503 .record panda.NullPointerException <external> 504 .record panda.String <external> 505 .record panda.Object <external> 506 .function void panda.NullPointerException.ctor(panda.NullPointerException a0, panda.String a1, panda.Object a2) <external, ctor> 507 .function panda.String panda.NullPointerException.getMessage(panda.NullPointerException a0) <external> 508 - | 509 # 510 lda.str "message" 511 sta.obj v1 512 initobj R.ctor # should be ok 513 sta.obj v2 514 initobj.range panda.NullPointerException.ctor, v1 # should be ok 515 sta.obj v0 516 initobj.range panda.NullPointerException.getMessage, v0 # should fail 517 bugid: ['3585'] 518 ignore: true 519 # inaccessible methods 520 - values: 521 - .function void R.extFunc(R a0) <external> 522 - | 523 # 524 mov.null v1 525 initobj.range R.extFunc, v1 526 bugid: ['3585'] 527 ignore: true 528 - values: 529 - .function void R.extFunc(R a0, R a1) <external> 530 - | 531 # 532 mov.null v1 533 initobj.range R.extFunc, v1 534 bugid: ['3585'] 535 ignore: true 536 - values: 537 - .function void R.nativeFunc(R a0) <native> 538 - | 539 # 540 mov.null v1 541 initobj.range R.nativeFunc, v1 542 bugid: ['3585'] 543 ignore: true 544 - values: 545 - .function void R.nativeFunc(R a0, R a1) <native> 546 - | 547 # 548 mov.null v1 549 initobj.range R.nativeFunc, v1 550 bugid: ['3585'] 551 ignore: true 552 - values: 553 - .function void R.noimplFunc(R a0) <noimpl> 554 - | 555 # 556 mov.null v1 557 initobj.range R.noimplFunc, v1 558 bugid: ['3585'] 559 ignore: true 560 - values: 561 - .function void R.noimplFunc(R a0, R a1) <noimpl> 562 - | 563 # 564 mov.null v1 565 initobj.range R.noimplFunc, v1 566 bugid: ['3585'] 567 ignore: true 568 # ctor without return 569 - values: 570 - .function void R.ctorNoReturn(R a0) <ctor> {} 571 - | 572 # 573 mov.null v1 574 initobj.range R.ctorNoReturn, v1 575 bugid: ['3585'] 576 ignore: true 577 - values: 578 - .function void R.ctorNoReturn(R a0, R a1) <ctor> {} 579 - | 580 # 581 mov.null v1 582 initobj.range R.ctorNoReturn, v1 583 bugid: ['3585'] 584 ignore: true 585 586 587 - file-name: "incompatible_args_p" 588 isa: 589 verification: 590 - compatible_arguments 591 runner-options: ['verifier-failure', 'verifier-debug-config'] 592 tags: [verifier] 593 description: Check 'initobj.range' instruction with initializer called with incompatible arguments in PandaAssembly context. 594 header-template: [] 595 code-template: | 596 .record panda.Object <external> 597 .record panda.Class <external> 598 .record panda.String <external> 599 .record R {} 600 .function void R.constructor(R a0, %s a1) <ctor> { 601 return.void 602 } 603 604 .function i32 main() { 605 *s 606 initobj.range R.constructor, v1 607 check-type: exit-positive 608 template-cases: 609 - values: 610 - u1 611 exclude: [i32] 612 - values: 613 - u8 614 exclude: [i32] 615 - values: 616 - i8 617 exclude: [i32] 618 - values: 619 - u16 620 exclude: [i32] 621 - values: 622 - i16 623 exclude: [i32] 624 - values: 625 - u32 626 exclude: [i32] 627 - values: 628 - u64 629 exclude: [i64] 630 - values: 631 - f32 632 exclude: [f64] 633 - values: 634 - u32[] 635 exclude: [u32a, nul] 636 - values: 637 - u64[] 638 exclude: [u64a, nul] 639 - values: 640 - f32[] 641 exclude: [f32a, nul] 642 - values: 643 - u32[][] 644 exclude: [u32aa, nul] 645 - values: 646 - u64[][] 647 exclude: [u64aa, nul] 648 - values: 649 - f32[][] 650 exclude: [f32aa, nul] 651 - values: 652 - R 653 exclude: [nul] 654 - values: 655 - panda.String 656 exclude: [str, nul] 657 - values: 658 - panda.Class 659 exclude: [typ, nul] 660 - values: 661 - panda.Object 662 exclude: [u32a, u64a, f32a, u32aa, u64aa, f32aa, str, typ, ra, stra, typa, obja, raa, straa, typaa, objaa, nul] 663 - values: 664 - R[] 665 exclude: [ra, nul] 666 - values: 667 - panda.String[] 668 exclude: [stra, nul] 669 - values: 670 - panda.Class[] 671 exclude: [typa, nul] 672 - values: 673 - panda.Object[] 674 exclude: [obja, u32aa, u64aa, f32aa, ra, stra, typa, raa, straa, typaa, objaa, nul] 675 - values: 676 - R[][] 677 exclude: [raa, nul] 678 - values: 679 - panda.String[][] 680 exclude: [straa, nul] 681 - values: 682 - panda.Class[][] 683 exclude: [typaa, nul] 684 - values: 685 - panda.Object[][] 686 exclude: [objaa, raa, straa, typaa, nul] 687 cases: 688 - values: 689 - movi v1, 1 690 id: i32 691 - values: 692 - movi.64 v1, 1 693 id: i64 694 - values: 695 - fmovi.64 v1, 1.0 696 id: f64 697 - values: 698 - | 699 # 700 movi v1, 10 701 newarr v1, v1, u32[] 702 id: u32a 703 - values: 704 - | 705 # 706 movi v1, 10 707 newarr v1, v1, u64[] 708 id: u64a 709 - values: 710 - | 711 # 712 movi v1, 10 713 newarr v1, v1, f32[] 714 id: f32a 715 - values: 716 - | 717 # 718 movi v1, 10 719 newarr v1, v1, u32[][] 720 id: u32aa 721 - values: 722 - | 723 # 724 movi v1, 10 725 newarr v1, v1, u64[][] 726 id: u64aa 727 - values: 728 - | 729 # 730 movi v1, 10 731 newarr v1, v1, f32[][] 732 id: f32aa 733 - values: 734 - | 735 # 736 lda.str "test message" 737 sta.obj v1 738 id: str 739 - values: 740 - | 741 # 742 lda.type R 743 sta.obj v1 744 id: typ 745 - values: 746 - | 747 # 748 movi v1, 10 749 newarr v1, v1, R[] 750 id: ra 751 - values: 752 - | 753 # 754 movi v1, 10 755 newarr v1, v1, panda.String[] 756 id: stra 757 - values: 758 - | 759 # 760 movi v1, 10 761 newarr v1, v1, panda.Class[] 762 id: typa 763 - values: 764 - | 765 # 766 movi v1, 10 767 newarr v1, v1, panda.Object[] 768 id: obja 769 - values: 770 - | 771 # 772 movi v1, 10 773 newarr v1, v1, R[][] 774 id: raa 775 - values: 776 - | 777 # 778 movi v1, 10 779 newarr v1, v1, panda.String[][] 780 id: straa 781 - values: 782 - | 783 # 784 movi v1, 10 785 newarr v1, v1, panda.Class[][] 786 id: typaa 787 - values: 788 - | 789 # 790 movi v1, 10 791 newarr v1, v1, panda.Object[][] 792 id: objaa 793 - values: 794 - mov.null v1 795 id: nul 796 797 798 - file-name: "compatible_primitive_args_p" 799 isa: 800 verification: 801 - compatible_arguments 802 runner-options: ['verifier-only', 'verifier-debug-config'] 803 tags: [verifier] 804 description: Check 'initobj.range' instruction with initializer called with compatible primitive arguments in PandaAssembly context. 805 header-template: [] 806 code-template: | 807 .record R {} 808 .function void R.constructor(R a0, %s a1) <ctor> { 809 return.void 810 } 811 .function i32 main() { 812 %s 813 initobj.range R.constructor, v1 814 check-type: exit-positive 815 cases: 816 - values: 817 - u1 818 - movi v1, 1 819 - values: 820 - u8 821 - movi v1, 1 822 - values: 823 - i8 824 - movi v1, 1 825 - values: 826 - u16 827 - movi v1, 1 828 - values: 829 - i16 830 - movi v1, 1 831 - values: 832 - u32 833 - movi v1, 1 834 - values: 835 - i32 836 - movi v1, 1 837 - values: 838 - i64 839 - movi.64 v1, 1 840 - values: 841 - u64 842 - movi.64 v1, 1 843 - values: 844 - f32 845 - fmovi.64 v1, 1.1 846 - values: 847 - f64 848 - fmovi.64 v1, 1.1 849 850 851 - file-name: "compatible_prim_array_args_p" 852 isa: 853 verification: 854 - compatible_arguments 855 runner-options: ['verifier-only', 'verifier-debug-config'] 856 tags: [verifier] 857 description: Check 'initobj.range' instruction with initializer called with compatible primitive array arguments in PandaAssembly context. 858 header-template: [] 859 code-template: | 860 .record R {} 861 .function void R.constructor(R a0, %s a1) <ctor> { 862 return.void 863 } 864 .function i32 main() { 865 movi v0, 10 866 newarr v1, v0, %s 867 initobj.range R.constructor, v1 868 check-type: exit-positive 869 cases: 870 - values: 871 - "u1[]" 872 - "u1[]" 873 - values: 874 - "u8[]" 875 - "u8[]" 876 - values: 877 - "i8[]" 878 - "i8[]" 879 - values: 880 - "u16[]" 881 - "u16[]" 882 - values: 883 - "i16[]" 884 - "i16[]" 885 - values: 886 - "u32[]" 887 - "u32[]" 888 - values: 889 - "i32[]" 890 - "i32[]" 891 - values: 892 - "u64[]" 893 - "u64[]" 894 - values: 895 - "i64[]" 896 - "i64[]" 897 - values: 898 - "f32[]" 899 - "f32[]" 900 - values: 901 - "f64[]" 902 - "f64[]" 903 - values: 904 - "u1[][]" 905 - "u1[][]" 906 - values: 907 - "u8[][]" 908 - "u8[][]" 909 - values: 910 - "i8[][]" 911 - "i8[][]" 912 - values: 913 - "u16[][]" 914 - "u16[][]" 915 - values: 916 - "i16[][]" 917 - "i16[][]" 918 - values: 919 - "u32[][]" 920 - "u32[][]" 921 - values: 922 - "i32[][]" 923 - "i32[][]" 924 - values: 925 - "u64[][]" 926 - "u64[][]" 927 - values: 928 - "i64[][]" 929 - "i64[][]" 930 - values: 931 - "f32[][]" 932 - "f32[][]" 933 - values: 934 - "f64[][]" 935 - "f64[][]" 936 937 938 - file-name: "compatible_obj_args_p" 939 isa: 940 verification: 941 - compatible_arguments 942 runner-options: ['verifier-only', 'verifier-debug-config'] 943 tags: [verifier] 944 description: Check 'initobj.range' instruction with initializer called with compatible object arguments in PandaAssembly context. 945 header-template: [] 946 code-template: | 947 .record panda.Object <external> 948 .record panda.Class <external> 949 .record panda.String <external> 950 .record Q {} 951 .function void Q.ctor(Q a0, u8 a1) <ctor> { 952 return.void 953 } 954 .record R {} 955 .function void R.constructor(R a0, %s a1) <ctor> { 956 return.void 957 } 958 .function i32 main() { 959 %s 960 initobj.range R.constructor, v1 961 check-type: exit-positive 962 cases: 963 # Object of type O is instance of type T if O is the same as T ... 964 - values: 965 - Q 966 - | 967 # 968 movi v1, 1 969 initobj.range Q.ctor, v1 970 sta.obj v1 971 - values: 972 - panda.String 973 - | 974 # 975 lda.str "test" 976 sta.obj v1 977 - values: 978 - panda.Class 979 - | 980 # 981 lda.type Q 982 sta.obj v1 983 # ... or is subtype of T 984 - values: 985 - panda.Object 986 - | 987 # 988 movi v1, 1 989 initobj.range Q.ctor, v1 990 sta.obj v1 991 - values: 992 - panda.Object 993 - | 994 # 995 lda.str "test" 996 sta.obj v1 997 - values: 998 - panda.Object 999 - | 1000 # 1001 lda.type Q 1002 sta.obj v1 1003 id: cls 1004 bugid: ["3594"] 1005 ignore: true 1006 # For arrays T should be a root type in type hierarchy ... 1007 - values: 1008 - panda.Object 1009 - | 1010 # 1011 movi v0, 10 1012 newarr v1, v0, i32[] 1013 - values: 1014 - panda.Object 1015 - | 1016 # 1017 movi v0, 10 1018 newarr v1, v0, f64[][] 1019 - values: 1020 - panda.Object 1021 - | 1022 # 1023 movi v0, 10 1024 newarr v1, v0, Q[] 1025 - values: 1026 - panda.Object 1027 - | 1028 # 1029 movi v0, 10 1030 newarr v1, v0, panda.Object[] 1031 - values: 1032 - panda.Object 1033 - | 1034 # 1035 movi v0, 10 1036 newarr v1, v0, panda.String[] 1037 - values: 1038 - panda.Object 1039 - | 1040 # 1041 movi v0, 10 1042 newarr v1, v0, panda.Class[] 1043 1044 1045 - file-name: "compatible_obj_array_args_p" 1046 isa: 1047 verification: 1048 - compatible_arguments 1049 runner-options: ['verifier-only', 'verifier-debug-config'] 1050 tags: [verifier] 1051 description: Check 'initobj.range' instruction with initializer called with compatible object array arguments in PandaAssembly context. 1052 header-template: [] 1053 code-template: | 1054 .record panda.Object <external> 1055 .record panda.Class <external> 1056 .record panda.String <external> 1057 .record Q {} 1058 .record R {} 1059 .function void R.constructor(R a0, %s a1) <ctor> { 1060 return.void 1061 } 1062 .function i32 main() { 1063 movi v0, 10 1064 newarr v1, v0, %s 1065 initobj.range R.constructor, v1 1066 check-type: exit-positive 1067 cases: 1068 # T is such array that O array elements are the same as T array elements 1069 - values: 1070 - Q[] 1071 - Q[] 1072 - values: 1073 - Q[][] 1074 - Q[][] 1075 - values: 1076 - "panda.Object[]" 1077 - "panda.Object[]" 1078 - values: 1079 - "panda.Object[][]" 1080 - "panda.Object[][]" 1081 - values: 1082 - panda.String[] 1083 - panda.String[] 1084 - values: 1085 - panda.String[][] 1086 - panda.String[][] 1087 - values: 1088 - panda.Class[] 1089 - panda.Class[] 1090 - values: 1091 - panda.Class[][] 1092 - panda.Class[][] 1093 # T is such array that O array elements are subtypes of T array elements 1094 - values: 1095 - "panda.Object[]" 1096 - "panda.Object[][]" 1097 bugid: ["3608"] 1098 ignore: true 1099 - values: 1100 - "panda.Object[]" 1101 - Q[] 1102 bugid: ["3608"] 1103 ignore: true 1104 - values: 1105 - "panda.Object[]" 1106 - Q[][] 1107 bugid: ["3608"] 1108 ignore: true 1109 - values: 1110 - "panda.Object[]" 1111 - panda.Class[] 1112 bugid: ["3608"] 1113 ignore: true 1114 - values: 1115 - "panda.Object[]" 1116 - panda.Class[][] 1117 bugid: ["3608"] 1118 ignore: true 1119 - values: 1120 - "panda.Object[]" 1121 - panda.String[] 1122 bugid: ["3608"] 1123 ignore: true 1124 - values: 1125 - "panda.Object[]" 1126 - panda.String[][] 1127 bugid: ["3608"] 1128 ignore: true 1129 - values: 1130 - "panda.Object[]" 1131 - i32[][] 1132 bugid: ["3608"] 1133 ignore: true 1134 - values: 1135 - "panda.Object[]" 1136 - f64[][][] 1137 bugid: ["3608"] 1138 ignore: true 1139 # inherited types from panda.Object[][] 1140 - values: 1141 - "panda.Object[][]" 1142 - panda.Object[][][] 1143 bugid: ["3608"] 1144 ignore: true 1145 - values: 1146 - "panda.Object[][]" 1147 - panda.Class[][] 1148 bugid: ["3608"] 1149 ignore: true 1150 - values: 1151 - "panda.Object[][]" 1152 - panda.Class[][][] 1153 bugid: ["3608"] 1154 ignore: true 1155 - values: 1156 - "panda.Object[][]" 1157 - i32[][][] 1158 bugid: ["3608"] 1159 ignore: true 1160 - values: 1161 - "panda.Object[][]" 1162 - f64[][][][] 1163 bugid: ["3608"] 1164 ignore: true 1165 1166 1167 - file-name: "compatible_obj_null_args_p" 1168 isa: 1169 verification: 1170 - compatible_arguments 1171 runner-options: ['verifier-only', 'verifier-debug-config'] 1172 tags: [verifier] 1173 description: Check 'initobj.range' instruction with initializer called with null object ref in PandaAssembly context. 1174 header-template: [] 1175 code-template: | 1176 .record panda.Object <external> 1177 .record panda.Class <external> 1178 .record panda.String <external> 1179 .record Q {} 1180 .record R {} 1181 .function void R.constructor(R a0, %s a1) <ctor> { 1182 return.void 1183 } 1184 .function i32 main() { 1185 mov.null v1 1186 initobj.range R.constructor, v1 1187 check-type: exit-positive 1188 cases: 1189 - values: ["i32[]"] 1190 - values: ["f64[][]"] 1191 - values: ["panda.Object"] 1192 - values: ["panda.Object[]"] 1193 - values: ["panda.Object[][]"] 1194 - values: ["Q"] 1195 - values: ["Q[][]"] 1196 - values: ["panda.String"] 1197 - values: ["panda.String[]"] 1198 - values: ["panda.Class"] 1199 - values: ["panda.Class[]"] 1200 1201 1202 - file-name: "valid_instance_p" 1203 isa: 1204 description: | 1205 Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their 1206 default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to 1207 the newly created object into accumulator. method_id should resolve to an initializer. 1208 description: Check 'initobj.range' with valid method id creates expected instance type in PandaAssembly context. 1209 header-template: [] 1210 code-template: | 1211 .record panda.Object <external> 1212 .record panda.String <external> 1213 .record R {} 1214 .function void R.ctor1(R a0, i32 a1) <ctor> { 1215 return.void 1216 } 1217 .function R[] R.ctor1x(R a0, i32 a1) <ctor> { 1218 movi v0, 10 1219 newarr v0, v0, R[] 1220 lda.obj v0 1221 return.obj 1222 } 1223 .function void R.ctor2(R a0, i16 a1, R a2) <ctor> { 1224 return.void 1225 } 1226 .function R R.ctor2x(R a0, i16 a1, R a2) <ctor> { 1227 lda.null 1228 return.obj 1229 } 1230 .function void R.ctor3(R a0, i32[] a1, R[] a2, i8 a3) <ctor> { 1231 return.void 1232 } 1233 .function panda.Object[] R.ctor3x(R a0, i32[] a1, R[] a2, i8 a3) <ctor> { 1234 movi v0, 10 1235 newarr v0, v0, panda.Object[] 1236 lda.obj v0 1237 return.obj 1238 } 1239 .function void R.ctor4(R a0, R[][] a1, R[] a2, i32 a3, f64 a4) <ctor> { 1240 return.void 1241 } 1242 .record panda.NullPointerException <external> 1243 .function void panda.NullPointerException.ctor(panda.NullPointerException a0, panda.String a1, panda.Object a2) <external, ctor> 1244 1245 .function i32 main() { 1246 # sample data to put in arguments: v1 - v7 1247 movi v1, 1 1248 mov.null v2 1249 movi v0, 10 1250 newarr v3, v0, R[] 1251 movi v4, 0x7f 1252 fmovi.64 v5, 3.14 1253 lda.str "exception message" 1254 sta.obj v6 1255 mov.null v7 1256 1257 # create the object 1258 initobj.range %s 1259 jnez.obj chk1 1260 ldai 1 1261 return 1262 chk1: 1263 sta.obj v0 1264 isinstance %s 1265 jeq v1, chk2 1266 ldai 2 1267 return 1268 chk2: 1269 lda.obj v0 1270 isinstance panda.Object 1271 jeq v1, ok 1272 ldai 3 1273 return 1274 ok: 1275 check-type: exit-positive 1276 cases: 1277 - values: 1278 - R.ctor1, v1 1279 - R 1280 tags: ['tsan'] 1281 - values: 1282 - R.ctor1x, v1 1283 - R 1284 - values: 1285 - R.ctor2, v1 1286 - R 1287 - values: 1288 - R.ctor2x, v1 1289 - R 1290 - values: 1291 - R.ctor3, v2 1292 - R 1293 - values: 1294 - R.ctor3x, v2 1295 - R 1296 tags: ['tsan'] 1297 - values: 1298 - R.ctor4, v2 1299 - R 1300 - values: 1301 - panda.NullPointerException.ctor, v6 1302 - panda.NullPointerException 1303 1304 1305 - file-name: "check_args_num_p" 1306 isa: 1307 instructions: 1308 - sig: initobj.range method_id, v:in:none 1309 acc: out:ref 1310 format: [op_v_8_id_16] 1311 description: Check 'initobj.range' constructor behavior with various number of arguments in PandaAssembly context. 1312 header-template: [] 1313 code-template: | 1314 .record R { 1315 i32 f1 1316 i32 f2 1317 i32 f3 1318 i32 f4 1319 i32 f5 1320 } 1321 .function void R.ctor1(R a0, i32 a1) <ctor> { 1322 lda a1 1323 stobj a0, R.f1 1324 return.void 1325 } 1326 .function void R.ctor2(R a0, i32 a1, i32 a2) <ctor> { 1327 lda a1 1328 stobj a0, R.f1 1329 lda a2 1330 stobj a0, R.f2 1331 return.void 1332 } 1333 .function void R.ctor3(R a0, i32 a1, i32 a2, i32 a3) <ctor> { 1334 lda a1 1335 stobj a0, R.f1 1336 lda a2 1337 stobj a0, R.f2 1338 lda a3 1339 stobj a0, R.f3 1340 return.void 1341 } 1342 .function void R.ctor4(R a0, i32 a1, i32 a2, i32 a3, i32 a4) <ctor> { 1343 lda a1 1344 stobj a0, R.f1 1345 lda a2 1346 stobj a0, R.f2 1347 lda a3 1348 stobj a0, R.f3 1349 lda a4 1350 stobj a0, R.f4 1351 return.void 1352 } 1353 .function void R.ctor5(R a0, i32 a1, i32 a2, i32 a3, i32 a4, i32 a5) <ctor> { 1354 lda a1 1355 stobj a0, R.f1 1356 lda a2 1357 stobj a0, R.f2 1358 lda a3 1359 stobj a0, R.f3 1360 lda a4 1361 stobj a0, R.f4 1362 lda a5 1363 stobj a0, R.f5 1364 return.void 1365 } 1366 .function i32 main() { 1367 # sample data to put in args 1368 movi v1, 10 1369 movi v2, 20 1370 movi v3, 30 1371 movi v4, 40 1372 movi v5, 50 1373 movi v6, 60 1374 movi v7, 70 1375 movi v8, 80 1376 movi v9, 90 1377 # create the object 1378 %s 1379 sta.obj v0 1380 lab1: 1381 ldobj v0, R.f1 1382 movi v7, %s 1383 jeq v7, lab2 1384 ldai 1 1385 return 1386 lab2: 1387 ldobj v0, R.f2 1388 movi v7, %s 1389 jeq v7, lab3 1390 ldai 2 1391 return 1392 lab3: 1393 ldobj v0, R.f3 1394 movi v7, %s 1395 jeq v7, lab4 1396 ldai 3 1397 return 1398 lab4: 1399 ldobj v0, R.f4 1400 movi v7, %s 1401 jeq v7, lab5 1402 ldai 4 1403 return 1404 lab5: 1405 ldobj v0, R.f5 1406 movi v7, %s 1407 jeq v7, ok 1408 ldai 4 1409 return 1410 ok: 1411 check-type: exit-positive 1412 cases: 1413 - values: ["initobj.range R.ctor1, v1", 10, 0, 0, 0, 0] 1414 - values: ["initobj.range R.ctor2, v2", 20, 30, 0, 0, 0] 1415 - values: ["initobj.range R.ctor3, v3", 30, 40, 50, 0, 0] 1416 - values: ["initobj.range R.ctor4, v4", 40, 50, 60, 70, 0] 1417 - values: ["initobj.range R.ctor5, v5", 50, 60, 70, 80, 90] 1418 1419 1420 - file-name: "check_last_regs_p" 1421 isa: 1422 instructions: 1423 - sig: initobj.range method_id, v:in:none 1424 acc: out:ref 1425 format: [op_v_8_id_16] 1426 description: Check 'initobj.range' constructor with last of 255 arguments in PandaAssembly context. 1427 header-template: [] 1428 code-template: | 1429 .record Z { 1430 %s 1431 } 1432 .function void Z.ctor(Z a0%s) <ctor> { 1433 %s 1434 return.void 1435 } 1436 .function i32 main() { 1437 %s 1438 initobj.range Z.ctor, v%s 1439 sta.obj v0 1440 %s 1441 lbl256: 1442 check-type: exit-positive 1443 cases: 1444 - values: 1445 - "#{[*1..10].map do |i| \" i32 f#{i}\\n\" end .join}" 1446 - "#{[*1..10].map do |i| \", i32 a#{i}\" end .join}" 1447 - "#{[*1..10].map do |i| \" lda a#{i}\\n stobj a0, Z.f#{i}\\n\" end .join}" 1448 - "#{[*1..10].map do |i| \" movi v#{i+245}, #{i}\\n\" end .join}" 1449 - "246" 1450 - "#{[*1..10].map do |i| \"lbl#{i+245}:\\n ldobj v0, Z.f#{i}\\n jeq v#{i+245}, lbl#{i+246}\\n ldai #{i}\\n return\\n\" end .join}" 1451 - values: 1452 - "#{[*1..254].map do |i| \" i32 f#{i}\\n\" end .join}" 1453 - "#{[*1..254].map do |i| \", i32 a#{i}\" end .join}" 1454 - "#{[*1..254].map do |i| \" lda a#{i}\\n stobj a0, Z.f#{i}\\n\" end .join}" 1455 - "#{[*1..254].map do |i| \" movi v#{i+1}, #{i}\\n\" end .join}" 1456 - "2" 1457 - "#{[*1..254].map do |i| \"lbl#{i+1}:\\n ldobj v0, Z.f#{i}\\n jeq v#{i+1}, lbl#{i+2}\\n ldai #{i}\\n return\\n\" end .join}" 1458 bugid: ['3796'] 1459 - values: 1460 - "#{[*1..255].map do |i| \" i32 f#{i}\\n\" end .join}" 1461 - "#{[*1..255].map do |i| \", i32 a#{i}\" end .join}" 1462 - "#{[*1..255].map do |i| \" lda a#{i}\\n stobj a0, Z.f#{i}\\n\" end .join}" 1463 - "#{[*1..255].map do |i| \" movi v#{i}, #{i}\\n\" end .join}" 1464 - "1" 1465 - "#{[*1..255].map do |i| \"lbl#{i}:\\n ldobj v0, Z.f#{i}\\n jeq v#{i}, lbl#{i+1}\\n ldai #{i}\\n return\\n\" end .join}" 1466 bugid: ['3855'] 1467 ignore: true 1468 1469 1470 - file-name: "check_all_32bit_types_p" 1471 isa: 1472 instructions: 1473 - sig: initobj.range method_id, v:in:none 1474 acc: out:ref 1475 format: [op_v_8_id_16] 1476 description: Check 'initobj.range' constructor behavior with primitive 32bit argument types in PandaAssembly context. 1477 header-template: [] 1478 code-template: | 1479 .record Z { 1480 %s f 1481 } 1482 .function void Z.ctor1(Z a0, i32 a1) <ctor> { 1483 return.void 1484 } 1485 .function void Z.ctor2(Z a0, %s a1) <ctor> { 1486 lda a1 1487 stobj a0, Z.f 1488 return.void 1489 } 1490 .function i32 main() { 1491 movi v1, -1 1492 initobj.range Z.ctor1, v1 1493 sta.obj v0 1494 ldobj v0, Z.f 1495 jeqz chk2 1496 ldai 1 1497 return 1498 chk2: 1499 movi v1, %s 1500 initobj.range Z.ctor2, v1 1501 sta.obj v0 1502 ldobj v0, Z.f 1503 %s 1504 jeqz ok 1505 ldai 2 1506 return 1507 ok: 1508 check-type: exit-positive 1509 cases: 1510 - values: 1511 - u1 1512 - u1 1513 - 1 1514 - | 1515 # 1516 jne v1, exit_failure 1517 ldai 0 1518 return 1519 exit_failure: 1520 ldai 1 1521 return 1522 - values: 1523 - u1 1524 - u1 1525 - 0 1526 - | 1527 # 1528 jne v1, exit_failure 1529 ldai 0 1530 return 1531 exit_failure: 1532 ldai 1 1533 return 1534 - values: [u8, u8, 0, ucmp v1] 1535 - values: [u8, u8, 0x000000ff, ucmp v1] 1536 - values: [u8, u8, 0x0000005a, ucmp v1] 1537 - values: 1538 - i8 1539 - i8 1540 - 0 1541 - | 1542 # 1543 jne v1, exit_failure 1544 ldai 0 1545 return 1546 exit_failure: 1547 ldai 1 1548 return 1549 - values: 1550 - i8 1551 - i8 1552 - 0xffffffff 1553 - | 1554 # 1555 jne v1, exit_failure 1556 ldai 0 1557 return 1558 exit_failure: 1559 ldai 1 1560 return 1561 - values: 1562 - i8 1563 - i8 1564 - 0x0000005a 1565 - | 1566 # 1567 jne v1, exit_failure 1568 ldai 0 1569 return 1570 exit_failure: 1571 ldai 1 1572 return 1573 tags: ['tsan'] 1574 - values: [u16, u16, 0, ucmp v1] 1575 - values: [u16, u16, 0x0000ffff, ucmp v1] 1576 - values: [u16, u16, 0x00005a5a, ucmp v1] 1577 - values: 1578 - i16 1579 - i16 1580 - 0 1581 - | 1582 # 1583 jne v1, exit_failure 1584 ldai 0 1585 return 1586 exit_failure: 1587 ldai 1 1588 return 1589 - values: 1590 - i16 1591 - i16 1592 - 0xffffffff 1593 - | 1594 # 1595 jne v1, exit_failure 1596 ldai 0 1597 return 1598 exit_failure: 1599 ldai 1 1600 return 1601 - values: 1602 - i16 1603 - i16 1604 - 0x00005a5a 1605 - | 1606 # 1607 jne v1, exit_failure 1608 ldai 0 1609 return 1610 exit_failure: 1611 ldai 1 1612 return 1613 - values: [u32, u32, 0, ucmp v1] 1614 - values: [u32, u32, 0xffffffff, ucmp v1] 1615 - values: [u32, u32, 0x5a5a5a5a, ucmp v1] 1616 - values: 1617 - i32 1618 - i32 1619 - 0 1620 - | 1621 # 1622 jne v1, exit_failure 1623 ldai 0 1624 return 1625 exit_failure: 1626 ldai 1 1627 return 1628 - values: 1629 - i32 1630 - i32 1631 - 0xffffffff 1632 - | 1633 # 1634 jne v1, exit_failure 1635 ldai 0 1636 return 1637 exit_failure: 1638 ldai 1 1639 return 1640 - values: 1641 - i32 1642 - i32 1643 - 0x5a5a5a5a 1644 - | 1645 # 1646 jne v1, exit_failure 1647 ldai 0 1648 return 1649 exit_failure: 1650 ldai 1 1651 return 1652 tags: ['tsan'] 1653 1654 1655 - file-name: "check_int_64bit_types_p" 1656 isa: 1657 instructions: 1658 - sig: initobj.range method_id, v:in:none 1659 acc: out:ref 1660 format: [op_v_8_id_16] 1661 description: Check 'initobj.range' constructor behavior with primitive integer 64bit argument types in PandaAssembly context. 1662 header-template: [] 1663 code-template: | 1664 .record Z { 1665 %s f 1666 } 1667 .function void Z.ctor1(Z a0, u64 a1) <ctor> { 1668 return.void 1669 } 1670 .function void Z.ctor2(Z a0, %s a1) <ctor> { 1671 lda.64 a1 1672 stobj.64 a0, Z.f 1673 return.void 1674 } 1675 .function i32 main() { 1676 movi.64 v1, 0xffffffffffffffff 1677 initobj.range Z.ctor1, v1 1678 sta.obj v0 1679 ldobj.64 v0, Z.f 1680 movi.64 v1, 0 1681 %s 1682 jeqz chk2 1683 ldai 1 1684 return 1685 chk2: 1686 movi.64 v1, %s 1687 initobj.range Z.ctor2, v1 1688 sta.obj v0 1689 ldobj.64 v0, Z.f 1690 %s 1691 jeqz ok 1692 ldai 2 1693 return 1694 ok: 1695 check-type: exit-positive 1696 cases: 1697 - values: [u64, u64, ucmp.64 v1, 0, ucmp.64 v1] 1698 - values: [u64, u64, ucmp.64 v1, 0xffffffffffffffff, ucmp.64 v1] 1699 - values: [u64, u64, ucmp.64 v1, 0x5a5a5a5a5a5a5a5a, ucmp.64 v1] 1700 tags: ['tsan'] 1701 - values: [i64, i64, ucmp.64 v1, 0, cmp.64 v1] 1702 - values: [i64, i64, ucmp.64 v1, 0xffffffffffffffff, cmp.64 v1] 1703 - values: [i64, i64, ucmp.64 v1, 0x5a5a5a5a5a5a5a5a, cmp.64 v1] 1704 1705 1706 - file-name: "check_float_types_p" 1707 isa: 1708 instructions: 1709 - sig: initobj.range method_id, v:in:none 1710 acc: out:ref 1711 format: [op_v_8_id_16] 1712 description: Check 'initobj.range' constructor behavior with primitive float argument types in PandaAssembly context. 1713 header-template: [] 1714 code-template: | 1715 .record Z { 1716 f64 f 1717 } 1718 .function void Z.ctor1(Z a0, f64 a1) <ctor> { 1719 return.void 1720 } 1721 .function void Z.ctor2(Z a0, f64 a1) <ctor> { 1722 lda.64 a1 1723 stobj.64 a0, Z.f 1724 return.void 1725 } 1726 .function i32 main() { 1727 fmovi.64 v1, -1.0 1728 initobj.range Z.ctor1, v1 1729 sta.obj v0 1730 ldobj.64 v0, Z.f 1731 fmovi.64 v1, 0.0 1732 fcmpg.64 v1 1733 jeqz chk2 1734 ldai 1 1735 return 1736 chk2: 1737 fmovi.64 v1, %s 1738 initobj.range Z.ctor2, v1 1739 sta.obj v0 1740 ldobj.64 v0, Z.f 1741 fcmpg.64 v1 1742 jeqz ok 1743 ldai 2 1744 return 1745 ok: 1746 check-type: exit-positive 1747 cases: 1748 - values: [0.0] 1749 - values: [4.625] 1750 - values: [-4.625] 1751 - values: [0xfff0000000000000] # -Inf 1752 - values: [0x7ff0000000000000] # +Inf 1753 tags: ['tsan'] 1754 - values: [0x7ff8000000000000] 1755 - values: [0x7ff8000000000010] 1756 - values: [0x7fffffffffffffff] 1757 - values: [0xffffffffffffffff] 1758 tags: ['tsan'] 1759 1760 - file-name: "check_float32_type_p" 1761 isa: 1762 instructions: 1763 - sig: initobj.range method_id, v:in:none 1764 acc: out:ref 1765 format: [op_v_8_id_16] 1766 description: Check 'initobj.range' constructor behavior with primitive float argument types in PandaAssembly context. 1767 header-template: [] 1768 code-template: | 1769 .record Z { 1770 f32 f 1771 } 1772 .function void Z.ctor1(Z a0, f32 a1) <ctor> { 1773 return.void 1774 } 1775 .function void Z.ctor2(Z a0, f32 a1) <ctor> { 1776 lda.64 a1 1777 stobj a0, Z.f 1778 return.void 1779 } 1780 .function i32 main() { 1781 fmovi v1, -1.0 1782 initobj.range Z.ctor1, v1 1783 sta.obj v0 1784 ldobj v0, Z.f 1785 fmovi v1, 0.0 1786 fcmpg v1 1787 jeqz chk2 1788 ldai 1 1789 return 1790 chk2: 1791 fmovi v1, %s 1792 initobj.range Z.ctor2, v1 1793 sta.obj v0 1794 ldobj v0, Z.f 1795 fcmpg v1 1796 jeqz ok 1797 ldai 2 1798 return 1799 ok: 1800 check-type: exit-positive 1801 cases: 1802 - values: [0.0] 1803 - values: [4.625] 1804 - values: [-4.625] 1805 - values: [0xff800000] # -Inf 1806 - values: [0x7f800000] # +Inf 1807 - values: [0x7fc00000] 1808 - values: [0x7fc00010] 1809 tags: ['tsan'] 1810 - values: [0x7fffffff] 1811 - values: [0xffffffff] 1812 1813 - file-name: "check_obj_types_p" 1814 isa: 1815 instructions: 1816 - sig: initobj.range method_id, v:in:none 1817 acc: out:ref 1818 format: [op_v_8_id_16] 1819 description: Check 'initobj.range' constructor behavior with several object type arguments in PandaAssembly context. 1820 header-template: [] 1821 code-template: | 1822 .record panda.Object <external> 1823 .record panda.Class <external> 1824 .record panda.String <external> 1825 .record Z { 1826 %s f 1827 } 1828 .function void Z.ctor1(Z a0, Z a1) <ctor> { 1829 return.void 1830 } 1831 .function void Z.ctor2(Z a0, %s a1) <ctor> { 1832 lda.obj a1 1833 stobj.obj a0, Z.f 1834 return.void 1835 } 1836 .function i32 main() { 1837 mov.null v1 1838 initobj.range Z.ctor1, v1 1839 sta.obj v0 1840 ldobj.obj v0, Z.f 1841 jeqz.obj chk2 1842 ldai 1 1843 return 1844 chk2: 1845 %s 1846 sta.obj v1 1847 initobj.range Z.ctor2, v1 1848 sta.obj v0 1849 ldobj.obj v0, Z.f 1850 jeq.obj v1, ok 1851 ldai 2 1852 return 1853 ok: 1854 check-type: exit-positive 1855 cases: 1856 - values: [panda.String, panda.String, lda.str "test"] 1857 - values: [panda.Object, panda.String, lda.str "test"] 1858 - values: [panda.Class, panda.Class, lda.type Z] 1859 - values: 1860 - panda.Object 1861 - panda.Class 1862 - lda.type Z 1863 bugid: ["3594"] 1864 ignore: true 1865 - values: [panda.Object, panda.Object, "initobj.range Z.ctor1, v1"] 1866 - values: [panda.String, panda.String, lda.null] 1867 tags: ['tsan'] 1868 - values: 1869 - "i32[]" 1870 - "i32[]" 1871 - | 1872 # 1873 movi v7, 10 1874 newarr v7, v7, i32[] 1875 lda.obj v7 1876 - values: 1877 - "i64[]" 1878 - "i64[]" 1879 - | 1880 # 1881 movi v7, 10 1882 newarr v7, v7, i64[] 1883 lda.obj v7 1884 - values: 1885 - "panda.String[]" 1886 - "panda.String[]" 1887 - | 1888 # 1889 movi v7, 10 1890 newarr v7, v7, panda.String[] 1891 lda.obj v7 1892 - values: 1893 - Z[] 1894 - Z[] 1895 - | 1896 # 1897 movi v7, 10 1898 newarr v7, v7, Z[] 1899 lda.obj v7 1900 - values: 1901 - panda.Object 1902 - u1[] 1903 - | 1904 # 1905 movi v7, 10 1906 newarr v7, v7, u1[] 1907 lda.obj v7 1908 - values: 1909 - panda.Object 1910 - panda.Object[] 1911 - | 1912 # 1913 movi v7, 10 1914 newarr v7, v7, Z[] 1915 lda.obj v7 1916 bugid: ['3608'] 1917 ignore: true 1918 - values: 1919 - panda.Object[] 1920 - panda.Object[] 1921 - | 1922 # 1923 movi v7, 10 1924 newarr v7, v7, Z[][] 1925 lda.obj v7 1926 bugid: ['3608'] 1927 ignore: true 1928 1929 1930 - file-name: 'oome_p' 1931 isa: 1932 exceptions: 1933 - x_oom 1934 description: Create objects with 'initobj.range' instruction until OutOfMemoryError in PandaAssembly context 1935 header-template: [] 1936 panda-options: "--heap-size-limit=67108864" 1937 bugid: ['3578', '4170', '4171'] 1938 ignore: true 1939 code-template: | 1940 .record panda.OutOfMemoryError <external> 1941 .record Z { 1942 %s 1943 } 1944 .function void Z.ctor(Z a0, Z a1) <ctor> { 1945 return.void 1946 } 1947 .function i32 main() { 1948 movi v7, 50000 # array size 1949 newarr v6, v7, Z[] # array ref 1950 movi v1, 0 # index 1951 mov.null v0 # null, dummy arg 1952 begin: 1953 initobj.range Z.ctor, v0 1954 starr.obj v6, v1 1955 inci v1, 1 1956 lda v1 1957 jlt v7, begin 1958 end: 1959 ldai 1 # Should not reach this line 1960 return 1961 1962 catch_OOME: 1963 ldai 0 # Expected panda.OutOfMemoryError 1964 return 1965 1966 catch_all: 1967 ldai 2 # Unexpected exception, test failed 1968 return 1969 1970 .catch panda.OutOfMemoryError, begin, end, catch_OOME 1971 .catchall begin, end, catch_all 1972 check-type: none 1973 cases: 1974 - values: 1975 - "#{[*1..500].map do |i| \" f64 f#{i}\\n\" end .join}" 1976 tags: ['tsan'] 1977 1978 1979 - file-name: 'ame_p' 1980 isa: 1981 exceptions: 1982 - x_abstract 1983 description: Create objects with 'initobj.range' instruction with AbstractMethodError in PandaAssembly context 1984 header-template: [] 1985 bugid: ['3625'] 1986 code-template: | 1987 .record panda.AbstractMethodError <external> 1988 .record Z {} 1989 .function void Z.ctor1(Z a0, i32 a1) <ctor, noimpl> 1990 .function void Z.ctor2(Z a0, i32 a1, i32 a2) <ctor> { 1991 return.void 1992 } 1993 .function void Z.ctor3(Z a0, i32 a1, i32 a2, i32 a3) <ctor> { 1994 return.void 1995 } 1996 .function void Z.ctor4(Z a0, i32 a1, i32 a2, i32 a3, i32 a4) <ctor, noimpl> 1997 .function i32 main() { 1998 begin: 1999 %s 2000 initobj.range %s 2001 end: 2002 ldai 1 # Should not reach this line 2003 return 2004 2005 catch_AME: 2006 ldai 0 # Expected panda.AbstractMethodError 2007 return 2008 2009 catch_all: 2010 ldai 2 # Unexpected exception, test failed 2011 return 2012 2013 .catch panda.AbstractMethodError, begin, end, catch_AME 2014 .catchall begin, end, catch_all 2015 check-type: none 2016 cases: 2017 - values: 2018 - movi v8, 800 2019 - Z.ctor1, v8 2020 tags: ['tsan'] 2021 - values: 2022 - | 2023 # 2024 movi v1, 10 2025 movi v2, 20 2026 movi v3, 30 2027 movi v4, 40 2028 - Z.ctor4, v1 2029 2030 2031 - file-name: "regs_restored_p" 2032 isa: 2033 description: | 2034 Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their 2035 default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to 2036 the newly created object into accumulator. method_id should resolve to an initializer. 2037 description: Check 'initobj.range' that registers are restored after the initializer call PandaAssembly context. 2038 tags: ['tsan'] 2039 header-template: [] 2040 code-template: | 2041 .record R {} 2042 .function void R.ctor(R a0, i16 a1, i32 a2, i16 a3, i32 a4, i32 a5, i32 a6, i32 a7, i32 a8, i32 a9, i32 a10) <ctor> { 2043 movi a1, -100 2044 movi a2, -200 2045 movi a3, -300 2046 movi a4, -400 2047 movi v0, 100 2048 movi v1, 200 2049 movi v2, 300 2050 movi v3, 400 2051 movi v4, 500 2052 movi v5, 600 2053 movi v6, 700 2054 movi v7, 800 2055 movi v8, 900 2056 movi v9, 1000 2057 movi v10, 1100 2058 movi v11, 1200 2059 movi v12, 1300 2060 movi v13, 1400 2061 movi v14, 1500 2062 movi v15, 1600 2063 return.void 2064 } 2065 .function i32 main() { 2066 movi v0, 1 2067 movi v1, 2 2068 movi v2, 3 2069 movi v3, 4 2070 movi v4, 5 2071 movi v5, 6 2072 movi v6, 7 2073 movi v7, 8 2074 movi v8, 9 2075 movi v9, 10 2076 movi v10, 11 2077 movi v11, 12 2078 movi v12, 13 2079 movi v13, 14 2080 movi v14, 15 2081 movi v15, 16 2082 initobj.range R.ctor, v0 2083 initobj.range R.ctor, v6 2084 ldai 1 2085 jeq v0, ok1 2086 return 2087 ok1: 2088 ldai 2 2089 jeq v1, ok2 2090 return 2091 ok2: 2092 ldai 3 2093 jeq v2, ok3 2094 return 2095 ok3: 2096 ldai 4 2097 jeq v3, ok4 2098 return 2099 ok4: 2100 ldai 5 2101 jeq v4, ok5 2102 return 2103 ok5: 2104 ldai 6 2105 jeq v5, ok6 2106 return 2107 ok6: 2108 ldai 7 2109 jeq v6, ok7 2110 return 2111 ok7: 2112 ldai 8 2113 jeq v7, ok8 2114 return 2115 ok8: 2116 ldai 9 2117 jeq v8, ok9 2118 return 2119 ok9: 2120 ldai 10 2121 jeq v9, ok10 2122 return 2123 ok10: 2124 ldai 11 2125 jeq v10, ok11 2126 return 2127 ok11: 2128 ldai 12 2129 jeq v11, ok12 2130 return 2131 ok12: 2132 ldai 13 2133 jeq v12, ok13 2134 return 2135 ok13: 2136 ldai 14 2137 jeq v13, ok14 2138 return 2139 ok14: 2140 ldai 15 2141 jeq v14, ok15 2142 return 2143 ok15: 2144 ldai 16 2145 jeq v15, ok16 2146 return 2147 ok16: 2148 check-type: exit-positive 2149 2150 2151 - file-name: "valid_static_initializer_p" 2152 isa: 2153 description: | 2154 Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their 2155 default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to 2156 the newly created object into accumulator. method_id should resolve to an initializer. 2157 description: Check 'initobj.range' with static initializer in PandaAssembly context. 2158 tags: ['tsan'] 2159 header-template: [] 2160 code-template: | 2161 .record R { 2162 i32 cnt <static> 2163 } 2164 .function void R.ctor(R a0, i32 a1) <ctor> { 2165 ldstatic R.cnt 2166 addi 1 2167 ststatic R.cnt 2168 return.void 2169 } 2170 .function void R.cctor() <cctor> { 2171 ldstatic R.cnt 2172 addi 1 2173 ststatic R.cnt 2174 return.void 2175 } 2176 .function i32 main() { 2177 movi v1, 0 2178 initobj.range R.ctor, v1 2179 initobj.range R.ctor, v1 2180 ldstatic R.cnt 2181 movi v0, 3 2182 jeq v0, ok 2183 ldai 20 2184 return 2185 ok: 2186 check-type: exit-positive 2187 2188 2189