1# Copyright (c) 2021-2022 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: PandaAssembly 16 template: > 17 .language PandaAssembly 18 - name: r_A 19 template: | 20 .record A {} 21 22 .function void A.constructor(A a0) <ctor> { 23 return.void 24 } 25 - name: r_B 26 template: | 27 .record B {} 28 29 .function void B.constructor(B a0) <ctor> { 30 return.void 31 } 32 33tests: 34 - file-name: call.virt.negative 35 isa: 36 instructions: 37 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 38 acc: out:top 39 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 40 title: Object calls 41 description: > 42 Call indicated object method, i.e. create new frame, pass values of arguments and 43 continue execution from the first instruction of a method. 44 Callee should treat accumulator value as undefined and cannot use it until accumulator 45 definition in the new frame. 46 Result (if any) is returned in accumulator (see 'Calling sequence' chapter for more details). 47 Method, its class and the number of argument is resolved by given method_id in runtime 48 constant-pool based on object reference using language-specific semantics (currently only PandaAssembly 49 virtual methods are supported, further extensions are TBD). 50 Object reference is passed in the first source register, arguments are passed starting from 51 the second source register in the same order as in method signature. 52 Non-range instructions can be used to pass up to 4 arguments (including object reference). 53 Unused register slot values will be discarded and corresponding registers will not be 54 passed to the callee). 55 For methods with more arguments range kinds of instruction are to be used, which takes 56 the needed number of arguments starting from 'vs' register (including object reference). 57 verification: 58 - method_id_non_static 59 - compatible_arguments 60 - method_id_accessible 61 exceptions: 62 - x_null 63 - x_abstract 64 commands: 65 66 - file-name: wrong_object_1 67 bugid: ['2287', '5271'] 68 isa: 69 instructions: 70 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 71 acc: out:top 72 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 73 verification: 74 - compatible_arguments 75 header-template: [r_A, r_B] 76 description: Check incorrect usage of `call.virt` instruction. First argument is of incorrect type instead of object reference. 77 runner-options: ['verifier-failure', 'verifier-config'] 78 tags: ['verifier'] 79 code-template: | 80 .function i32 A.foo(A a0%s) { 81 ldai 1 82 return 83 } 84 85 .function i32 main() { 86 %s 87 call.virt A.foo%s 88 # check object is equal to original 89 90 check-type: exit-positive 91 cases: 92 - values: 93 - '' 94 - '' 95 - ',' 96 runner-options: [compile-failure] 97 bugid: ['1855'] 98 - values: 99 - '' 100 - 'movi v0, 0' 101 - ', v0' 102 - values: 103 - '' 104 - | 105 # 106 lda.type A 107 sta.obj v0 108 - ', v0' 109 bugid: ['2256'] 110 - values: 111 - '' 112 - | 113 # 114 lda.type B 115 sta.obj v0 116 - ', v0' 117 - values: 118 - '' 119 - 'movi.64 v0, 0' 120 - ', v0' 121 - values: 122 - '' 123 - 'fmovi.64 v0, 0' 124 - ', v0' 125 - values: 126 - '' 127 - | 128 # 129 lda.str "some string" 130 sta.obj v0 131 - ', v0' 132 - values: 133 - '' 134 - | 135 # 136 lda.str "some string" 137 sta.obj v0 138 movi v1, 1 139 - ', v0, v1' 140 - values: 141 - '' 142 - | 143 # 144 lda.str "some string" 145 sta.obj v0 146 movi.64 v1, 1 147 - ', v0, v1' 148 - values: 149 - '' 150 - | 151 # 152 lda.str "some string" 153 sta.obj v0 154 fmovi.64 v1, 1 155 - ', v0, v1' 156 - values: 157 - ', i32 a1' 158 - | 159 # 160 movi v0, 0 161 movi v1, 1 162 - ', v0, v1' 163 - values: 164 - ', i64 a1' 165 - | 166 # 167 movi v0, 0 168 movi.64 v1, 1 169 - ', v0, v1' 170 - values: 171 - ', f64 a1' 172 - | 173 # 174 movi v0, 0 175 fmovi.64 v1, 1.1 176 - ', v0, v1' 177 178 - values: 179 - ', i32 a1' 180 - | 181 # 182 movi.64 v0, 0 183 movi v1, 1 184 - ', v0, v1' 185 - values: 186 - ', i64 a1' 187 - | 188 # 189 movi.64 v0, 0 190 movi.64 v1, 1 191 - ', v0, v1' 192 - values: 193 - ', f64 a1' 194 - | 195 # 196 movi.64 v0, 0 197 fmovi.64 v1, 1.1 198 - ', v0, v1' 199 200 - values: 201 - ', i32 a1' 202 - | 203 # 204 fmovi.64 v0, 0.0 205 movi v1, 1 206 - ', v0, v1' 207 - values: 208 - ', i64 a1' 209 - | 210 # 211 fmovi.64 v0, 0 212 movi.64 v1, 1 213 - ', v0, v1' 214 - values: 215 - ', f64 a1' 216 - | 217 # 218 fmovi.64 v0, 0 219 fmovi.64 v1, 1.1 220 - ', v0, v1' 221 222 - values: 223 - ', i32 a1, f64 a2, i64 a3' 224 - | 225 # 226 fmovi.64 v0, 0.0 227 movi v1, 1 228 fmovi.64 v2, 123.456 229 movi.64 v3, 0x100000000 230 - ', v0, v1, v2, v3' 231 - values: 232 - ', i64 a1, i64[] a2, i64[] a3' 233 - | 234 # 235 fmovi.64 v0, 0 236 movi.64 v1, 1 237 mov.null v2 238 mov.null v3 239 - ', v0, v1, v2, v3' 240 - values: 241 - ', f64[] a1, i64[] a2, i32[] a3' 242 - | 243 # 244 fmovi.64 v0, 0 245 mov.null v1 246 mov.null v2 247 mov.null v3 248 - ', v0, v1, v2, v3' 249 250 - file-name: j_wrong_object_2 251 isa: 252 instructions: 253 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 254 acc: out:top 255 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 256 verification: 257 - compatible_arguments 258 header-template: [PandaAssembly, r_A, r_B] 259 description: > 260 Check incorrect usage of `call.virt` instruction. First argument is a reference to object of incompatible type. 261 Use PandaAssembly language context. 262 runner-options: [use-pa, verifier-failure, verifier-config] 263 tags: ['verifier', pa-verifier] 264 bugid: ['1324', '3293', '5271', '6886'] 265 template-cases: 266 - values: 267 - | 268 %s 269 .function i32 A.foo(A a0%s) { 270 ldai 1 271 return 272 } 273 - values: 274 - | 275 %s 276 ##- %s 277 .function i32 A.foo(A a0) { 278 ldai 1 279 return 280 } 281 code-template: | 282 %s 283 284 .function i32 main() { 285 initobj.short B.constructor 286 sta.obj v0 287 *s 288 call.virt A.foo, v0*s 289 check-type: exit-positive 290 cases: 291 - values: 292 - '' 293 - '' 294 - '' 295 - '' 296 - values: 297 - '' 298 - ',i32 a1' 299 - 'movi v1, 0' 300 - ', v1' 301 - values: 302 - '' 303 - ',i32 a1' 304 - 'movi v1, 1' 305 - ', v1' 306 - values: 307 - '' 308 - ', i64 a1' 309 - 'movi.64 v1, 0' 310 - ', v1' 311 - values: 312 - '' 313 - ', i64 a1' 314 - 'movi.64 v1, 0x100000000' 315 - ', v1' 316 - values: 317 - '' 318 - ', f64 a1' 319 - 'fmovi.64 v1, 0' 320 - ', v1' 321 - values: 322 - '' 323 - ', f64 a1' 324 - 'fmovi.64 v1, 1.1' 325 - ', v1' 326 - values: 327 - '.record panda.String <external>' 328 - ', panda.String a1' 329 - | 330 # 331 lda.str "some string" 332 sta.obj v1 333 - ', v1' 334 - values: 335 - '' 336 - ', i32 a1, f64 a2, i64 a3' 337 - | 338 # 339 movi v1, 1 340 fmovi.64 v2, 123.456 341 movi.64 v3, 0x100000000 342 - ', v1, v2, v3' 343 - values: 344 - '' 345 - ', i64 a1, i64[] a2, i64[] a3' 346 - | 347 # 348 movi.64 v1, 1 349 mov.null v2 350 mov.null v3 351 - ', v1, v2, v3' 352 - values: 353 - '' 354 - ', f64[] a1, i64[] a2, i32[] a3' 355 - | 356 # 357 mov.null v1 358 mov.null v2 359 mov.null v3 360 - ', v1, v2, v3' 361 362 - file-name: p_wrong_object_2 363 isa: 364 instructions: 365 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 366 acc: out:top 367 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 368 verification: 369 - compatible_arguments 370 header-template: [r_A, r_B] 371 description: > 372 Check incorrect usage of `call.virt` instruction. First argument is a reference to object of incompatible type. 373 Use PandaAssembly language context. 374 runner-options: ['verifier-failure', 'verifier-config'] 375 tags: [verifier] 376 bugid: ['1324'] 377 template-cases: 378 - values: 379 - | 380 %s 381 .function i32 A.foo(A a0%s) { 382 ldai 1 383 return 384 } 385 - values: 386 - | 387 %s 388 ##- %s 389 .function i32 A.foo(A a0) { 390 ldai 1 391 return 392 } 393 code-template: | 394 %s 395 396 .function i32 main() { 397 initobj.short B.constructor 398 sta.obj v0 399 *s 400 call.virt A.foo, v0*s 401 402 check-type: exit-positive 403 cases: 404 - values: 405 - '' 406 - '' 407 - '' 408 - '' 409 - values: 410 - '' 411 - ',i32 a1' 412 - 'movi v1, 0' 413 - ', v1' 414 - values: 415 - '' 416 - ',i32 a1' 417 - 'movi v1, 1' 418 - ', v1' 419 - values: 420 - '' 421 - ', i64 a1' 422 - 'movi.64 v1, 0' 423 - ', v1' 424 - values: 425 - '' 426 - ', i64 a1' 427 - 'movi.64 v1, 0x100000000' 428 - ', v1' 429 - values: 430 - '' 431 - ', f64 a1' 432 - 'fmovi.64 v1, 0' 433 - ', v1' 434 - values: 435 - '' 436 - ', f64 a1' 437 - 'fmovi.64 v1, 1.1' 438 - ', v1' 439 - values: 440 - '.record panda.String <external>' 441 - ', panda.String a1' 442 - | 443 # 444 lda.str "some string" 445 sta.obj v1 446 - ', v1' 447 - values: 448 - '' 449 - ', i32 a1, f64 a2, i64 a3' 450 - | 451 # 452 movi v1, 1 453 fmovi.64 v2, 123.456 454 movi.64 v3, 0x100000000 455 - ', v1, v2, v3' 456 - values: 457 - '' 458 - ', i64 a1, i64[] a2, i64[] a3' 459 - | 460 # 461 movi.64 v1, 1 462 mov.null v2 463 mov.null v3 464 - ', v1, v2, v3' 465 - values: 466 - '' 467 - ', f64[] a1, i64[] a2, i32[] a3' 468 - | 469 # 470 mov.null v1 471 mov.null v2 472 mov.null v3 473 - ', v1, v2, v3' 474 475 476 477 - file-name: arg_types_1 478 isa: 479 instructions: 480 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 481 acc: out:top 482 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 483 verification: 484 - compatible_arguments 485 header-template: [r_A] 486 description: > 487 Verifier should report when register type does not match function argument type. 488 code-template: | 489 .record panda.String <external> 490 .record panda.Object <external> 491 .function void A.func(A a0, %s) { 492 return.void 493 } 494 495 .function i32 main() { 496 initobj A.constructor 497 sta.obj v0 498 *s 499 call.virt A.func, v0, v1 500 template-cases: 501 - values: 502 - 'i32 a1' 503 exclude: [i32] 504 - values: 505 - 'i64 a1' 506 exclude: [i64] 507 - values: 508 - 'f64 a1' 509 exclude: [f64] 510 - values: 511 - 'i32[] a1' 512 exclude: [i32arr] 513 - values: 514 - 'i64[] a1' 515 exclude: [i64arr] 516 - values: 517 - 'f64[] a1' 518 exclude: [f64arr] 519 - values: 520 - 'panda.String a1' 521 exclude: [str] 522 - values: 523 - 'panda.String[] a1' 524 exclude: [strarr] 525 - values: 526 - 'panda.Object a1' 527 exclude: [obj, objarr, i32arr, i64arr, f64arr, str, strarr] 528 - values: 529 - 'panda.Object[] a1' 530 exclude: [objarr, strarr] 531 532 check-type: exit-positive 533 bugid: ['1324'] 534 tags: [verifier] 535 runner-options: ['verifier-failure', 'verifier-config'] 536 cases: 537 - values: 538 - | 539 # 540 movi v1, 0 541 id: i32 542 - values: 543 - | 544 # 545 movi v1, 1 546 id: i32 547 - values: 548 - | 549 # 550 movi.64 v1, 0 551 id: i64 552 - values: 553 - | 554 # 555 movi.64 v1, 1 556 id: i64 557 - values: 558 - | 559 # 560 fmovi.64 v1, 0 561 id: f64 562 - values: 563 - | 564 # 565 fmovi.64 v1, 3.1415926535 566 id: f64 567 - values: 568 - | 569 # 570 movi v1, 123 571 newarr v1, v1, i32[] 572 id: i32arr 573 - values: 574 - | 575 # 576 movi v1, 123 577 newarr v1, v1, i64[] 578 id: i64arr 579 - values: 580 - | 581 # 582 movi v1, 123 583 newarr v1, v1, f64[] 584 id: f64arr 585 - values: 586 - | 587 # 588 lda.str "some string" 589 sta.obj v1 590 id: str 591 - values: 592 - | 593 # 594 movi v1, 123 595 newarr v1, v1, panda.String[] 596 id: strarr 597 - values: 598 - | 599 # 600 newobj v1, panda.Object 601 id: obj 602 - values: 603 - | 604 # 605 movi v1, 123 606 newarr v1, v1, panda.Object[] 607 id: objarr 608 609 - file-name: arg_types_2 610 isa: 611 instructions: 612 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 613 acc: out:top 614 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 615 verification: 616 - compatible_arguments 617 header-template: [r_A] 618 description: > 619 Verifier should report when register type does not match function argument type. 620 code-template: | 621 # Definitions for all set of tests 622 .record panda.String <external> 623 .record panda.Object <external> 624 625 .function void A.func(A a0, %s) { 626 return.void 627 } 628 629 .function i32 main() { 630 initobj A.constructor 631 sta.obj v0 632 *s 633 call.virt A.func, v0, v1, v2 634 template-cases: 635 - values: 636 - 'i32 a1, i32 a2' 637 - values: 638 - 'f64 a1, f64 a2' 639 - values: 640 - 'i64 a1, i64 a2' 641 - values: 642 - 'i32[] a1, i32[] a2' 643 - values: 644 - 'i64[] a1, i64[] a2' 645 - values: 646 - 'f64[] a1, f64[] a2' 647 - values: 648 - 'panda.String a1, panda.String a2' 649 - values: 650 - 'panda.String[] a1, panda.String[] a2' 651 exclude: [6] 652 - values: 653 - 'panda.Object a1, panda.Object a2' 654 exclude: [2, 3, 4, 5, 6, 7, 9] 655 - values: 656 - 'panda.Object[] a1, panda.Object[] a2' 657 exclude: [6, 7, 9] 658 check-type: exit-positive 659 bugid: ['1324'] 660 tags: [verifier] 661 runner-options: ['verifier-failure', 'verifier-config'] 662 cases: 663 - values: 664 - | 665 # 666 movi v1, 1 667 fmovi.64 v2, 3.1415926535 668 - values: 669 - | 670 # 671 movi.64 v1, 0 672 movi v2, 123 673 newarr v2, v2, i32[] 674 - values: 675 - | 676 # 677 movi v1, 123 678 newarr v1, v1, i32[] 679 movi v2, 321 680 newarr v2, v2, i64[] 681 id: 2 682 - values: 683 - | 684 # 685 movi v1, 123 686 newarr v1, v1, i64[] 687 lda.str "some string" 688 sta.obj v2 689 id: 3 690 - values: 691 - | 692 # 693 movi v1, 123 694 newarr v1, v1, f64[] 695 lda.str "some string" 696 sta.obj v2 697 id: 4 698 - values: 699 - | 700 # 701 lda.str "some string" 702 sta.obj v1 703 movi v2, 123 704 newarr v2, v2, panda.String[] 705 id: 5 706 - values: 707 - | 708 # 709 movi v1, 123 710 newarr v1, v1, panda.String[] 711 mov.null v2 712 id: 6 713 - values: 714 - | 715 # 716 mov.null v1 717 movi v2,123 718 newarr v2, v2, panda.Object[] 719 id: 7 720 - values: 721 - | 722 # 723 movi v1, 123 724 newarr v1, v1, panda.String[] 725 fmovi.64 v2, 3.1415926535 726 - values: 727 - | 728 # 729 movi v1, 123 730 newarr v1, v1, panda.Object[] 731 movi v2, 321 732 newarr v2, v2, panda.Object[] 733 id: 9 734 735 - file-name: arg_types_3 736 isa: 737 instructions: 738 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 739 acc: out:top 740 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 741 verification: 742 - compatible_arguments 743 header-template: [r_A] 744 tags: [verifier] 745 bugid: ['1324'] 746 runner-options: ['verifier-failure', 'verifier-config'] 747 description: > 748 Verifier should report when register type does not match function argument type. 749 code-template: | 750 # Definitions for all set of tests 751 .record panda.String <external> 752 .record panda.Object <external> 753 754 .function void A.func(A a0, %s) { 755 return.void 756 } 757 758 .function i32 main() { 759 initobj A.constructor 760 sta.obj v0 761 *s 762 call.virt A.func, v0, v1, v2, v3 763 template-cases: 764 - values: 765 - 'i32 a1, i32 a2, i32 a3' 766 - values: 767 - 'f64 a1, f64 a2, f64 a3' 768 - values: 769 - 'i64 a1, i64 a2, i64 a3' 770 - values: 771 - 'i32[] a1, i32[] a2, i32[] a3' 772 - values: 773 - 'i64[] a1, i64[] a2, i64[] a3' 774 - values: 775 - 'f64[] a1, f64[] a2, f64[] a3' 776 - values: 777 - 'panda.String a1, panda.String a2, panda.String a3' 778 - values: 779 - 'panda.String[] a1, panda.String[] a2, panda.String[] a3' 780 - values: 781 - 'panda.Object a1, panda.Object a2, panda.Object a3' 782 exclude: [2, 3, 4, 5] 783 - values: 784 - 'panda.Object[] a1, panda.Object[] a2, panda.Object[] a3' 785 check-type: exit-positive 786 cases: 787 - values: 788 - | 789 # 790 movi v1, 1 791 fmovi.64 v2, 3.1415926535 792 movi v3, 1 793 - values: 794 - | 795 # 796 movi.64 v1, 0 797 movi v2, 123 798 newarr v2, v2, i32[] 799 movi v3, 123 800 newarr v3, v3, i32[] 801 - values: 802 - | 803 # 804 movi v1, 123 805 newarr v1, v1, i32[] 806 movi v2, 321 807 newarr v2, v2, i64[] 808 movi v3, 123 809 newarr v3, v3, i32[] 810 id: 2 811 - values: 812 - | 813 # 814 movi v1, 123 815 newarr v1, v1, i64[] 816 lda.str "some string" 817 sta.obj v2 818 lda.str "some string" 819 sta.obj v3 820 id: 3 821 - values: 822 - | 823 # 824 movi v1, 123 825 newarr v1, v1, f64[] 826 lda.str "some string" 827 sta.obj v2 828 movi v3, 123 829 newarr v3, v3, f64[] 830 id: 4 831 - values: 832 - | 833 # 834 lda.str "some string" 835 sta.obj v1 836 movi v2, 123 837 newarr v2, v2, panda.String[] 838 movi v3, 123 839 newarr v3, v3, panda.String[] 840 id: 5 841 - values: 842 - | 843 # 844 movi v1, 123 845 newarr v1, v1, panda.String[] 846 mov.null v2 847 fmovi.64 v3, 3.1415926535 848 - values: 849 - | 850 # 851 mov.null v1 852 movi v2,123 853 newarr v2, v2, panda.Object[] 854 fmovi.64 v3, 3.1415926535 855 id: f64arr 856 - values: 857 - | 858 # 859 movi v1, 123 860 newarr v1, v1, panda.String[] 861 fmovi.64 v2, 3.1415926535 862 movi v3, 123 863 newarr v3, v3, f64[] 864 - values: 865 - | 866 # 867 movi v1, 123 868 newarr v1, v1, panda.Object[] 869 movi v3, 123 870 newarr v3, v3, f64[] 871 - values: 872 - | 873 # 874 movi v1, 123 875 newarr v1, v1, panda.Object[][] 876 movi v3, 123 877 newarr v3, v3, f64[][] 878 - values: 879 - | 880 # 881 movi v1, 123 882 newarr v1, v1, panda.Object[][][] 883 movi v3, 123 884 newarr v3, v3, f64[][][] 885 886 - file-name: acc_uninitialized 887 isa: 888 instructions: 889 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 890 acc: out:top 891 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 892 header-template: [r_A] 893 description: > 894 Verifier should report that uninitialized accumulator is used in function. 895 check-type: exit-positive 896 bugid: ['1324'] 897 tags: [verifier] 898 runner-options: ['verifier-failure', 'verifier-config'] 899 code-template: | 900 .function void A.func(A a0) { 901 %s 902 return.void 903 } 904 905 .function i32 main() { 906 initobj A.constructor 907 sta.obj v0 908 call.virt A.func, v0 909 cases: 910 - values: 911 - sta v0 912 - values: 913 - sta.64 v0 914 - values: 915 - sta.obj v0 916 917 - file-name: reg_uninitialized 918 isa: 919 instructions: 920 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 921 acc: out:top 922 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 923 header-template: [r_A] 924 description: > 925 Verifier should report that uninitialized register is used in function. 926 check-type: exit-positive 927 bugid: ['1324'] 928 tags: [verifier] 929 runner-options: ['verifier-failure', 'verifier-config'] 930 code-template: | 931 .function void A.func(A a0) { 932 %s 933 return.void 934 } 935 936 .function i32 main() { 937 initobj A.constructor 938 sta.obj v0 939 call.virt A.func, v0 940 template-cases: 941 - values: 942 - lda %s 943 exclude: [r16] 944 - values: 945 - lda.64 %s 946 exclude: [r16] 947 - values: 948 - lda.obj %s 949 exclude: [r16] 950 - values: 951 - mov v0, %s 952 cases: 953 - values: [v0] 954 - values: [v1] 955 - values: [v128] 956 - values: [v255] 957 - values: [v256] 958 id: r16 959 - values: [v32768] 960 id: r16 961 - values: [v65535] 962 id: r16 963 964 - file-name: p_method_id_accessible 965 isa: 966 instructions: 967 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 968 acc: out:top 969 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 970 verification: 971 - method_id_accessible 972 header-template: [r_A] 973 description: > 974 Verifier should report that method is not accessible if method_id is not resolved to existing method. Use PandaAssembly language context. 975 check-type: exit-positive 976 tags: [verifier] 977 runner-options: ['verifier-failure', 'verifier-config'] 978 code-template: | 979 .function %s A.func(A a0, *s a1) <external> 980 981 .function i32 main() { 982 initobj A.constructor 983 sta.obj v0 984 *s 985 call.virt A.func, v0, v1 986 template-cases: 987 - values: 988 - 'void' 989 - values: 990 - 'i32' 991 exclude: [void] 992 - values: 993 - 'i64' 994 exclude: [void] 995 - values: 996 - 'f64' 997 exclude: [void] 998 - values: 999 - 'i32[]' 1000 exclude: [void] 1001 - values: 1002 - 'i64[]' 1003 exclude: [void] 1004 - values: 1005 - 'f64[]' 1006 exclude: [void] 1007 - values: 1008 - 'A' 1009 exclude: [void] 1010 - values: 1011 - 'A[]' 1012 exclude: [void] 1013 cases: 1014 - case-template: | 1015 .function void A.func(A a0) <external> 1016 1017 .function i32 main() { 1018 initobj A.constructor 1019 sta.obj v0 1020 call.virt A.func, v0 1021 id: void 1022 - values: ['i32', 'movi v1, 12345678'] 1023 - values: ['i64', 'movi.64 v1, 0x123456789ABCDEF'] 1024 - values: ['f64', 'fmovi.64 v1, 3.1415926535'] 1025 - values: 1026 - 'i32[]' 1027 - | 1028 # 1029 movi v1, 123 1030 newarr v1, v1, i32[] 1031 - values: 1032 - 'i64[]' 1033 - | 1034 # 1035 movi v1, 123 1036 newarr v1, v1, i64[] 1037 - values: 1038 - 'f64[]' 1039 - | 1040 # 1041 movi v1, 123 1042 newarr v1, v1, f64[] 1043 - values: 1044 - 'A' 1045 - | 1046 # 1047 initobj A.constructor 1048 sta.obj v1 1049 - values: 1050 - 'A[]' 1051 - | 1052 # 1053 movi v1, 123 1054 newarr v1, v1, A[] 1055 1056 - file-name: j_method_id_accessible 1057 isa: 1058 instructions: 1059 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 1060 acc: out:top 1061 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 1062 verification: 1063 - method_id_accessible 1064 header-template: [PandaAssembly, r_A] 1065 description: > 1066 Verifier should report that method is not accessible if method_id is not resolved to existing method. Use PandaAssembly language context. 1067 check-type: exit-positive 1068 tags: ['verifier', pa-verifier] 1069 bugid: ['3293', '6886'] 1070 runner-options: [use-pa, verifier-failure, verifier-config] 1071 code-template: | 1072 %s 1073 .record B<panda.extends = A> {} 1074 1075 .function void B.constructor(B a0) <ctor> { 1076 return.void 1077 } 1078 1079 .function i32 main() { 1080 initobj B.constructor 1081 sta.obj v0 1082 movi v1, 123 1083 call.virt *s.func, v0, v1 1084 template-cases: 1085 - values: 1086 - | 1087 .function void A.func(A a0, i32 a1) <external> 1088 .function void B.func(A a0, i32 a1) <external> 1089 - values: 1090 - | 1091 .function void A.func(A a0, i32 a1) <external> 1092 .function void B.func(A a0, i32 a1) <noimpl> 1093 exclude: [b] # Temporarily excluded since failure in release build. 1094 - values: 1095 - | 1096 .function void A.func(A a0, i32 a1) <noimpl> 1097 .function void B.func(A a0, i32 a1) <external> 1098 exclude: [a] # Invalid combination 1099 cases: 1100 - values: 1101 - A 1102 id: a 1103 - values: 1104 - B 1105 id: b 1106 1107 - file-name: p_method_id_non_static 1108 bugid: ["1324"] 1109 isa: 1110 instructions: 1111 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 1112 acc: out:top 1113 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 1114 verification: 1115 - method_id_non_static 1116 header-template: [r_A] 1117 description: > 1118 Verifier should report that method is not accessible if method_id is not resolved to existing method. Use PandaAssembly language context. 1119 check-type: exit-positive 1120 tags: [verifier] 1121 runner-options: ['verifier-failure', 'verifier-config'] 1122 code-template: | 1123 .function %s A.func(A a0, *s a1) <static> { 1124 %s 1125 } 1126 1127 .function i32 main() { 1128 initobj A.constructor 1129 sta.obj v0 1130 *s 1131 call.virt A.func, v0, v1 1132 template-cases: 1133 - values: 1134 - 'void' 1135 - 'return.void' 1136 - values: 1137 - 'i32' 1138 - | 1139 # 1140 ldai 1 1141 return 1142 exclude: [void] 1143 - values: 1144 - 'i64' 1145 - | 1146 # 1147 ldai.64 1 1148 return.64 1149 exclude: [void] 1150 - values: 1151 - 'f64' 1152 - | 1153 # 1154 fldai.64 3.1415926535 1155 return.64 1156 exclude: [void] 1157 - values: 1158 - 'i32[]' 1159 - | 1160 # 1161 movi v1, 123 1162 newarr v1, v1, i32[] 1163 lda.obj v1 1164 return.obj 1165 exclude: [void] 1166 - values: 1167 - 'i64[]' 1168 - | 1169 # 1170 movi v1, 123 1171 newarr v1, v1, i64[] 1172 lda.obj v1 1173 return.obj 1174 exclude: [void] 1175 - values: 1176 - 'f64[]' 1177 - | 1178 # 1179 movi v1, 123 1180 newarr v1, v1, f64[] 1181 lda.obj v1 1182 return.obj 1183 exclude: [void] 1184 - values: 1185 - 'A' 1186 - | 1187 # 1188 initobj A.constructor 1189 sta.obj v1 1190 return.obj 1191 - values: 1192 - 'A[]' 1193 - | 1194 # 1195 movi v1, 123 1196 newarr v1, v1, A[] 1197 lda.obj v1 1198 return.obj 1199 cases: 1200 - case-template: | 1201 .function void A.func(A a0) <static> { 1202 return.void 1203 } 1204 1205 .function i32 main() { 1206 initobj A.constructor 1207 sta.obj v0 1208 call.virt A.func, v0 1209 id: void 1210 - values: ['i32', 'movi v1, 12345678'] 1211 - values: ['i64', 'movi.64 v1, 0x123456789ABCDEF'] 1212 - values: ['f64', 'fmovi.64 v1, 3.1415926535'] 1213 - values: 1214 - 'i32[]' 1215 - | 1216 # 1217 movi v1, 123 1218 newarr v1, v1, i32[] 1219 - values: 1220 - 'i64[]' 1221 - | 1222 # 1223 movi v1, 123 1224 newarr v1, v1, i64[] 1225 - values: 1226 - 'f64[]' 1227 - | 1228 # 1229 movi v1, 123 1230 newarr v1, v1, f64[] 1231 - values: 1232 - 'A' 1233 - | 1234 # 1235 initobj A.constructor 1236 sta.obj v1 1237 - values: 1238 - 'A[]' 1239 - | 1240 # 1241 movi v1, 123 1242 newarr v1, v1, A[] 1243 1244 - file-name: j_method_id_non_static 1245 bugid: ["1324", "3293", "5271", "6886"] 1246 isa: 1247 instructions: 1248 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 1249 acc: out:top 1250 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 1251 verification: 1252 - method_id_non_static 1253 header-template: [PandaAssembly, r_A] 1254 description: > 1255 Verifier should report that method is not accessible if method_id is not resolved to existing method. Use PandaAssembly language context. 1256 check-type: exit-positive 1257 tags: ['verifier', 'pa-verifier'] 1258 runner-options: [use-pa, verifier-failure, verifier-config] 1259 code-template: | 1260 *s 1261 .record B<panda.extends = A> {} 1262 1263 .function void B.constructor(B a0) <ctor> { 1264 return.void 1265 } 1266 1267 .function i32 main() { 1268 initobj B.constructor 1269 sta.obj v0 1270 movi v1, 123 1271 call.virt %s.func, v0, v1 1272 template-cases: 1273 - values: 1274 - A 1275 exclude: [virta] # call.virt A.func where A.func is virtual 1276 - values: 1277 - B 1278 exclude: [virtb] 1279 1280 cases: 1281 - values: 1282 - | 1283 .function void A.func(A a0, i32 a1) <static> { 1284 return.void 1285 } 1286 .function void B.func(B a0, i32 a1) <static> { 1287 return.void 1288 } 1289 - values: 1290 - | 1291 .function void A.func(A a0, i32 a1) { 1292 return.void 1293 } 1294 .function void B.func(B a0, i32 a1) <static> { 1295 return.void 1296 } 1297 id: virta 1298 - values: 1299 - | 1300 .function void A.func(A a0, i32 a1) <static> { 1301 return.void 1302 } 1303 .function void B.func(B a0, i32 a1) { 1304 return.void 1305 } 1306 id: virtb 1307 1308 - file-name: match_parameters_amount 1309 isa: 1310 instructions: 1311 - sig: call.virt method_id, v1:in:top, v2:in:top, v3:in:top, v4:in:top 1312 acc: out:top 1313 format: [op_v1_4_v2_4_v3_4_v4_4_id_16] 1314 header-template: [r_A] 1315 description: > 1316 Compiler should check amount of function parameters with corresponding call.virt 1317 check-type: none 1318 runner-options: [compile-failure] 1319 code-template: | 1320 1321 .function void A.func(A a0, i32 a1%s) <external> 1322 1323 .function i32 main() { 1324 call.virt A.func, v0,%s 1325 cases: 1326 - values: ['', ''] 1327 ignore: true 1328 bugid: ['1956','1304'] 1329 - values: [', i32 a2', ', v1'] 1330 - values: [', i32 a2, i32 a3', ', v1'] 1331 - values: [', i32 a2, i32 a3', ', v1, v1'] 1332 - values: [', i32 a2, i32 a3, i32 a4', ', v1'] 1333 - values: [', i32 a2, i32 a3, i32 a4', ', v1, v1'] 1334 - values: [', i32 a2, i32 a3, i32 a4', ', v1, v1, v1'] 1335 - values: [', i32 a2, i32 a3, i32 a4', ', v1, v1, v1, v1'] 1336