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