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_header 16 template: | 17 .language PandaAssembly 18 19 .record panda.Object <external> 20 .record panda.String <external> 21 .record panda.Exception <external> 22 .record panda.RuntimeException <external> 23 .record panda.ClassCastException <external> 24 .record panda.io.Serializable <external> 25 26 .record R <> {} 27 .record I <panda.interface> {} 28 .record Q <panda.extends=R, panda.implements=I> {} 29 .record A <panda.annotation, panda.annotation.type=runtime> {} 30 31 - name: pandasm_header 32 template: | 33 .language PandaAssembly 34 35 .record panda.Object <external> 36 .record panda.String <external> 37 .record panda.ClassCastException <external> 38 39 .record R {} 40 .record Q {} 41 42 43tests: 44 - file-name: "checkcast" 45 isa: 46 title: Check cast 47 description: > 48 Resolve object type by specified id and if an object in accumulator can be cast to the 49 resolved type, accumulator content remains unchanged. Otherwise ClassCastException is thrown. 50 instructions: 51 - sig: checkcast type_id 52 acc: in:ref 53 format: [op_id_16] 54 commands: 55 56 - file-name: "null_to_any_type_pa" 57 tags: ['tsan'] 58 description: Check that null object reference can be cast to any type 59 isa: 60 description: > 61 'null' object reference can be cast to every type. 62 header-template: ['pandasm_header'] 63 check-type: empty 64 code-template: | 65 66 .function i32 main() { 67 try_begin: 68 lda.null 69 %s 70 try_end: 71 jnez.obj set_failure # check that acc == null 72 ldai 0 73 return 74 set_failure: 75 ldai 1 76 return 77 catch_begin: 78 ldai 2 79 return 80 .catch panda.ClassCastException, try_begin, try_end, catch_begin 81 } 82 cases: 83 - values: 84 - checkcast panda.Object 85 - values: 86 - checkcast panda.String 87 - values: 88 - checkcast R 89 - values: 90 - | 91 checkcast R 92 checkcast Q 93 - values: 94 - | 95 checkcast panda.ClassCastException 96 checkcast R 97 98 99 - file-name: "null_to_any_type_j" 100 description: Check that null object reference can be cast to any type 101 isa: 102 description: > 103 'null' object reference can be cast to every type. 104 header-template: ['PandaAssembly_header'] 105 tags: ['irtoc_ignore'] 106 check-type: empty 107 runner-options: ['use-pa'] 108 bugid: ["1720", "3967"] 109 code-template: | 110 111 .function i32 main() { 112 try_begin: 113 lda.null 114 %s 115 try_end: 116 jnez.obj set_failure # check that acc == null 117 ldai 0 118 return 119 set_failure: 120 ldai 1 121 return 122 catch_begin: 123 ldai 2 124 return 125 .catch panda.ClassCastException, try_begin, try_end, catch_begin 126 } 127 cases: 128 - values: 129 - checkcast panda.Object 130 - values: 131 - checkcast panda.String 132 - values: 133 - checkcast R 134 - values: 135 - | 136 checkcast panda.io.Serializable 137 checkcast panda.String 138 - values: 139 - | 140 checkcast I 141 checkcast Q 142 checkcast A 143 - values: 144 - | 145 checkcast panda.ClassCastException 146 checkcast R 147 148 149 - file-name: "null_to_array_type_pa" 150 description: Check that null object reference can be cast to any array type 151 isa: 152 description: > 153 'null' object reference can be cast to every type. 154 header-template: ['pandasm_header'] 155 check-type: empty 156 bugid: ["1710"] 157 code-template: | 158 159 .function i32 main() { 160 try_begin: 161 lda.null 162 %s 163 try_end: 164 jnez.obj set_failure # check that acc == null 165 ldai 0 166 return 167 set_failure: 168 ldai 1 169 return 170 catch_begin: 171 ldai 2 172 return 173 .catch panda.ClassCastException, try_begin, try_end, catch_begin 174 } 175 cases: 176 - values: 177 - checkcast panda.Object[] 178 - values: 179 - checkcast panda.String[] 180 - values: 181 - checkcast R[] 182 - values: 183 - | 184 checkcast R[] 185 checkcast Q[] 186 - values: 187 - | 188 checkcast panda.ClassCastException[] 189 checkcast R[] 190 191 192 - file-name: "null_to_array_type_j" 193 description: Check that null object reference can be cast to any array type 194 isa: 195 description: > 196 'null' object reference can be cast to every type. 197 header-template: ['PandaAssembly_header'] 198 check-type: empty 199 tags: ['irtoc_ignore'] 200 runner-options: ['use-pa'] 201 bugid: ["1710"] 202 code-template: | 203 204 .function i32 main() { 205 try_begin: 206 lda.null 207 %s 208 try_end: 209 jnez.obj set_failure # check that acc == null 210 ldai 0 211 return 212 set_failure: 213 ldai 1 214 return 215 catch_begin: 216 ldai 2 217 return 218 .catch panda.ClassCastException, try_begin, try_end, catch_begin 219 } 220 cases: 221 - values: 222 - checkcast panda.Object[] 223 - values: 224 - checkcast panda.String[] 225 - values: 226 - checkcast R[] 227 - values: 228 - | 229 checkcast panda.io.Serializable[] 230 checkcast panda.String[] 231 - values: 232 - | 233 checkcast I[] 234 checkcast Q[] 235 checkcast A[] 236 - values: 237 - | 238 checkcast panda.ClassCastException[] 239 checkcast R[] 240 241 242 - file-name: "against_base_type_pa" 243 description: Check that any object can be cast to the base type 244 isa: 245 description: Object of type O can be cast to type T if O is the same as T or is subtype of T. 246 header-template: ['pandasm_header'] 247 check-type: empty 248 tags: ['tsan'] 249 code-template: | 250 251 .function i32 main() { 252 try_begin: 253 %s 254 %s 255 checkcast panda.Object 256 try_end: 257 jne.obj v1, set_failure # check that acc isn't changed 258 ldai 0 259 return 260 catch_begin: 261 ldai 2 262 return 263 set_failure: 264 ldai 1 265 return 266 .catch panda.ClassCastException, try_begin, try_end, catch_begin 267 } 268 cases: 269 - values: 270 - newobj v1, panda.ClassCastException 271 - lda.obj v1 272 - values: 273 - newobj v1, R 274 - lda.obj v1 275 - values: 276 - lda.str "" 277 - sta.obj v1 278 - values: 279 - lda.str "abc" 280 - sta.obj v1 281 - values: 282 - lda.type R 283 - sta.obj v1 284 285 286 - file-name: "against_base_type_j" 287 description: Check that any object can be cast to the base type 288 isa: 289 description: Object of type O can be cast to type T if O is the same as T or is subtype of T. 290 header-template: ['PandaAssembly_header'] 291 check-type: empty 292 tags: ['irtoc_ignore'] 293 runner-options: ['use-pa'] 294 code-template: | 295 296 .function i32 main() { 297 try_begin: 298 %s 299 %s 300 checkcast panda.Object 301 try_end: 302 jne.obj v1, set_failure # check that acc isn't changed 303 ldai 0 304 return 305 catch_begin: 306 ldai 2 307 return 308 set_failure: 309 ldai 1 310 return 311 .catch panda.ClassCastException, try_begin, try_end, catch_begin 312 } 313 cases: 314 - values: 315 - newobj v1, panda.Exception 316 - lda.obj v1 317 - values: 318 - newobj v1, panda.String 319 - lda.obj v1 320 - values: 321 - newobj v1, R 322 - lda.obj v1 323 - values: 324 - newobj v1, Q 325 - lda.obj v1 326 - values: 327 - newobj v1, A 328 - lda.obj v1 329 - values: 330 - lda.str "" 331 - sta.obj v1 332 - values: 333 - lda.str "abc" 334 - sta.obj v1 335 - values: 336 - lda.type R 337 - sta.obj v1 338 - values: 339 - lda.type panda.Exception 340 - sta.obj v1 341 342 343 - file-name: "against_same_type_pa" 344 description: Check that any object can be cast to its type 345 isa: 346 description: Object of type O can be cast to type T if O is the same as T or is subtype of T. 347 header-template: ['pandasm_header'] 348 check-type: empty 349 code-template: | 350 351 .function i32 main() { 352 %s 353 %s 354 try_begin: 355 checkcast %s 356 try_end: 357 jne.obj v1, set_failure # check that acc hasn't been changed 358 ldai 0 359 return 360 catch_begin: 361 ldai 2 362 return 363 set_failure: 364 ldai 1 365 return 366 .catch panda.ClassCastException, try_begin, try_end, catch_begin 367 } 368 cases: 369 - values: 370 - newobj v1, panda.ClassCastException 371 - lda.obj v1 372 - panda.ClassCastException 373 - values: 374 - newobj v1, R 375 - lda.obj v1 376 - R 377 - values: 378 - lda.str "" 379 - sta.obj v1 380 - panda.String 381 - values: 382 - lda.str "abc" 383 - sta.obj v1 384 - panda.String 385 386 387 - file-name: "against_same_type_j" 388 description: Check that any object can be cast to its type 389 isa: 390 description: Object of type O can be cast to type T if O is the same as T or is subtype of T. 391 header-template: ['PandaAssembly_header'] 392 check-type: empty 393 runner-options: ['use-pa'] 394 tags: ['tsan', 'irtoc_ignore'] 395 code-template: | 396 397 .function i32 main() { 398 %s 399 %s 400 try_begin: 401 checkcast %s 402 try_end: 403 jne.obj v1, set_failure # check that acc hasn't been changed 404 ldai 0 405 return 406 catch_begin: 407 ldai 2 408 return 409 set_failure: 410 ldai 1 411 return 412 .catch panda.ClassCastException, try_begin, try_end, catch_begin 413 } 414 cases: 415 - values: 416 - newobj v1, panda.Exception 417 - lda.obj v1 418 - panda.Exception 419 - values: 420 - newobj v1, panda.RuntimeException 421 - lda.obj v1 422 - panda.RuntimeException 423 - values: 424 - newobj v1, R 425 - lda.obj v1 426 - R 427 - values: 428 - newobj v1, Q 429 - lda.obj v1 430 - Q 431 - values: 432 - newobj v1, A 433 - lda.obj v1 434 - A 435 - values: 436 - lda.str "" 437 - sta.obj v1 438 - panda.String 439 - values: 440 - lda.str "abc" 441 - sta.obj v1 442 - panda.String 443 444 445 - file-name: "against_supertype_j" 446 description: Check that any object can be cast to its supertype 447 isa: 448 description: Object of type O can be cast to type T if O is the same as T or is subtype of T. 449 header-template: ['PandaAssembly_header'] 450 check-type: empty 451 tags: ['irtoc_ignore'] 452 runner-options: ['use-pa'] 453 code-template: | 454 455 .function i32 main() { 456 try_begin: 457 newobj v1, %s 458 lda.obj v1 459 checkcast %s 460 try_end: 461 jne.obj v1, set_failure # check that acc hasn't been changed 462 ldai 0 463 return 464 set_failure: 465 ldai 1 466 return 467 catch_begin: 468 ldai 2 469 return 470 .catch panda.ClassCastException, try_begin, try_end, catch_begin 471 } 472 cases: 473 - values: 474 - panda.RuntimeException 475 - panda.Exception 476 - values: 477 - Q 478 - R 479 - values: 480 - Q 481 - I 482 483 484 - file-name: "array_against_base_type_pa" 485 description: Check that any array can be cast to base type 486 isa: 487 description: > 488 Object of type O can be cast to type T if O is the same as T or is subtype of T. For arrays O can be cast 489 to T if T is a root type in type hierarchy or T is such array that O array elements are the same or subtype of 490 T array elements. 491 header-template: ['pandasm_header'] 492 check-type: empty 493 code-template: | 494 495 .function i32 main() { 496 try_begin: 497 movi v0, 10 498 newarr v1, v0, %s[] 499 lda.obj v1 500 checkcast panda.Object 501 try_end: 502 jne.obj v1, set_failure # check that acc isn't changed 503 ldai 0 504 return 505 set_failure: 506 ldai 1 507 return 508 catch_begin: 509 ldai 2 510 return 511 .catch panda.ClassCastException, try_begin, try_end, catch_begin 512 } 513 cases: 514 - values: 515 - panda.ClassCastException 516 - values: 517 - R 518 - values: 519 - panda.String 520 521 522 - file-name: "array_against_base_type_j" 523 description: Check that any array can be cast to base type 524 isa: 525 description: > 526 Object of type O can be cast to type T if O is the same as T or is subtype of T. For arrays O can be cast 527 to T if T is a root type in type hierarchy or T is such array that O array elements are the same or subtype of 528 T array elements. 529 header-template: ['PandaAssembly_header'] 530 tags: ['irtoc_ignore'] 531 check-type: empty 532 runner-options: ['use-pa'] 533 code-template: | 534 535 .function i32 main() { 536 try_begin: 537 movi v0, 10 538 newarr v1, v0, %s[] 539 lda.obj v1 540 checkcast panda.Object 541 try_end: 542 jne.obj v1, set_failure # check that acc isn't changed 543 ldai 0 544 return 545 set_failure: 546 ldai 1 547 return 548 catch_begin: 549 ldai 2 550 return 551 .catch panda.ClassCastException, try_begin, try_end, catch_begin 552 } 553 cases: 554 - values: 555 - panda.Exception 556 - values: 557 - panda.String 558 - values: 559 - R 560 - values: 561 - Q 562 - values: 563 - A 564 565 566 - file-name: "array_against_its_type_pa" 567 description: Check that any array can be cast to its type 568 isa: 569 description: > 570 For arrays O can be cast 571 to T if T is a root type in type hierarchy or T is such array that O array elements are the same or subtype of 572 T array elements. 573 header-template: ['pandasm_header'] 574 check-type: empty 575 bugid: ["1710"] 576 code-template: | 577 578 .function i32 main() { 579 try_begin: 580 movi v0, 10 581 newarr v1, v0, %s[] 582 lda.obj v1 583 checkcast %s[] 584 try_end: 585 jne.obj v1, set_failure # check that acc isn't changed 586 ldai 0 587 return 588 set_failure: 589 ldai 1 590 return 591 catch_begin: 592 ldai 2 593 return 594 .catch panda.ClassCastException, try_begin, try_end, catch_begin 595 } 596 cases: 597 - values: 598 - panda.ClassCastException 599 - panda.ClassCastException 600 - values: 601 - R 602 - R 603 - values: 604 - panda.String 605 - panda.String 606 607 608 - file-name: "array_against_its_type_j" 609 description: Check that any array can be cast to its type 610 isa: 611 description: > 612 For arrays O can be cast 613 to T if T is a root type in type hierarchy or T is such array that O array elements are the same or subtype of 614 T array elements. 615 header-template: ['PandaAssembly_header'] 616 tags: ['irtoc_ignore'] 617 check-type: empty 618 runner-options: ['use-pa'] 619 bugid: ["1710"] 620 code-template: | 621 622 .function i32 main() { 623 try_begin: 624 movi v0, 10 625 newarr v1, v0, %s[] 626 lda.obj v1 627 checkcast %s[] 628 try_end: 629 jne.obj v1, set_failure # check that acc isn't changed 630 ldai 0 631 return 632 set_failure: 633 ldai 1 634 return 635 catch_begin: 636 ldai 2 637 return 638 .catch panda.ClassCastException, try_begin, try_end, catch_begin 639 } 640 cases: 641 - values: 642 - panda.RuntimeException 643 - panda.RuntimeException 644 - values: 645 - R 646 - R 647 - values: 648 - Q 649 - Q 650 - values: 651 - A 652 - A 653 - values: 654 - panda.String 655 - panda.String 656 657 658 - file-name: "array_against_basetype_array_pa" 659 description: Check that any array can be cast to base type array 660 isa: 661 description: > 662 For arrays O can be cast 663 to T if T is a root type in type hierarchy or T is such array that O array elements are the same or subtype of 664 T array elements. 665 header-template: ['pandasm_header'] 666 check-type: empty 667 bugid: ["1710"] 668 code-template: | 669 670 .function i32 main() { 671 try_begin: 672 movi v0, 10 673 newarr v1, v0, %s[] 674 lda.obj v1 675 checkcast panda.Object[] 676 try_end: 677 jne.obj v1, set_failure # check that acc isn't changed 678 ldai 0 679 return 680 set_failure: 681 ldai 1 682 return 683 catch_begin: 684 ldai 2 685 return 686 .catch panda.ClassCastException, try_begin, try_end, catch_begin 687 } 688 cases: 689 - values: 690 - panda.ClassCastException 691 - values: 692 - R 693 - values: 694 - panda.String 695 696 697 - file-name: "array_against_basetype_array_j" 698 description: Check that any array can be cast to base type array 699 isa: 700 description: > 701 For arrays O can be cast 702 to T if T is a root type in type hierarchy or T is such array that O array elements are the same or subtype of 703 T array elements. 704 header-template: ['PandaAssembly_header'] 705 check-type: empty 706 tags: ['irtoc_ignore'] 707 runner-options: ['use-pa'] 708 bugid: ["1710"] 709 code-template: | 710 711 .function i32 main() { 712 try_begin: 713 movi v0, 10 714 newarr v1, v0, %s[] 715 lda.obj v1 716 checkcast panda.Object[] 717 try_end: 718 jne.obj v1, set_failure # check that acc isn't changed 719 ldai 0 720 return 721 set_failure: 722 ldai 1 723 return 724 catch_begin: 725 ldai 2 726 return 727 .catch panda.ClassCastException, try_begin, try_end, catch_begin 728 } 729 cases: 730 - values: 731 - panda.RuntimeException 732 - values: 733 - R 734 - values: 735 - Q 736 - values: 737 - A 738 - values: 739 - panda.String 740 741 742 - file-name: "array_against_supertype_array_j" 743 description: Check that any array can be cast to its supertype array 744 tags: ['tsan', 'irtoc_ignore'] 745 isa: 746 description: > 747 For arrays O can be cast 748 to T if T is a root type in type hierarchy or T is such array that O array elements are the same or subtype of 749 T array elements. 750 header-template: ['PandaAssembly_header'] 751 check-type: empty 752 runner-options: ['use-pa'] 753 bugid: ["1710"] 754 code-template: | 755 756 .function i32 main() { 757 try_begin: 758 movi v0, 10 759 newarr v1, v0, %s[] 760 lda.obj v1 761 checkcast %s[] 762 try_end: 763 jne.obj v1, set_failure # check that acc isn't changed 764 ldai 0 765 return 766 catch_begin: 767 ldai 2 768 return 769 set_failure: 770 ldai 1 771 return 772 .catch panda.ClassCastException, try_begin, try_end, catch_begin 773 } 774 cases: 775 - values: 776 - panda.RuntimeException 777 - panda.Exception 778 - values: 779 - Q 780 - R 781 - values: 782 - Q 783 - I 784 785 786 - file-name: "against_other_type_j" 787 description: Check that ClassCastException is thrown when object cannot be cast to a type 788 isa: 789 description: > 790 Otherwise ClassCastException is thrown. 791 Object of type O can be cast to type T if O is the same as T or is subtype of T. For arrays O can be cast 792 to T if T is a root type in type hierarchy or T is such array that O array elements are the same or subtype of 793 T array elements. 794 exceptions: 795 - x_cast 796 tags: ['irtoc_ignore'] 797 header-template: ['PandaAssembly_header'] 798 check-type: empty 799 runner-options: ['use-pa'] 800 bugid: ["1710", "3967"] 801 code-template: | 802 803 .function i32 main() { 804 try_begin: 805 %s 806 checkcast %s 807 ldai 1 808 return 809 try_end: 810 ldai 0 811 return 812 .catch panda.ClassCastException, try_begin, try_end, try_end 813 } 814 cases: 815 - values: 816 - | 817 newobj v0, panda.RuntimeException 818 lda.obj v0 819 - panda.RuntimeException[] 820 - values: 821 - | 822 newobj v0, panda.RuntimeException 823 lda.obj v0 824 - panda.Exception[] 825 - values: 826 - | 827 newobj v0, R 828 lda.obj v0 829 - panda.io.Serializable 830 - values: 831 - | 832 newobj v0, Q 833 lda.obj v0 834 - Q[] 835 - values: 836 - | 837 newobj v0, Q 838 lda.obj v0 839 - R[] 840 - values: 841 - | 842 newobj v0, panda.Exception 843 lda.obj v0 844 - panda.RuntimeException 845 - values: 846 - | 847 newobj v0, R 848 lda.obj v0 849 - Q 850 - values: 851 - lda.type R 852 - R 853 854 855 - file-name: "against_other_type_pa" 856 description: Check that ClassCastException is thrown when object cannot be cast to a type 857 isa: 858 description: > 859 Otherwise ClassCastException is thrown. 860 Object of type O can be cast to type T if O is the same as T or is subtype of T. For arrays O can be cast 861 to T if T is a root type in type hierarchy or T is such array that O array elements are the same or subtype of 862 T array elements. 863 exceptions: 864 - x_cast 865 header-template: ['pandasm_header'] 866 tags: ['irtoc_ignore'] 867 check-type: empty 868 code-template: | 869 870 .function i32 main() { 871 try_begin: 872 %s 873 checkcast %s 874 ldai 1 875 return 876 try_end: 877 ldai 0 878 return 879 .catch panda.ClassCastException, try_begin, try_end, try_end 880 } 881 cases: 882 - values: 883 - | 884 newobj v0, Q 885 lda.obj v0 886 - Q[] 887 bugid: ["1710"] 888 - values: 889 - | 890 newobj v0, Q 891 lda.obj v0 892 - R[] 893 bugid: ["1710"] 894 - values: 895 - | 896 newobj v0, R 897 lda.obj v0 898 - Q 899 - values: 900 - lda.str "" 901 - panda.ClassCastException 902 - values: 903 - lda.str "abc" 904 - R 905 - values: 906 - lda.type R 907 - R 908 909 910 - file-name: "array_against_other_type_pa" 911 description: Check that ClassCastException is thrown when array cannot be cast to a type 912 isa: 913 description: > 914 Otherwise ClassCastException is thrown. 915 Object of type O can be cast to type T if O is the same as T or is subtype of T. For arrays O can be cast 916 to T if T is a root type in type hierarchy or T is such array that O array elements are the same or subtype of 917 T array elements. 918 exceptions: 919 - x_cast 920 header-template: ['pandasm_header'] 921 tags: ['irtoc_ignore'] 922 check-type: empty 923 code-template: | 924 925 .function i32 main() { 926 try_begin: 927 movi v0, 10 928 newarr v0, v0, %s 929 lda.obj v0 930 checkcast %s 931 ldai 1 932 return 933 try_end: 934 ldai 0 935 return 936 .catch panda.ClassCastException, try_begin, try_end, try_end 937 } 938 cases: 939 - values: 940 - Q[] 941 - Q 942 - values: 943 - Q[] 944 - R 945 - values: 946 - R[] 947 - Q[] 948 bugid: ["1710"] 949 - values: 950 - panda.String[] 951 - panda.ClassCastException[] 952 bugid: ["1710"] 953 954 955 - file-name: "array_against_other_type_j" 956 description: Check that ClassCastException is thrown when array cannot be cast to a type 957 isa: 958 description: > 959 Otherwise ClassCastException is thrown. 960 Object of type O can be cast to type T if O is the same as T or is subtype of T. For arrays O can be cast 961 to T if T is a root type in type hierarchy or T is such array that O array elements are the same or subtype of 962 T array elements. 963 exceptions: 964 - x_cast 965 header-template: ['PandaAssembly_header'] 966 tags: ['irtoc_ignore'] 967 check-type: empty 968 runner-options: ['use-pa'] 969 bugid: ["1710", "1720", "3967"] 970 code-template: | 971 972 .function i32 main() { 973 try_begin: 974 movi v0, 10 975 newarr v0, v0, %s 976 lda.obj v0 977 checkcast %s 978 ldai 1 979 return 980 try_end: 981 ldai 0 982 return 983 .catch panda.ClassCastException, try_begin, try_end, try_end 984 } 985 cases: 986 - values: 987 - panda.RuntimeException[] 988 - panda.RuntimeException 989 - values: 990 - panda.RuntimeException[] 991 - panda.Exception 992 - values: 993 - panda.io.Serializable[] 994 - R[] 995 bugid: ['1806'] 996 - values: 997 - Q[] 998 - Q 999 - values: 1000 - Q[] 1001 - R 1002 - values: [ "panda.Exception[]", "panda.RuntimeException[]"] 1003 - values: 1004 - R[] 1005 - Q[] 1006 1007 1008 - file-name: "with_wrong_acc_value_pa" 1009 description: Check that verification fails when accumulator contains wrong value, not an object or null 1010 isa: 1011 verification: 1012 - acc_obj_or_null 1013 header-template: ['pandasm_header'] 1014 check-type: empty 1015 tags: ['verifier'] 1016 runner-options: ['verifier-failure', 'verifier-config'] 1017 code-template: | 1018 1019 .function i32 main() { 1020 %s 1021 checkcast panda.Object 1022 ldai 0 1023 return 1024 } 1025 cases: 1026 - values: 1027 - ldai -1 1028 - values: 1029 - ldai.64 1 1030 - values: 1031 - fldai.64 -1.1 1032 1033 1034 - file-name: "with_wrong_acc_value_j" 1035 description: Check that verification fails when accumulator contains wrong value, not an object or null 1036 isa: 1037 verification: 1038 - acc_obj_or_null 1039 header-template: ['PandaAssembly_header'] 1040 check-type: empty 1041 runner-options: ['use-pa', 'verifier-failure', 'verifier-config'] 1042 tags: [verifier, pa-verifier] 1043 bugid: ['6886'] 1044 code-template: | 1045 1046 .function i32 main() { 1047 %s 1048 checkcast panda.Object 1049 ldai 0 1050 return 1051 } 1052 cases: 1053 - values: 1054 - ldai -1 1055 - values: 1056 - ldai.64 1 1057 - values: 1058 - fldai.64 -1.1 1059 1060 1061 - file-name: "with_wrong_type_id_pa" 1062 description: Check that verification fails when accumulator contains wrong value, not an object or null 1063 isa: 1064 verification: 1065 - type_id_any_object 1066 header-template: ['pandasm_header'] 1067 check-type: empty 1068 runner-options: ['compile-failure'] 1069 code-template: | 1070 1071 .function i32 main() { 1072 newobj v0, panda.Object 1073 lda.obj v0 1074 checkcast %s 1075 ldai 0 1076 return 1077 } 1078 cases: 1079 - values: 1080 - "0x7fffffff" 1081 - values: 1082 - "0x1234567890" 1083 - values: 1084 - 3.1415926 1085 - values: 1086 - "\"abc\"" 1087 1088 1089 - file-name: "with_wrong_type_id_j" 1090 description: Check that verification fails when accumulator contains wrong value, not an object or null 1091 isa: 1092 instructions: 1093 - sig: checkcast type_id 1094 acc: in:ref 1095 format: [op_id_16] 1096 verification: 1097 - type_id_any_object 1098 header-template: ['PandaAssembly_header'] 1099 check-type: empty 1100 runner-options: ['use-pa', 'compile-failure'] 1101 code-template: | 1102 1103 .function i32 main() { 1104 newobj v0, panda.Object 1105 lda.obj v0 1106 checkcast %s 1107 ldai 0 1108 return 1109 } 1110 cases: 1111 - values: 1112 - "0x7fffffff" 1113 - values: 1114 - "0x1234567890" 1115 - values: 1116 - 3.1415926 1117 - values: 1118 - "\"abc\"" 1119