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