1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13--- 14definitions: 15 - name: java 16 template: > 17 .language Java 18 19tests: 20 - file-name: call.short 21 isa: 22 title: Static call 23 description: > 24 Call indicated static method, i.e. create new frame, pass values of arguments and 25 continue execution from the first instruction of a method. 26 Callee should treat accumulator value as undefined and cannot use it until accumulator 27 definition in the new frame. 28 Result (if any) is returned in accumulator (see 'Calling sequence' chapter for more details). 29 Method, its class and the number of argument is resolved by given method_id in 30 runtime constant-pool. 31 Arguments are passed in source registers in the same order as in method signature. 32 Non-range instructions can be used to pass up to 4 arguments (unused register slot values will 33 be discarded and corresponding registers will not be passed to the callee). 34 For methods with more arguments range kind of instruction is to be used, which takes the needed number 35 of arguments starting from 'vs' register. 36 exceptions: 37 - x_none 38 verification: 39 - method_id_static 40 - compatible_arguments 41 commands: 42 - file-name: op_v1_4_v2_4_id_16 43 isa: 44 instructions: 45 - sig: call.short method_id, v1:in:top, v2:in:top 46 acc: out:top 47 format: [op_v1_4_v2_4_id_16] 48 header-template: [] 49 description: Check that 'call.short' supports up to 2 arguments. 50 tags: ['tsan'] 51 code-template: | 52 .function void f1(%s) { 53 return.void 54 } 55 .function i32 main() { 56 %s 57 call.short f1%s 58 check-type: exit-positive 59 cases: 60 - values: 61 - '' 62 - '' 63 - '' 64 - values: 65 - 'i32 a0' 66 - 'movi v0, 0' 67 - ', v0' 68 - values: 69 - 'i32 a0, i32 a1' 70 - 'movi v0, 0' 71 - ', v0, v0' 72 - values: 73 - 'i32 a0, i32 a1' 74 - | 75 # 76 movi v0, 0 77 movi v1, 0 78 - ', v0, v1' 79 - values: 80 - 'i32 a0, i32 a1' 81 - | 82 # 83 movi v0, 0 84 movi v1, 0 85 - ', v1, v0' 86 - values: 87 - 'i64 a0, f64 a1' 88 - | 89 # 90 movi.64 v0, 0 91 fmovi.64 v1, 0 92 - ', v0, v1' 93 - values: 94 - 'i32 a0, i32 a1, i32 a2' 95 - 'movi v0, 0' 96 - ', v0, v0, v0' 97 runner-options: [compile-failure] 98 - values: 99 - 'i32 a0, i32 a1, i32 a2' 100 - | 101 # 102 movi v0, 0 103 movi v1, 0 104 movi v2, 0 105 - ', v0, v1, v2' 106 runner-options: [compile-failure] 107 108 - file-name: str_srg 109 isa: 110 instructions: 111 - sig: call.short method_id, v1:in:top, v2:in:top 112 acc: out:top 113 format: [op_v1_4_v2_4_id_16] 114 header-template: [panda_string] 115 description: Check that 'call.short' works with String object. 116 tags: ['tsan'] 117 code-template: | 118 .function void f1(panda.String a0) { 119 return.void 120 } 121 .function i32 main() { 122 %s 123 call.short f1%s 124 check-type: exit-positive 125 cases: 126 - values: 127 - '' 128 - '' 129 runner-options: [compile-failure] 130 - values: 131 - | 132 # 133 lda.str "some string" 134 sta.obj v0 135 - ', v0' 136 - values: 137 - ' mov.null v0' 138 - ', v0' 139 - values: 140 - '' 141 - ', "some string"' 142 runner-options: [compile-failure] 143 144 - file-name: uninitialized_values 145 bugid: ['1324'] 146 tags: ['verifier'] 147 runner-options: ['verifier-failure', 'verifier-debug-config'] 148 isa: 149 instructions: 150 - sig: call.short method_id, v1:in:top, v2:in:top 151 acc: out:top 152 format: [op_v1_4_v2_4_id_16] 153 description: Verifier should check usage of uninitialized arguments passed to function. 154 header-template: [] 155 code-template: | 156 .function void f1(%s) { 157 %s 158 return.void 159 } 160 .function i32 main() { 161 %s 162 call.short f1%s 163 check-type: exit-positive 164 165 # Template parameters: 166 # 1st argument is function arguments 167 # 2nd - usage of acc or reg 168 # 3rd - possible initialization of registers 169 # 4th - call.short parameters 170 cases: 171 - values: 172 - 'i32 a0' # parameter 173 - '' # no instructions 174 - | 175 # 176 mov.null v0 177 movi v2, 0 178 - ', v2' # use in call.short 179 bugid: ['1940'] 180 runner-options: ['verifier-only', 'verifier-debug-config'] 181 - values: ['', 'lda v0', '', ''] 182 description: Check usage of uninitialized register in function frame. 183 bugid: ['1702'] 184 - values: ['', 'lda v0', 'movi v0, 0', ', v0'] 185 description: Check usage of uninitialized register in function frame. 186 bugid: ['1702'] 187 - values: ['', 'sta v0', '', ''] 188 description: Check usage of uninitialized accumulator in function frame. 189 bugid: ['1702'] 190 - values: ['i32 a0', '', '', ', v0'] 191 - values: ['i32 a0, i32 a1', '', '', ', v0, v0'] 192 - values: ['i32 a0, i32 a1', '', '', ', v0, v1'] 193 - values: ['i32 a0, i32 a1', '', 'movi v0, 0', ', v0, v1'] 194 description: Check if one of registers in 'call.short' is uninitialized. 195 - values: ['i32 a0, i32 a1', '', 'movi v1, 0', ', v0, v1'] 196 description: Check if one of registers in 'call.short' is uninitialized. 197 198 - values: ['', 'lda a0', '', ''] 199 description: Check usage of undefined parameter. 200 runner-options: [compile-failure] 201 - values: ['', 'lda a1', '', ''] 202 description: Check usage of undefined parameter. 203 runner-options: [compile-failure] 204 205 - file-name: uninitialized_reg_no_arg 206 bugid: ['1324'] 207 tags: ['verifier'] 208 runner-options: ['verifier-failure', 'verifier-debug-config'] 209 isa: 210 instructions: 211 - sig: call.short method_id, v1:in:top, v2:in:top 212 acc: out:top 213 format: [op_v1_4_v2_4_id_16] 214 description: Verifier should check usage of uninitialized registers in function. 215 header-template: [] 216 code-template: | 217 .function void f1() { 218 %s 219 return.void 220 } 221 .function i32 main() { 222 %s 223 call.short f1 224 check-type: exit-positive 225 cases: 226 - values: 227 - lda v0 228 - movi v0, 123 229 - values: 230 - lda v1 231 - movi v1, 123 232 - values: 233 - lda.64 v0 234 - movi.64 v0, 0xFFFFFFFFFFFFFFFF 235 - values: 236 - lda.64 v1 237 - movi.64 v1, 0xFFFFFFFFFFFFFFFF 238 - values: 239 - lda.64 v0 240 - fmovi.64 v0, 3.1415926535 241 - values: 242 - lda.64 v1 243 - movi.64 v1, 0xFFFFFFFFFFFFFFFF 244 - values: 245 - lda.obj v0 246 - | 247 # 248 lda.str "some string" 249 sta.obj v0 250 - values: 251 - lda.obj v1 252 - | 253 # 254 lda.str "some string" 255 sta.obj v1 256 257 - file-name: args_count_mismatch 258 runner-options: [compile-only] 259 isa: 260 instructions: 261 - sig: call.short method_id, v1:in:top, v2:in:top 262 acc: out:top 263 format: [op_v1_4_v2_4_id_16] 264 description: Check 'call.short' when arguments of function and instuction parameters mismatch. 265 header-template: [] 266 code-template: | 267 .function void f1(%s) { 268 return.void 269 } 270 .function i32 main() { 271 %s 272 call.short f1%s 273 check-type: exit-positive 274 275 # Template parameters: 276 # 1st - function arguments 277 # 2nd - possible initialization of registers 278 # 3rd - call.short parameters 279 cases: 280 - values: ['', '', ', v0'] 281 description: Check uninitialized register is ignored when its value is not used. 282 - values: ['', '', ', v0, v0'] 283 description: Check uninitialized register is ignored when its value is not used. 284 - values: ['i32 a0', '', ''] 285 runner-options: [compile-failure] 286 description: Mismatch function parameters. 287 - values: ['i32 a0, i32 a1', 'movi v0, 0', ', v0'] 288 runner-options: [compile-failure] 289 description: Mismatch function parameters. 290 - values: ['', 'movi v0, 0', ', v0'] 291 description: Check initialized register is ignored when its value is not used. 292 - values: ['i32 a0', 'movi v0, 0', ', v0, v0'] 293 description: Check initialized register is ignored when its value is not used. 294 295 - file-name: args_type_mismatch 296 bugid: ['1324'] 297 tags: ['verifier'] 298 runner-options: ['verifier-failure', 'verifier-debug-config'] 299 isa: 300 instructions: 301 - sig: call.short method_id, v1:in:top, v2:in:top 302 acc: out:top 303 format: [op_v1_4_v2_4_id_16] 304 description: Check 'call.short' when argument type of function and instuction mismatch. 305 header-template: [] 306 code-template: | 307 %s 308 .function void f1(%s) { 309 return.void 310 } 311 .function i32 main() { 312 %s 313 call.short f1, v0 314 check-type: exit-positive 315 316 # Template parameters: 317 # 1 - type definitions 318 # 2 - function arguments 319 # 3 - possible initialization of registers 320 # 4 - call.short parameters 321 cases: 322 - values: ['', 'i32 a0', 'mov.null v0'] 323 - values: ['', 'i64 a0', 'mov.null v0'] 324 - values: ['', 'f64 a0', 'mov.null v0'] 325 - values: ['', 'i32 a0', 'movi.64 v0, 0'] 326 - values: ['', 'f64 a0', 'movi.64 v0, 0'] 327 - values: ['.record Obj {}', 'Obj a0', 'movi.64 v0, 0'] 328 - values: ['', 'i64 a0', 'movi v0, 0'] 329 - values: ['', 'f64 a0', 'movi v0, 0'] 330 - values: ['.record Obj {}', 'Obj a0', 'movi v0, 0'] 331 - values: ['.record panda.String <external>', 'panda.String a0', 'movi v0, 0'] 332 - values: 333 - '.record panda.String <external>' 334 - 'i32 a0' 335 - | 336 lda.str "some string" 337 sta.obj v0 338 339 - values: 340 - | 341 # 342 .record Obj {} 343 344 .function void Obj.ctor(Obj a0) <ctor> { 345 return.void 346 } 347 - i32 a0 348 - | 349 # 350 initobj.short Obj.ctor 351 sta.obj v0 352 353 - values: 354 - | 355 # 356 .record Obj {} 357 358 .function void Obj.ctor(Obj a0) <ctor> { 359 return.void 360 } 361 - i64 a0 362 - | 363 # 364 initobj.short Obj.ctor 365 sta.obj v0 366 367 - file-name: reg 368 runner-options: [compile-only] 369 isa: 370 instructions: 371 - sig: call.short method_id, v1:in:top, v2:in:top 372 acc: out:top 373 format: [op_v1_4_v2_4_id_16] 374 description: Check 'call.short' register number width. 375 header-template: [] 376 code-template: | 377 .function void f1(i32 a0) { 378 return.void 379 } 380 .function i32 main() { 381 movi %s, 0 382 call.short f1, %s 383 check-type: exit-positive 384 cases: 385 - values: ['v0', 'v0'] 386 - values: ['v7', 'v7'] 387 - values: ['v8', 'v8'] 388 - values: ['v15', 'v15'] 389 - values: ['v16', 'v16'] 390 runner-options: [compile-failure] 391 - values: ['v127', 'v127'] 392 runner-options: [compile-failure] 393 - values: ['v0', '1'] 394 runner-options: [compile-failure] 395 - values: ['v0', '1.1'] 396 runner-options: [compile-failure] 397 - values: ['v0', '0xFFFFFFFFFFFFFFFF'] 398 runner-options: [compile-failure] 399 - values: ['v0', '"some string"'] 400 runner-options: [compile-failure] 401 402 - file-name: reg2 403 runner-options: [compile-only] 404 isa: 405 instructions: 406 - sig: call.short method_id, v1:in:top, v2:in:top 407 acc: out:top 408 format: [op_v1_4_v2_4_id_16] 409 description: Check 'call.short' register number width. 410 header-template: [] 411 code-template: | 412 .function void f1(i32 a0, i32 a1) { 413 return.void 414 } 415 .function i32 main() { 416 movi %s, 0 417 movi %s, 1 418 call.short f1, %s, %s 419 check-type: exit-positive 420 cases: 421 - values: ['v0', 'v1', 'v0', 'v1'] 422 - values: ['v7', 'v7', 'v7', 'v7'] 423 - values: ['v7', 'v8', 'v7', 'v8'] 424 - values: ['v15', 'v15', 'v15', 'v15'] 425 - values: ['v15', 'v16', 'v15', 'v16'] 426 runner-options: [compile-failure] 427 - values: ['v16', 'v15', 'v16', 'v15'] 428 runner-options: [compile-failure] 429 - values: ['v16', 'v16', 'v16', 'v16'] 430 runner-options: [compile-failure] 431 - values: ['v127', 'v127', 'v127', 'v127'] 432 runner-options: [compile-failure] 433 434 - file-name: arg_1_i32_acc 435 isa: 436 instructions: 437 - sig: call.short method_id, v1:in:top, v2:in:top 438 acc: out:top 439 format: [op_v1_4_v2_4_id_16] 440 description: Check correctness of passed arguments. Load parameter to accumulator. Check i32 type of arguments. 441 header-template: [] 442 code-template: | 443 .function i32 f1(i32 a0) { 444 lda a0 445 movi v1, %s 446 jne v1, exit_failure 447 ldai 0 448 return 449 exit_failure: 450 ldai 1 451 return 452 } 453 .function i32 main() { 454 movi v0, %s 455 call.short f1, v0 456 457 check-type: no-check 458 cases: 459 - values: ["0", "0"] 460 - values: ["1", "1"] 461 - values: ["1234567", "1234567"] 462 - values: ["0x7FFFFFFF", "0x7FFFFFFF"] 463 - values: ["0x80000000", "0x80000000"] 464 - values: ["0x9ABCDEF0", "0x9ABCDEF0"] 465 - values: ["0xFFFFFFFF", "0xFFFFFFFF"] 466 467 - file-name: arg_1_f64_acc 468 isa: 469 instructions: 470 - sig: call.short method_id, v1:in:top, v2:in:top 471 acc: out:top 472 format: [op_v1_4_v2_4_id_16] 473 description: Check correctness of passed arguments. Load parameter to accumulator. Check f64 type of arguments. 474 header-template: [] 475 code-template: | 476 .function i32 f1(f64 a0) { 477 lda.64 a0 478 fmovi.64 v1, %s 479 fcmpg.64 v1 480 return 481 } 482 .function i32 main() { 483 fmovi.64 v0, %s 484 call.short f1, v0 485 check-type: no-check 486 cases: 487 - values: ["0", "0"] 488 - values: ["1.1", "1.1"] 489 - values: ["0x7ff0000000000000", "0x7ff0000000000000"] 490 - values: ["0xfff0000000000000", "0xfff0000000000000"] 491 - values: ["0x7fefffffffffffff", "0x7fefffffffffffff"] 492 - values: ["0xffefffffffffffff", "0xffefffffffffffff"] 493 - values: ["100e100", "100e100"] 494 495 - file-name: arg_1_i32_reg 496 isa: 497 instructions: 498 - sig: call.short method_id, v1:in:top, v2:in:top 499 acc: out:top 500 format: [op_v1_4_v2_4_id_16] 501 description: Check correctness of passed arguments. Load parameter to register. Check i32 type of arguments. 502 header-template: [] 503 code-template: | 504 .function i32 f1(i32 a0) { 505 mov v1, a0 506 ldai %s 507 jne v1, exit_failure 508 ldai 0 509 return 510 exit_failure: 511 ldai 1 512 return 513 } 514 .function i32 main() { 515 movi v0, %s 516 call.short f1, v0 517 check-type: no-check 518 cases: 519 - values: ["0", "0"] 520 - values: ["1", "1"] 521 - values: ["1234567", "1234567"] 522 - values: ["0x7FFFFFFF", "0x7FFFFFFF"] 523 - values: ["0x80000000", "0x80000000"] 524 - values: ["0x9ABCDEF0", "0x9ABCDEF0"] 525 - values: ["0xFFFFFFFF", "0xFFFFFFFF"] 526 527 - file-name: arg_1_f64_reg 528 isa: 529 instructions: 530 - sig: call.short method_id, v1:in:top, v2:in:top 531 acc: out:top 532 format: [op_v1_4_v2_4_id_16] 533 description: Check correctness of passed arguments. Load parameter to register. Check f64 type of arguments. 534 header-template: [] 535 code-template: | 536 .function i32 f1(f64 a0) { 537 mov.64 v1, a0 538 fldai.64 %s 539 fcmpg.64 v1 540 return 541 } 542 .function i32 main() { 543 fmovi.64 v0, %s 544 call.short f1, v0 545 check-type: no-check 546 cases: 547 - values: ["0", "0"] 548 - values: ["1.1", "1.1"] 549 - values: ["0x7ff0000000000000", "0x7ff0000000000000"] 550 - values: ["0xfff0000000000000", "0xfff0000000000000"] 551 - values: ["0x7fefffffffffffff", "0x7fefffffffffffff"] 552 - values: ["0xffefffffffffffff", "0xffefffffffffffff"] 553 - values: ["100e100", "100e100"] 554 555 - file-name: arg_2_i32_acc 556 isa: 557 instructions: 558 - sig: call.short method_id, v1:in:top, v2:in:top 559 acc: out:top 560 format: [op_v1_4_v2_4_id_16] 561 description: Check correctness of passed arguments. Load parameter to accumulator. Check i32 type of arguments. 562 header-template: [] 563 code-template: | 564 .function i32 f1(i32 a0, i32 a1) { 565 lda a0 566 movi v1, %s 567 jeq v1, f1_l1 568 # 1st arg does not match, exit 569 ldai 1 570 return 571 f1_l1: 572 lda a1 573 movi v1, %s 574 jne v1, exit_failure 575 ldai 0 576 return 577 exit_failure: 578 ldai 1 579 return 580 } 581 .function i32 main() { 582 movi v0, %s 583 movi v1, %s 584 call.short f1, v0, v1 585 586 check-type: no-check 587 cases: 588 - values: ["0", "0", "0", "0"] 589 - values: ["0", "1", "0", "1"] 590 - values: ["1", "0", "1", "0"] 591 - values: ["0", "1234567", "0", "1234567"] 592 - values: ["1234567", "0", "1234567", "0"] 593 - values: ["0x7FFFFFFF", "0", "0x7FFFFFFF", "0"] 594 - values: ["0", "0x7FFFFFFF", "0", "0x7FFFFFFF"] 595 - values: ["0x7FFFFFFF", "0x7FFFFFFF", "0x7FFFFFFF", "0x7FFFFFFF"] 596 - values: ["0x12345678", "0x9ABCDEF0", "0x12345678", "0x9ABCDEF0"] 597 - values: ["0", "0x80000000", "0", "0x80000000"] 598 - values: ["0x80000000", "0", "0x80000000", "0"] 599 - values: ["0x80000000", "0x80000000", "0x80000000", "0x80000000"] 600 - values: ["0x9ABCDEF0", "0xFEDCBA09", "0x9ABCDEF0", "0xFEDCBA09"] 601 - values: ["0", "0xFFFFFFFF", "0", "0xFFFFFFFF"] 602 - values: ["0xFFFFFFFF", "0", "0xFFFFFFFF", "0"] 603 - values: ["0xFFFFFFFF", "0xFFFFFFFF", "0xFFFFFFFF", "0xFFFFFFFF"] 604 605 - file-name: arg_2_i32_reg 606 isa: 607 instructions: 608 - sig: call.short method_id, v1:in:top, v2:in:top 609 acc: out:top 610 format: [op_v1_4_v2_4_id_16] 611 description: Check correctness of passed arguments. Load parameter to register. Check i32 type of arguments. 612 header-template: [] 613 code-template: | 614 .function i32 f1(i32 a0, i32 a1) { 615 mov v1, a0 616 ldai %s 617 jeq v1, f1_l1 618 # 1st arg does not match, exit 619 ldai 1 620 return 621 f1_l1: 622 mov v1, a1 623 ldai %s 624 jne v1, exit_failure 625 ldai 0 626 return 627 exit_failure: 628 ldai 1 629 return 630 } 631 .function i32 main() { 632 movi v0, %s 633 movi v1, %s 634 call.short f1, v0, v1 635 check-type: no-check 636 cases: 637 - values: ["0", "0", "0", "0"] 638 - values: ["0", "1", "0", "1"] 639 - values: ["1", "0", "1", "0"] 640 - values: ["0", "1234567", "0", "1234567"] 641 - values: ["1234567", "0", "1234567", "0"] 642 - values: ["0x7FFFFFFF", "0", "0x7FFFFFFF", "0"] 643 - values: ["0", "0x7FFFFFFF", "0", "0x7FFFFFFF"] 644 - values: ["0x7FFFFFFF", "0x7FFFFFFF", "0x7FFFFFFF", "0x7FFFFFFF"] 645 - values: ["0x12345678", "0x9ABCDEF0", "0x12345678", "0x9ABCDEF0"] 646 - values: ["0", "0x80000000", "0", "0x80000000"] 647 - values: ["0x80000000", "0", "0x80000000", "0"] 648 - values: ["0x80000000", "0x80000000", "0x80000000", "0x80000000"] 649 - values: ["0x9ABCDEF0", "0xFEDCBA09", "0x9ABCDEF0", "0xFEDCBA09"] 650 - values: ["0", "0xFFFFFFFF", "0", "0xFFFFFFFF"] 651 - values: ["0xFFFFFFFF", "0", "0xFFFFFFFF", "0"] 652 - values: ["0xFFFFFFFF", "0xFFFFFFFF", "0xFFFFFFFF", "0xFFFFFFFF"] 653 654 - file-name: arg_2_f64_acc 655 isa: 656 instructions: 657 - sig: call.short method_id, v1:in:top, v2:in:top 658 acc: out:top 659 format: [op_v1_4_v2_4_id_16] 660 description: Check correctness of passed arguments. Load parameter to accumulator. Check f64 type of arguments. 661 tags: ['tsan'] 662 header-template: [] 663 code-template: | 664 .function i32 f1(f64 a0, f64 a1) { 665 lda.64 a0 666 fmovi.64 v1, %s 667 fcmpg.64 v1 668 jeqz f1_l1 669 # 1st arg does not match, exit 670 ldai 1 671 return 672 f1_l1: 673 lda.64 a1 674 fmovi.64 v1, %s 675 fcmpg.64 v1 676 return 677 } 678 .function i32 main() { 679 fmovi.64 v0, %s 680 fmovi.64 v1, %s 681 call.short f1, v0, v1 682 683 check-type: no-check 684 cases: 685 - values: ["0", "0", "0", "0"] 686 - values: ["1.2", "1.1", "1.2", "1.1"] 687 - values: ["0x7ff0000000000000", "0xfff0000000000000", "0x7ff0000000000000", "0xfff0000000000000"] 688 - values: ["0xffefffffffffffff", "0x7fefffffffffffff", "0xffefffffffffffff", "0x7fefffffffffffff"] 689 - values: ["100e100", "200e200", "100e100", "200e200"] 690 691 - file-name: arg_2_f64_reg 692 isa: 693 instructions: 694 - sig: call.short method_id, v1:in:top, v2:in:top 695 acc: out:top 696 format: [op_v1_4_v2_4_id_16] 697 description: Check correctness of passed arguments. Load parameter to register. Check f64 type of arguments. 698 header-template: [] 699 code-template: | 700 .function i32 f1(f64 a0, f64 a1) { 701 mov.64 v1, a0 702 fldai.64 %s 703 fcmpg.64 v1 704 jeqz f1_l1 705 # 1st arg does not match, exit 706 ldai 1 707 return 708 f1_l1: 709 mov.64 v1, a1 710 fldai.64 %s 711 fcmpg.64 v1 712 return 713 } 714 .function i32 main() { 715 fmovi.64 v0, %s 716 fmovi.64 v1, %s 717 call.short f1, v0, v1 718 check-type: no-check 719 cases: 720 - values: ["0", "0", "0", "0"] 721 - values: ["1.2", "1.1", "1.2", "1.1"] 722 - values: ["0x7ff0000000000000", "0xfff0000000000000", "0x7ff0000000000000", "0xfff0000000000000"] 723 - values: ["0xffefffffffffffff", "0x7fefffffffffffff", "0xffefffffffffffff", "0x7fefffffffffffff"] 724 - values: ["100e100", "200e200", "100e100", "200e200"] 725 726 - file-name: arg_1_i64_acc 727 isa: 728 instructions: 729 - sig: call.short method_id, v1:in:top, v2:in:top 730 acc: out:top 731 format: [op_v1_4_v2_4_id_16] 732 description: Check correctness of passed arguments. Load parameter to accumulator. Check i64 type of arguments. 733 header-template: [] 734 code-template: | 735 .function i32 f1(i64 a0) { 736 lda.64 a0 737 movi.64 v1, %s 738 cmp.64 v1 739 return 740 } 741 .function i32 main() { 742 movi.64 v0, %s 743 call.short f1, v0 744 745 check-type: no-check 746 cases: 747 - values: ["0", "0"] 748 - values: ["1", "1"] 749 - values: ["0x1234567890ABCDEF", "0x1234567890ABCDEF"] 750 - values: ["0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF"] 751 - values: ["0x8000000000000000", "0x8000000000000000"] 752 - values: ["0xFEDCBA0987654321", "0xFEDCBA0987654321"] 753 - values: ["0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF"] 754 755 - file-name: arg_1_i64_reg 756 isa: 757 instructions: 758 - sig: call.short method_id, v1:in:top, v2:in:top 759 acc: out:top 760 format: [op_v1_4_v2_4_id_16] 761 description: Check correctness of passed arguments. Load parameter to accumulator. Check i64 type of arguments. 762 header-template: [] 763 code-template: | 764 .function i32 f1(i64 a0) { 765 mov.64 v1, a0 766 ldai.64 %s 767 cmp.64 v1 768 return 769 } 770 .function i32 main() { 771 movi.64 v0, %s 772 call.short f1, v0 773 774 check-type: no-check 775 cases: 776 - values: ["0", "0"] 777 - values: ["1", "1"] 778 - values: ["0x1234567890ABCDEF", "0x1234567890ABCDEF"] 779 - values: ["0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF"] 780 - values: ["0x8000000000000000", "0x8000000000000000"] 781 - values: ["0xFEDCBA0987654321", "0xFEDCBA0987654321"] 782 - values: ["0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF"] 783 784 - file-name: arg_2_i64_acc 785 isa: 786 instructions: 787 - sig: call.short method_id, v1:in:top, v2:in:top 788 acc: out:top 789 format: [op_v1_4_v2_4_id_16] 790 description: Check correctness of passed arguments. Load parameter to accumulator. 791 tags: ['tsan'] 792 header-template: [] 793 code-template: | 794 .function i32 f1(i64 a0, i64 a1) { 795 lda.64 a0 796 movi.64 v1, %s 797 cmp.64 v1 798 jeqz f1_l1 799 # 1st arg does not match, exit 800 ldai 1 801 return 802 f1_l1: 803 lda.64 a1 804 movi.64 v1, %s 805 cmp.64 v1 806 return 807 } 808 .function i32 main() { 809 movi.64 v0, %s 810 movi.64 v1, %s 811 call.short f1, v0, v1 812 813 check-type: no-check 814 cases: 815 - values: ["0", "0", "0", "0"] 816 - values: ["0", "1", "0", "1"] 817 - values: ["1", "0", "1", "0"] 818 - values: ["0x1234567890ABCDEF", "0x234567890ABCDEF1", "0x1234567890ABCDEF", "0x234567890ABCDEF1"] 819 - values: ["0x7FFFFFFFFFFFFFFF", "0", "0x7FFFFFFFFFFFFFFF", "0"] 820 - values: ["0", "0x7FFFFFFFFFFFFFFF", "0", "0x7FFFFFFFFFFFFFFF"] 821 - values: ["0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF"] 822 - values: ["0", "0x8000000000000000", "0", "0x8000000000000000"] 823 - values: ["0x8000000000000000", "0", "0x8000000000000000", "0"] 824 - values: ["0x8000000000000000", "0x8000000000000000", "0x8000000000000000", "0x8000000000000000"] 825 - values: ["0xFEDCBA0987654321", "0xEDCBA0987654321F", "0xFEDCBA0987654321", "0xEDCBA0987654321F"] 826 - values: ["0", "0xFFFFFFFFFFFFFFFF", "0", "0xFFFFFFFFFFFFFFFF"] 827 - values: ["0xFFFFFFFFFFFFFFFF", "0", "0xFFFFFFFFFFFFFFFF", "0"] 828 - values: ["0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF"] 829 830 - file-name: arg_2_i64_reg 831 isa: 832 instructions: 833 - sig: call.short method_id, v1:in:top, v2:in:top 834 acc: out:top 835 format: [op_v1_4_v2_4_id_16] 836 description: Check correctness of passed arguments. Load parameter to register. Check i64 type of arguments. 837 header-template: [] 838 code-template: | 839 .function i32 f1(i64 a0, i64 a1) { 840 mov.64 v1, a0 841 ldai.64 %s 842 cmp.64 v1 843 jeqz f1_l1 844 # 1st arg does not match, exit 845 ldai 1 846 return 847 f1_l1: 848 mov.64 v1, a1 849 ldai.64 %s 850 cmp.64 v1 851 return 852 } 853 .function i32 main() { 854 movi.64 v0, %s 855 movi.64 v1, %s 856 call.short f1, v0, v1 857 858 check-type: no-check 859 cases: 860 - values: ["0", "0", "0", "0"] 861 - values: ["0", "1", "0", "1"] 862 - values: ["1", "0", "1", "0"] 863 - values: ["0x1234567890ABCDEF", "0x234567890ABCDEF1", "0x1234567890ABCDEF", "0x234567890ABCDEF1"] 864 - values: ["0x7FFFFFFFFFFFFFFF", "0", "0x7FFFFFFFFFFFFFFF", "0"] 865 - values: ["0", "0x7FFFFFFFFFFFFFFF", "0", "0x7FFFFFFFFFFFFFFF"] 866 - values: ["0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF"] 867 - values: ["0", "0x8000000000000000", "0", "0x8000000000000000"] 868 - values: ["0x8000000000000000", "0", "0x8000000000000000", "0"] 869 - values: ["0x8000000000000000", "0x8000000000000000", "0x8000000000000000", "0x8000000000000000"] 870 - values: ["0xFEDCBA0987654321", "0xEDCBA0987654321F", "0xFEDCBA0987654321", "0xEDCBA0987654321F"] 871 - values: ["0", "0xFFFFFFFFFFFFFFFF", "0", "0xFFFFFFFFFFFFFFFF"] 872 - values: ["0xFFFFFFFFFFFFFFFF", "0", "0xFFFFFFFFFFFFFFFF", "0"] 873 - values: ["0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF"] 874 875 - file-name: arg_1_obj_acc 876 isa: 877 instructions: 878 - sig: call.short method_id, v1:in:top, v2:in:top 879 acc: out:top 880 format: [op_v1_4_v2_4_id_16] 881 description: Check correctness of passed arguments. Load parameter to accumulator. Check object type of arguments. 882 header-template: [obj_ctor] 883 code-template: | 884 .function Obj fnc(Obj a0) { 885 lda.obj a0 886 return.obj 887 } 888 889 .function i32 main() { 890 %s 891 sta.obj v0 892 ldai 0 # acc is i32 893 call.short fnc, v0 # acc contains returned Obj 894 jne.obj v0, return_ne_num 895 ldai 0 896 return 897 return_ne_num: 898 ldai 1 899 return 900 901 check-type: no-check 902 cases: 903 - values: 904 - "lda.null" 905 - values: 906 - "initobj Obj.ctor" 907 908 - file-name: arg_2_obj_acc 909 isa: 910 instructions: 911 - sig: call.short method_id, v1:in:top, v2:in:top 912 acc: out:top 913 format: [op_v1_4_v2_4_id_16] 914 description: Check correctness of passed arguments. Load parameter to accumulator. Check object type. 915 tags: ['tsan'] 916 header-template: [obj_ctor] 917 code-template: | 918 .record ObjTuple { 919 Obj o1 920 Obj o2 921 } 922 923 .function void ObjTuple.ctor(ObjTuple a0, Obj a1, Obj a2) <ctor> { 924 lda.obj a1 925 stobj.obj a0, ObjTuple.o1 926 lda.obj a2 927 stobj.obj a0, ObjTuple.o2 928 return.void 929 } 930 931 .function ObjTuple getObjTuple(Obj a0, Obj a1) { 932 mov.obj v0, a0 933 mov.obj v1, a1 934 initobj.short ObjTuple.ctor, v0, v1 935 return.obj 936 } 937 938 .function i32 main() { 939 %s 940 call.short getObjTuple, v0, v1 941 sta.obj v2 942 943 # check ObjTuple.o1 contains correct value (v0) 944 ldobj.obj v2, ObjTuple.o1 945 jeq.obj v0, tuple_2_check 946 ldai 1 947 return 948 tuple_2_check: 949 # check ObjTuple.o2 contains correct value (v1) 950 ldobj.obj v2, ObjTuple.o2 951 jeq.obj v1, tuple_2_check_passed 952 ldai 1 953 return 954 tuple_2_check_passed: 955 ldai 0 956 957 check-type: no-check 958 cases: 959 - values: 960 - | 961 # 962 mov.null v0 963 mov.null v1 964 - values: 965 - | 966 # 967 initobj.short Obj.ctor 968 sta.obj v0 969 initobj.short Obj.ctor 970 sta.obj v1 971 - values: 972 - | 973 # 974 mov.null v0 975 initobj Obj.ctor 976 sta.obj v1 977 - values: 978 - | 979 # 980 initobj Obj.ctor 981 sta.obj v0 982 mov.null v1 983 984 - file-name: arg_2_str_acc 985 isa: 986 instructions: 987 - sig: call.short method_id, v1:in:top, v2:in:top 988 acc: out:top 989 format: [op_v1_4_v2_4_id_16] 990 description: Check correctness of passed arguments. Load parameter to accumulator. Check String type. 991 header-template: [panda_string] 992 code-template: | 993 .record ObjTuple { 994 panda.String o1 995 panda.String o2 996 } 997 998 .function void ObjTuple.ctor(ObjTuple a0, panda.String a1, panda.String a2) <ctor> { 999 lda.obj a1 1000 stobj.obj a0, ObjTuple.o1 1001 lda.obj a2 1002 stobj.obj a0, ObjTuple.o2 1003 return.void 1004 } 1005 1006 .function ObjTuple getObjTuple(panda.String a0, panda.String a1) { 1007 mov.obj v0, a0 1008 mov.obj v1, a1 1009 initobj.short ObjTuple.ctor, v0, v1 1010 return.obj 1011 } 1012 1013 .function i32 main() { 1014 %s 1015 call.short getObjTuple, v0, v1 1016 sta.obj v2 1017 1018 # check ObjTuple.o1 contains correct value (v0) 1019 ldobj.obj v2, ObjTuple.o1 1020 jeq.obj v0, tuple_2_check 1021 ldai 1 1022 return 1023 tuple_2_check: 1024 # check ObjTuple.o2 contains correct value (v1) 1025 ldobj.obj v2, ObjTuple.o2 1026 jeq.obj v1, tuple_2_check_passed 1027 ldai 1 1028 return 1029 tuple_2_check_passed: 1030 ldai 0 1031 1032 check-type: no-check 1033 cases: 1034 - values: 1035 - | 1036 # 1037 mov.null v0 1038 mov.null v1 1039 - values: 1040 - | 1041 # 1042 lda.str "some string 1" 1043 sta.obj v0 1044 lda.str "some string 2" 1045 sta.obj v1 1046 - values: 1047 - | 1048 # 1049 mov.null v0 1050 lda.str "some string 2" 1051 sta.obj v1 1052 - values: 1053 - | 1054 # 1055 lda.str "some string 1" 1056 sta.obj v0 1057 mov.null v1 1058 1059 - file-name: method_id_not_static_p 1060 tags: ['verifier'] 1061 bugid: ['3247'] 1062 runner-options: ['verifier-failure', 'verifier-debug-config'] 1063 isa: 1064 instructions: 1065 - sig: call.short method_id, v1:in:top, v2:in:top 1066 acc: out:top 1067 format: [op_v1_4_v2_4_id_16] 1068 verification: 1069 - method_id_static 1070 - method_id_non_abstract 1071 description: Method_id must resolve to a static method in Panda Assembly context. Not static methods should be rejected by verifier. 1072 header-template: [] 1073 code-template: | 1074 .record A {} 1075 1076 .function void A.ctor(A a0) <ctor> { 1077 return.void 1078 } 1079 1080 .function i32 A.foo(A a0%s) *s 1081 1082 .function i32 main() { 1083 initobj A.ctor 1084 sta.obj v0 1085 %s 1086 call.short A.foo, v0%s 1087 check-type: exit-positive 1088 cases: 1089 - values: 1090 - | 1091 { 1092 ldai 0 1093 return 1094 } 1095 ignore: true 1096 - values: ['<noimpl>'] 1097 ignore: true 1098 - values: 1099 - | 1100 <static> { 1101 ldai 0 1102 return 1103 } 1104 runner-options: ['verifier-only', 'verifier-debug-config'] 1105 template-cases: 1106 - values: ['', '##-', ''] 1107 - values: [', A a1', 'mov.obj v1, v0', ', v1'] 1108 1109 - file-name: amount_of_args 1110 isa: 1111 instructions: 1112 - sig: call.short method_id, v1:in:top, v2:in:top 1113 acc: out:top 1114 format: [op_v1_4_v2_4_id_16] 1115 header-template: [] 1116 description: Compiler should check amount of `call.short` argument and function parameters. 1117 code-template: | 1118 .function void f1(i32 a0%s) { 1119 return.void 1120 } 1121 .function i32 main() { 1122 call.short f1%s 1123 check-type: none 1124 runner-options: [compile-failure] 1125 cases: 1126 - values: ['', ''] 1127 - values: [', i32 a1', ''] 1128 - values: [', i32 a1', ', v0'] 1129 - values: [', i32 a1, i32 a2', ''] 1130 - values: [', i32 a1, i32 a2', ', v0'] 1131 - values: [', i32 a1, i32 a2', ', v0, v0'] 1132 - values: [', i32 a1, i32 a2', ', v0, v0, v0'] 1133 1134 - file-name: unused_regs 1135 isa: 1136 description: > 1137 Non-range instructions can be used to pass up to 4 arguments (unused register slot values will 1138 be discarded and corresponding registers will not be passed to the callee). 1139 header-template: [] 1140 description: Verifier should ignore unused register slots. 1141 code-template: | 1142 .function i32 foo(%s) { 1143 ldai 0 1144 return 1145 } 1146 .function i32 main() { 1147 %s 1148 call.short foo%s 1149 check-type: no-check 1150 cases: 1151 - values: 1152 - "" 1153 - "" 1154 - ", v5" 1155 - values: 1156 - "i64 a0" 1157 - | 1158 # 1159 movi.64 v5, 123456789 1160 - ", v5, v9" 1161