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