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