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