• 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
19tests:
20  - file-name: call.acc
21    isa:
22      title: Static call with accumulator as input
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        In dynamically-typed language context accept 'any' values in source registers.
35        Immediate operand encodes a position starting from 0 on which accumulator is passed.
36      exceptions:
37        - x_none
38      verification:
39        - method_id_static
40        - compatible_arguments
41        - method_id_non_abstract
42      instructions:
43        - sig: call.acc method_id, v1:in:top, v2:in:top, v3:in:top, imm:u2
44          acc: inout:top
45          format: [op_v1_4_v2_4_v3_4_imm_4_id_16]
46    commands:
47
48      - file-name: op_v1_4_v2_4_v3_4_imm_4_id_16
49        description: Check that compiler reports an error on invalid instruction format.
50        isa:
51          instructions:
52            - sig: call.acc method_id, v1:in:top, v2:in:top, v3:in:top, imm:u2
53              acc: inout:top
54              format: [op_v1_4_v2_4_v3_4_imm_4_id_16]
55        header-template: []
56        check-type: exit-positive
57        runner-options: [compile-failure]
58        code-template: |
59          .function void f0() {
60              return.void
61          }
62          .function void f1(i32 a0) {
63              return.void
64          }
65          .function void f2(i32 a0, i32 a1) {
66              return.void
67          }
68          .function void f3(i32 a0, i32 a1, i32 a2) {
69              return.void
70          }
71          .function void f4(i32 a0, i32 a1, i32 a2, i32 a3) {
72              return.void
73          }
74          .function void f5(i32 a0, i32 a1, i32 a2, i32 a3, i32 a4) {
75              return.void
76          }
77          .function i32 main() {
78              call.acc %s
79        cases:
80          - values: ['foo, v0, v0, v0, 0']
81          - values: ['main']
82          - values: ['f0, 0']
83          - values: ['f1, 1']
84          - values: ['f1, v0, 0']
85          - values: ['f2, v0, 0']
86          - values: ['f2, v0, v0, 1']
87          - values: ['f3, v0, v0, 0']
88          - values: ['f3, v0, v0, v0, 1']
89            runner-options: [compile-only]
90          - values: ['f4, v0, v0, v0, 0']
91            runner-options: [compile-only]
92          - values: ['f4, v0, v0, v0, v0, 1']
93          - values: ['f5, v0, v0, v0, v0, 0']
94          - values: ['f5, v0, v0, v0, v0, v0, 1']
95          - values: ['f4, v0, v0, v0, 4']
96            bugid: ['5554']
97            ignore: true
98          - values: ['f4, v0, v0, v0, 5']
99            bugid: ['5554']
100            ignore: true
101          - values: ['f4, v16, v0, v0, 0']
102          - values: ['f4, v0, v255, v0, 0']
103          - values: ['f4, v0, v0, v32767, 0']
104          - values: ['f4, v65536, v0, v0, 0']
105          - values: ['f4, a0, a0, a0, 0']
106
107
108      - file-name: reg_v_valid
109        description: Check with all valid 'v' register numbers.
110        isa:
111          instructions:
112            - sig: call.acc method_id, v1:in:top, v2:in:top, v3:in:top, imm:u2
113              acc: inout:top
114              format: [op_v1_4_v2_4_v3_4_imm_4_id_16]
115        runner-options: [verifier-only, verifier-debug-config]
116        tags: [verifier]
117        header-template: []
118        check-type: exit-positive
119        code-template: |
120          .function i32 foo(i32 a0, i32 a1, i32 a2, i32 a3) {
121              lda a3
122              return
123          }
124          .function i32 main() {
125              ldai 0
126              movi v0, 0
127              movi v1, 1
128              movi v2, 2
129              movi v3, 3
130              movi v4, 4
131              movi v5, 5
132              movi v6, 6
133              movi v7, 7
134              movi v8, 8
135              movi v9, 9
136              movi v10, 10
137              movi v11, 11
138              movi v12, 12
139              movi v13, 13
140              movi v14, 14
141              movi v15, 15
142              call.acc foo, v0, v1, v2, 0
143              call.acc foo, v3, v4, v5, 1
144              call.acc foo, v6, v7, v8, 2
145              call.acc foo, v9, v10, v11, 3
146              call.acc foo, v12, v13, v14, 0
147              call.acc foo, v15, v15, v15, 1
148
149
150      - file-name: reg_a_valid
151        description: Check with all valid 'a' register numbers.
152        isa:
153          instructions:
154            - sig: call.acc method_id, v1:in:top, v2:in:top, v3:in:top, imm:u2
155              acc: inout:top
156              format: [op_v1_4_v2_4_v3_4_imm_4_id_16]
157        runner-options: [verifier-only, verifier-debug-config]
158        tags: [verifier]
159        header-template: []
160        check-type: exit-positive
161        code-template: |
162          .function i32 foo(i32 a0, i32 a1, i32 a2, i32 a3) {
163              lda a0
164              return
165          }
166          .function void f(i32 a0, i32 a1, i32 a2, i32 a3, i32 a4, i32 a5, i32 a6, i32 a7, i32 a8, i32 a9, i32 a10, i32 a11, i32 a12, i32 a13, i32 a14, i32 a15) {
167              ldai 0
168              call.acc foo, a0, a1, a2, 0
169              call.acc foo, a3, a4, a5, 1
170              call.acc foo, a6, a7, a8, 2
171              call.acc foo, a9, a10, a11, 3
172              call.acc foo, a12, a13, a14, 0
173              call.acc foo, a15, a15, a15, 1
174              return.void
175          }
176          .function i32 main() {
177              movi v0, 0
178              movi v1, 1
179              movi v2, 2
180              movi v3, 3
181              movi v4, 4
182              movi v5, 5
183              movi v6, 6
184              movi v7, 7
185              movi v8, 8
186              movi v9, 9
187              movi v10, 10
188              movi v11, 11
189              movi v12, 12
190              movi v13, 13
191              movi v14, 14
192              movi v15, 15
193              call.range f, v0
194
195
196      - file-name: uninitialized_regs
197        description: Check that verifier reports an error on uninitialized registers.
198        isa:
199          instructions:
200            - sig: call.acc method_id, v1:in:top, v2:in:top, v3:in:top, imm:u2
201              acc: inout:top
202              format: [op_v1_4_v2_4_v3_4_imm_4_id_16]
203        header-template: []
204        runner-options: [verifier-failure, verifier-debug-config]
205        tags: [verifier]
206        check-type: exit-positive
207        code-template: |
208          .function i32 foo(%s) {
209              %s
210              return
211          }
212          .function i32 main() {
213              %s
214              call.acc foo, %s
215        cases:
216          - description: Register v0 is not initialized.
217            values:
218            - i32 a0, i32 a1, i32 a2, i32 a3
219            - lda a1
220            - |
221              #
222                  ldai 0
223                  movi v1, 0
224                  movi v2, 0
225            - v0, v1, v2, 0
226          - description: Register v1 is not initialized.
227            values:
228            - i32 a0, i32 a1, i32 a2, i32 a3
229            - lda a2
230            - |
231              #
232                  ldai 0
233                  movi v0, 0
234                  movi v2, 0
235            - v0, v1, v2, 0
236          - description: Register v2 is not initialized.
237            values:
238            - i32 a0, i32 a1, i32 a2, i32 a3
239            - lda a3
240            - |
241              #
242                  ldai 0
243                  movi v0, 0
244                  movi v1, 0
245            - v0, v1, v2, 0
246          - description: Registers v1, v2 are not initialized, but they arent used.
247            values:
248            - i32 a0, i32 a1
249            - lda a0
250            - |
251              #
252                  ldai 0
253                  movi v0, 0
254            - v0, v1, v2, 0
255            runner-options: [verifier-only, verifier-debug-config]
256          - description: Accumulator is not initialized.
257            values:
258            - i32 a0, i32 a1
259            - lda a1
260            - |
261              #
262                  movi v0, 0
263                  movi v1, 0
264                  movi v2, 0
265            - v0, v1, v2, 1
266          - description: Accumulator is not initialized.
267            values:
268            - i32 a0, i32 a1, i32 a2
269            - lda a0
270            - |
271              #
272                  movi v0, 0
273                  movi v1, 0
274                  movi v2, 0
275            - v0, v1, v2, 0
276          - description: Accumulator is not initialized, but its not used.
277            values:
278            - i32 a0
279            - lda a0
280            - |
281              #
282                  movi v0, 0
283                  movi v1, 0
284                  movi v2, 0
285            - v0, v1, v2, 1
286            runner-options: [verifier-only, verifier-debug-config]
287          - description: Accumulator is not initialized, but its not used.
288            values:
289            - i32 a0, i32 a1, i32 a2
290            - lda a0
291            - |
292              #
293                  movi v0, 0
294                  movi v1, 0
295                  movi v2, 0
296            - v0, v1, v2, 3
297            runner-options: [verifier-only, verifier-debug-config]
298          - description: Accumulator and all regs are not initialized.
299            values:
300            - i32 a0, i32 a1, i32 a2, i32 a3
301            - ldai 0
302            -
303            - v15, v14, v13, 0
304          - description: Accumulator and all regs not initialized, but they are not used.
305            values:
306            -
307            - ldai 0
308            -
309            - v12, v11, v10, 2
310            runner-options: [verifier-only, verifier-debug-config]
311          - description: Accumulator is not initialized in function.
312            values:
313            - i32 a0, i32 a1, i32 a2
314            - call.acc foo, a0, a1, a2, 0
315            - |
316              #
317                  ldai 0
318                  movi v0, 0
319                  movi v1, 0
320                  movi v2, 0
321            - v0, v1, v2, 0
322
323
324      - file-name: not_static_method
325        description: Check that verifier reports an error on non-static method.
326        isa:
327          verification:
328            - method_id_static
329        header-template: []
330        runner-options: [verifier-failure, verifier-debug-config]
331        tags: [verifier]
332        check-type: exit-positive
333        code-template: |
334          .record R {}
335          .function void %s {
336              return.void
337          }
338          .function i32 main() {
339              newobj v0, R
340              movi v1, 0
341              movi v2, 0
342              ldai 0
343              call.acc %s
344        cases:
345          - values:
346            - R.foo(R a0, i32 a1, i32 a2, i32 a3)
347            - R.foo, v0, v1, v2, 1
348            bugid: ['5542']
349            ignore: true
350          - values:
351            - R.foo(R a0)
352            - R.foo, v0, v1, v2, 1
353            bugid: ['5542']
354            ignore: true
355          - values:
356            - R.foo(i32 a0, R a1, i32 a2, i32 a3)
357            - R.foo, v0, v1, v2, 0
358            runner-options: [verifier-only, verifier-debug-config]
359          - values:
360            - R.foo(R a0, i32 a1) <ctor>
361            - R.foo, v0, v1, v2, 1
362            bugid: ['5542']
363            ignore: true
364          - values:
365            - R.foo(R a0) <ctor>
366            - R.foo, v0, v0, v0, 1
367            bugid: ['5542']
368            ignore: true
369          - values:
370            - R.foo() <cctor>
371            - R.foo, v1, v1, v1, 1
372            runner-options: [verifier-only, verifier-debug-config]
373          - values:
374            - R.foo(R a0, i32 a1) <cctor>
375            - R.foo, v0, v1, v2, 2
376            runner-options: [verifier-only, verifier-debug-config]
377          - values:
378            - R.foo(R a0, i32 a1, i32 a2) <static>
379            - R.foo, v0, v1, v2, 3
380            runner-options: [verifier-only, verifier-debug-config]
381          - values:
382            - foo(R a0, i32 a1, i32 a2, i32 a3)
383            - foo, v0, v1, v2, 2
384            runner-options: [verifier-only, verifier-debug-config]
385
386
387      - file-name: abstract_method
388        description: Check that verifier reports an error on abstract method.
389        isa:
390          verification:
391            - method_id_non_abstract
392        header-template: []
393        runner-options: [verifier-failure, verifier-debug-config]
394        tags: [verifier]
395        check-type: exit-positive
396        bugid: ['5544']
397        ignore: true
398        code-template: |
399          .record R {}
400          .function void %s
401          .function i32 main() {
402              newobj v0, R
403              lda.obj v0
404              call.acc %s
405        cases:
406          - values:
407            - R.foo(R a0, R a1) <static, noimpl>
408            - R.foo, v0, v0, v0, 1
409          - values:
410            - foo(R a0, R a1) <noimpl>
411            - foo, v0, v0, v0, 0
412
413
414      - file-name: invalid_method
415        description: Check that verifier reports an error on invalid method.
416        isa:
417          verification:
418            - method_id_static
419            - method_id_non_abstract
420        header-template: []
421        runner-options: [verifier-failure, verifier-debug-config]
422        tags: [verifier]
423        check-type: exit-positive
424        code-template: |
425          .record R {}
426          %s
427          .function i32 main() {
428              newobj v0, R
429              lda.obj v0
430              call.acc %s
431        cases:
432          - description: No return in function.
433            values:
434            - .function void R.foo(R a0, R a1, R a2, R a3) <static> {}
435            - R.foo, v0, v0, v0, 1
436            bugid: ['5607']
437            ignore: true
438          - description: No return in function.
439            values:
440            - |
441              #
442              .function void foo(R a0, R a1) {
443                  ldai 0
444              }
445            - foo, v0, v0, v0, 0
446          - description: No return in cctor.
447            values:
448            - |
449              #
450              .function i32 R.foo(R a0) <cctor> {}
451            - R.foo, v0, v0, v0, 0
452            bugid: ['5607']
453            ignore: true
454
455
456      - file-name: incompatible_v_p
457        description: Check 'call.acc' instruction called with incompatible register arguments in PandaAssembly context.
458        isa:
459          verification:
460            - compatible_arguments
461        runner-options: [verifier-failure, verifier-debug-config]
462        tags: [verifier]
463        header-template: []
464        check-type: exit-positive
465        code-template: |
466          .record panda.Object <external>
467          .record panda.Class <external>
468          .record panda.String <external>
469          .record R {}
470          .function void R.foo(i32 a0, i32 a1, i32 a2, %s a3) {
471              return.void
472          }
473          .function i32 main() {
474              *s
475              movi v2, 2
476              movi v3, 3
477              ldai 0
478              call.acc R.foo, v3, v2, v1, 0
479        template-cases:
480          - values:
481            - u1
482            exclude: [i32]
483          - values:
484            - u8
485            exclude: [i32]
486          - values:
487            - i8
488            exclude: [i32]
489          - values:
490            - u16
491            exclude: [i32]
492          - values:
493            - i16
494            exclude: [i32]
495          - values:
496            - u32
497            exclude: [i32]
498          - values:
499            - u64
500            exclude: [i64]
501          - values:
502            - f32
503            exclude: [f64]
504          - values:
505            - u32[]
506            exclude: [u32a, nul]
507          - values:
508            - u64[]
509            exclude: [u64a, nul]
510          - values:
511            - f32[]
512            exclude: [f32a, nul]
513          - values:
514            - u32[][]
515            exclude: [u32aa, nul]
516          - values:
517            - u64[][]
518            exclude: [u64aa, nul]
519          - values:
520            - f32[][]
521            exclude: [f32aa, nul]
522          - values:
523            - R
524            exclude: [nul]
525          - values:
526            - panda.String
527            exclude: [str, nul]
528          - values:
529            - panda.Class
530            exclude: [typ, nul]
531          - values:
532            - panda.Object
533            exclude: [u32a, u64a, f32a, u32aa, u64aa, f32aa, str, typ, ra, stra, typa, obja, raa, straa, typaa, objaa, nul]
534          - values:
535            - R[]
536            exclude: [ra, nul]
537          - values:
538            - panda.String[]
539            exclude: [stra, nul]
540          - values:
541            - panda.Class[]
542            exclude: [typa, nul]
543          - values:
544            - panda.Object[]
545            exclude: [obja, u32aa, u64aa, f32aa, ra, stra, typa, raa, straa, typaa, objaa, nul]
546          - values:
547            - R[][]
548            exclude: [raa, nul]
549          - values:
550            - panda.String[][]
551            exclude: [straa, nul]
552          - values:
553            - panda.Class[][]
554            exclude: [typaa, nul]
555          - values:
556            - panda.Object[][]
557            exclude: [objaa, raa, straa, typaa, nul]
558        cases:
559          - values:
560            - movi v1, 1
561            id: i32
562          - values:
563            - movi.64 v1, 1
564            id: i64
565          - values:
566            - fmovi.64 v1, 1.0
567            id: f64
568          - values:
569            - |
570              #
571                  movi v1, 10
572                  newarr v1, v1, u32[]
573            id: u32a
574          - values:
575            - |
576              #
577                  movi v1, 10
578                  newarr v1, v1, u64[]
579            id: u64a
580          - values:
581            - |
582              #
583                  movi v1, 10
584                  newarr v1, v1, f32[]
585            id: f32a
586          - values:
587            - |
588              #
589                  movi v1, 10
590                  newarr v1, v1, u32[][]
591            id: u32aa
592          - values:
593            - |
594              #
595                  movi v1, 10
596                  newarr v1, v1, u64[][]
597            id: u64aa
598          - values:
599            - |
600              #
601                  movi v1, 10
602                  newarr v1, v1, f32[][]
603            id: f32aa
604          - values:
605            - |
606              #
607                  lda.str "test message"
608                  sta.obj v1
609            id: str
610          - values:
611            - |
612              #
613                  lda.type R
614                  sta.obj v1
615            id: typ
616          - values:
617            - |
618              #
619                  movi v1, 10
620                  newarr v1, v1, R[]
621            id: ra
622          - values:
623            - |
624              #
625                  movi v1, 10
626                  newarr v1, v1, panda.String[]
627            id: stra
628          - values:
629            - |
630              #
631                  movi v1, 10
632                  newarr v1, v1, panda.Class[]
633            id: typa
634          - values:
635            - |
636              #
637                  movi v1, 10
638                  newarr v1, v1, panda.Object[]
639            id: obja
640          - values:
641            - |
642              #
643                  movi v1, 10
644                  newarr v1, v1, R[][]
645            id: raa
646          - values:
647            - |
648              #
649                  movi v1, 10
650                  newarr v1, v1, panda.String[][]
651            id: straa
652          - values:
653            - |
654              #
655                  movi v1, 10
656                  newarr v1, v1, panda.Class[][]
657            id: typaa
658          - values:
659            - |
660              #
661                  movi v1, 10
662                  newarr v1, v1, panda.Object[][]
663            id: objaa
664          - values:
665            - mov.null v1
666            id: nul
667
668
669      - file-name: incompatible_acc_p
670        description: Check 'call.acc' instruction called with incompatible accumulator argument in PandaAssembly context.
671        isa:
672          verification:
673            - compatible_arguments
674        runner-options: [verifier-failure, verifier-debug-config]
675        tags: [verifier]
676        header-template: []
677        check-type: exit-positive
678        code-template: |
679          .record panda.Object <external>
680          .record panda.Class <external>
681          .record panda.String <external>
682          .record R {}
683          .function void R.foo(i32 a0, i32 a1, %s a2, i32 a3) {
684              return.void
685          }
686          .function i32 main() {
687              *s
688              movi v1, 0
689              call.acc R.foo, v1, v1, v1, 2
690        template-cases:
691          - values:
692            - u1
693            exclude: [i32]
694          - values:
695            - u8
696            exclude: [i32]
697          - values:
698            - i8
699            exclude: [i32]
700          - values:
701            - u16
702            exclude: [i32]
703          - values:
704            - i16
705            exclude: [i32]
706          - values:
707            - u32
708            exclude: [i32]
709          - values:
710            - u64
711            exclude: [i64]
712          - values:
713            - f32
714            exclude: [f64]
715          - values:
716            - u32[]
717            exclude: [u32a, nul]
718          - values:
719            - u64[]
720            exclude: [u64a, nul]
721          - values:
722            - f32[]
723            exclude: [f32a, nul]
724          - values:
725            - u32[][]
726            exclude: [u32aa, nul]
727          - values:
728            - u64[][]
729            exclude: [u64aa, nul]
730          - values:
731            - f32[][]
732            exclude: [f32aa, nul]
733          - values:
734            - R
735            exclude: [nul]
736          - values:
737            - panda.String
738            exclude: [str, nul]
739          - values:
740            - panda.Class
741            exclude: [typ, nul]
742          - values:
743            - panda.Object
744            exclude: [u32a, u64a, f32a, u32aa, u64aa, f32aa, str, typ, ra, stra, typa, obja, raa, straa, typaa, objaa, nul]
745          - values:
746            - R[]
747            exclude: [ra, nul]
748          - values:
749            - panda.String[]
750            exclude: [stra, nul]
751          - values:
752            - panda.Class[]
753            exclude: [typa, nul]
754          - values:
755            - panda.Object[]
756            exclude: [obja, u32aa, u64aa, f32aa, ra, stra, typa, raa, straa, typaa, objaa, nul]
757          - values:
758            - R[][]
759            exclude: [raa, nul]
760          - values:
761            - panda.String[][]
762            exclude: [straa, nul]
763          - values:
764            - panda.Class[][]
765            exclude: [typaa, nul]
766          - values:
767            - panda.Object[][]
768            exclude: [objaa, raa, straa, typaa, nul]
769        cases:
770          - values:
771            - ldai 1
772            id: i32
773          - values:
774            - ldai.64 1
775            id: i64
776          - values:
777            - fldai.64 1.0
778            id: f64
779          - values:
780            - |
781              #
782                  movi v1, 10
783                  newarr v1, v1, u32[]
784                  lda.obj v1
785            id: u32a
786          - values:
787            - |
788              #
789                  movi v1, 10
790                  newarr v1, v1, u64[]
791                  lda.obj v1
792            id: u64a
793          - values:
794            - |
795              #
796                  movi v1, 10
797                  newarr v1, v1, f32[]
798                  lda.obj v1
799            id: f32a
800          - values:
801            - |
802              #
803                  movi v1, 10
804                  newarr v1, v1, u32[][]
805                  lda.obj v1
806            id: u32aa
807          - values:
808            - |
809              #
810                  movi v1, 10
811                  newarr v1, v1, u64[][]
812                  lda.obj v1
813            id: u64aa
814          - values:
815            - |
816              #
817                  movi v1, 10
818                  newarr v1, v1, f32[][]
819                  lda.obj v1
820            id: f32aa
821          - values:
822            - |
823              #
824                  lda.str "test message"
825            id: str
826          - values:
827            - |
828              #
829                  lda.type R
830            id: typ
831          - values:
832            - |
833              #
834                  movi v1, 10
835                  newarr v1, v1, R[]
836                  lda.obj v1
837            id: ra
838          - values:
839            - |
840              #
841                  movi v1, 10
842                  newarr v1, v1, panda.String[]
843                  lda.obj v1
844            id: stra
845          - values:
846            - |
847              #
848                  movi v1, 10
849                  newarr v1, v1, panda.Class[]
850                  lda.obj v1
851            id: typa
852          - values:
853            - |
854              #
855                  movi v1, 10
856                  newarr v1, v1, panda.Object[]
857                  lda.obj v1
858            id: obja
859          - values:
860            - |
861              #
862                  movi v1, 10
863                  newarr v1, v1, R[][]
864                  lda.obj v1
865            id: raa
866          - values:
867            - |
868              #
869                  movi v1, 10
870                  newarr v1, v1, panda.String[][]
871                  lda.obj v1
872            id: straa
873          - values:
874            - |
875              #
876                  movi v1, 10
877                  newarr v1, v1, panda.Class[][]
878                  lda.obj v1
879            id: typaa
880          - values:
881            - |
882              #
883                  movi v1, 10
884                  newarr v1, v1, panda.Object[][]
885                  lda.obj v1
886            id: objaa
887          - values:
888            - lda.null
889            id: nul
890
891
892      - file-name: incompatible_v_j
893        isa:
894          verification:
895            - compatible_arguments
896        runner-options: [verifier-failure, use-java, verifier-debug-config]
897        tags: [verifier]
898        description: Check 'call.acc' instruction with incompatible register in Java context.
899        header-template: [java]
900        code-template: |
901          .record java.lang.Object <external>
902          .record java.lang.Class <external>
903          .record R {}
904          .function void R.foo(R a0, %s a1, i32 a2, R a3) <static> {
905              return.void
906          }
907          .function i32 main() {
908              *s
909              ldai 0
910              newobj v2, R
911              newobj v3, R
912              call.acc R.foo, v2, v1, v3, 2
913        check-type: exit-positive
914        template-cases:
915          - values:
916            - u1
917            exclude: [i32]
918          - values:
919            - i8
920            exclude: [i32]
921          - values:
922            - u16
923            exclude: [i32]
924          - values:
925            - i16
926            exclude: [i32]
927          - values:
928            - i32
929            exclude: [i32]
930          - values:
931            - i64
932            exclude: [i64]
933          - values:
934            - f32
935            exclude: [f64]
936          - values:
937            - f64
938            exclude: [f64]
939          - values:
940            - u1[]
941            exclude: [u1a, nul]
942          - values:
943            - i8[]
944            exclude: [i8a, nul]
945          - values:
946            - u16[]
947            exclude: [u1a, u16a, nul]
948          - values:
949            - i16[]
950            exclude: [i8a, i16a, nul]
951          - values:
952            - i32[]
953            exclude: [i8a, i16a, i32a, nul]
954          - values:
955            - i64[]
956            exclude: [i64a, nul]
957          - values:
958            - f32[]
959            exclude: [f32a, nul]
960          - values:
961            - f64[]
962            exclude: [f32a, f64a, nul]
963          - values:
964            - i32[][]
965            exclude: [i32aa, nul]
966          - values:
967            - f64[][]
968            exclude: [f64aa, nul]
969          - values:
970            - R
971            exclude: [nul]
972          - values:
973            - java.lang.Class
974            exclude: [typ, nul]
975          - values:
976            - java.lang.Object
977            exclude: [u1a, i8a, u16a, i16a, i32a, i64a, f32a, f64a, i32aa, f64aa, typ, ra, typa, obja, raa, typaa, objaa, nul]
978          - values:
979            - R[]
980            exclude: [ra, nul]
981          - values:
982            - java.lang.Class[]
983            exclude: [typa, nul]
984          - values:
985            - java.lang.Object[]
986            exclude: [obja, i32aa, f64aa, ra, typa, raa, typaa, objaa, nul]
987          - values:
988            - R[][]
989            exclude: [raa, nul]
990          - values:
991            - java.lang.Class[][]
992            exclude: [typaa, nul]
993          - values:
994            - java.lang.Object[][]
995            exclude: [objaa, raa, typaa, nul]
996        cases:
997          - values:
998            - movi v1, 1
999            id: i32
1000          - values:
1001            - movi.64 v1, 1
1002            id: i64
1003          - values:
1004            - fmovi.64 v1, 1.0
1005            id: f64
1006          - values:
1007            - |
1008              #
1009                  movi v1, 10
1010                  newarr v1, v1, u1[]
1011            id: u1a
1012          - values:
1013            - |
1014              #
1015                  movi v1, 10
1016                  newarr v1, v1, i8[]
1017            id: i8a
1018          - values:
1019            - |
1020              #
1021                  movi v1, 10
1022                  newarr v1, v1, u16[]
1023            id: u16a
1024          - values:
1025            - |
1026              #
1027                  movi v1, 10
1028                  newarr v1, v1, i16[]
1029            id: i16a
1030          - values:
1031            - |
1032              #
1033                  movi v1, 10
1034                  newarr v1, v1, i32[]
1035            id: i32a
1036          - values:
1037            - |
1038              #
1039                  movi v1, 10
1040                  newarr v1, v1, i64[]
1041            id: i64a
1042          - values:
1043            - |
1044              #
1045                  movi v1, 10
1046                  newarr v1, v1, f32[]
1047            id: f32a
1048          - values:
1049            - |
1050              #
1051                  movi v1, 10
1052                  newarr v1, v1, f64[]
1053            id: f64a
1054          - values:
1055            - |
1056              #
1057                  movi v1, 10
1058                  newarr v1, v1, i32[][]
1059            id: i32aa
1060          - values:
1061            - |
1062              #
1063                  movi v1, 10
1064                  newarr v1, v1, f64[][]
1065            id: f64aa
1066          - values:
1067            - |
1068              #
1069                  lda.type R
1070                  sta.obj v1
1071            id: typ
1072          - values:
1073            - |
1074              #
1075                  movi v1, 10
1076                  newarr v1, v1, R[]
1077            id: ra
1078          - values:
1079            - |
1080              #
1081                  movi v1, 10
1082                  newarr v1, v1, java.lang.Class[]
1083            id: typa
1084          - values:
1085            - |
1086              #
1087                  movi v1, 10
1088                  newarr v1, v1, java.lang.Object[]
1089            id: obja
1090          - values:
1091            - |
1092              #
1093                  movi v1, 10
1094                  newarr v1, v1, R[][]
1095            id: raa
1096          - values:
1097            - |
1098              #
1099                  movi v1, 10
1100                  newarr v1, v1, java.lang.Class[][]
1101            id: typaa
1102          - values:
1103            - |
1104              #
1105                  movi v1, 10
1106                  newarr v1, v1, java.lang.Object[][]
1107            id: objaa
1108          - values:
1109            - mov.null v1
1110            id: nul
1111
1112
1113      - file-name: incompatible_acc_j
1114        isa:
1115          verification:
1116            - compatible_arguments
1117        runner-options: [verifier-failure, use-java, verifier-debug-config]
1118        tags: [verifier]
1119        description: Check 'call.acc' instruction with incompatible accumulator in Java context.
1120        header-template: [java]
1121        check-type: exit-positive
1122        code-template: |
1123          .record java.lang.Object <external>
1124          .record java.lang.Class <external>
1125          .record R {}
1126          .function void R.foo(%s a0, i32 a1, i32 a2, R a3) <static> {
1127              return.void
1128          }
1129          .function i32 main() {
1130              *s
1131              movi v1, 0
1132              newobj v2, R
1133              call.acc R.foo, v1, v1, v2, 0
1134        template-cases:
1135          - values:
1136            - u1
1137            exclude: [i32]
1138          - values:
1139            - i8
1140            exclude: [i32]
1141          - values:
1142            - u16
1143            exclude: [i32]
1144          - values:
1145            - i16
1146            exclude: [i32]
1147          - values:
1148            - i32
1149            exclude: [i32]
1150          - values:
1151            - i64
1152            exclude: [i64]
1153          - values:
1154            - f32
1155            exclude: [f64]
1156          - values:
1157            - f64
1158            exclude: [f64]
1159          - values:
1160            - u1[]
1161            exclude: [u1a, nul]
1162          - values:
1163            - i8[]
1164            exclude: [i8a, nul]
1165          - values:
1166            - u16[]
1167            exclude: [u1a, u16a, nul]
1168          - values:
1169            - i16[]
1170            exclude: [i8a, i16a, nul]
1171          - values:
1172            - i32[]
1173            exclude: [i8a, i16a, i32a, nul]
1174          - values:
1175            - i64[]
1176            exclude: [i64a, nul]
1177          - values:
1178            - f32[]
1179            exclude: [f32a, nul]
1180          - values:
1181            - f64[]
1182            exclude: [f32a, f64a, nul]
1183          - values:
1184            - i32[][]
1185            exclude: [i32aa, nul]
1186          - values:
1187            - f64[][]
1188            exclude: [f64aa, nul]
1189          - values:
1190            - R
1191            exclude: [nul]
1192          - values:
1193            - java.lang.Class
1194            exclude: [typ, nul]
1195          - values:
1196            - java.lang.Object
1197            exclude: [u1a, i8a, u16a, i16a, i32a, i64a, f32a, f64a, i32aa, f64aa, typ, ra, typa, obja, raa, typaa, objaa, nul]
1198          - values:
1199            - R[]
1200            exclude: [ra, nul]
1201          - values:
1202            - java.lang.Class[]
1203            exclude: [typa, nul]
1204          - values:
1205            - java.lang.Object[]
1206            exclude: [obja, i32aa, f64aa, ra, typa, raa, typaa, objaa, nul]
1207          - values:
1208            - R[][]
1209            exclude: [raa, nul]
1210          - values:
1211            - java.lang.Class[][]
1212            exclude: [typaa, nul]
1213          - values:
1214            - java.lang.Object[][]
1215            exclude: [objaa, raa, typaa, nul]
1216        cases:
1217          - values:
1218            - ldai 1
1219            id: i32
1220          - values:
1221            - ldai.64 1
1222            id: i64
1223          - values:
1224            - fldai.64 1.0
1225            id: f64
1226          - values:
1227            - |
1228              #
1229                  movi v1, 10
1230                  newarr v1, v1, u1[]
1231                  lda.obj v1
1232            id: u1a
1233          - values:
1234            - |
1235              #
1236                  movi v1, 10
1237                  newarr v1, v1, i8[]
1238                  lda.obj v1
1239            id: i8a
1240          - values:
1241            - |
1242              #
1243                  movi v1, 10
1244                  newarr v1, v1, u16[]
1245                  lda.obj v1
1246            id: u16a
1247          - values:
1248            - |
1249              #
1250                  movi v1, 10
1251                  newarr v1, v1, i16[]
1252                  lda.obj v1
1253            id: i16a
1254          - values:
1255            - |
1256              #
1257                  movi v1, 10
1258                  newarr v1, v1, i32[]
1259                  lda.obj v1
1260            id: i32a
1261          - values:
1262            - |
1263              #
1264                  movi v1, 10
1265                  newarr v1, v1, i64[]
1266                  lda.obj v1
1267            id: i64a
1268          - values:
1269            - |
1270              #
1271                  movi v1, 10
1272                  newarr v1, v1, f32[]
1273                  lda.obj v1
1274            id: f32a
1275          - values:
1276            - |
1277              #
1278                  movi v1, 10
1279                  newarr v1, v1, f64[]
1280                  lda.obj v1
1281            id: f64a
1282          - values:
1283            - |
1284              #
1285                  movi v1, 10
1286                  newarr v1, v1, i32[][]
1287                  lda.obj v1
1288            id: i32aa
1289          - values:
1290            - |
1291              #
1292                  movi v1, 10
1293                  newarr v1, v1, f64[][]
1294                  lda.obj v1
1295            id: f64aa
1296          - values:
1297            - |
1298              #
1299                  lda.type R
1300            id: typ
1301          - values:
1302            - |
1303              #
1304                  movi v1, 10
1305                  newarr v1, v1, R[]
1306                  lda.obj v1
1307            id: ra
1308          - values:
1309            - |
1310              #
1311                  movi v1, 10
1312                  newarr v1, v1, java.lang.Class[]
1313                  lda.obj v1
1314            id: typa
1315          - values:
1316            - |
1317              #
1318                  movi v1, 10
1319                  newarr v1, v1, java.lang.Object[]
1320                  lda.obj v1
1321            id: obja
1322          - values:
1323            - |
1324              #
1325                  movi v1, 10
1326                  newarr v1, v1, R[][]
1327                  lda.obj v1
1328            id: raa
1329          - values:
1330            - |
1331              #
1332                  movi v1, 10
1333                  newarr v1, v1, java.lang.Class[][]
1334                  lda.obj v1
1335            id: typaa
1336          - values:
1337            - |
1338              #
1339                  movi v1, 10
1340                  newarr v1, v1, java.lang.Object[][]
1341                  lda.obj v1
1342            id: objaa
1343          - values:
1344            - lda.null
1345            id: nul
1346
1347
1348      - file-name: compatible_primitive_args_p
1349        isa:
1350          verification:
1351            - compatible_arguments
1352        runner-options: [verifier-only, verifier-debug-config]
1353        tags: [verifier]
1354        description: Check 'call.acc' instruction with compatible primitive arguments in PandaAssembly context.
1355        header-template: []
1356        check-type: exit-positive
1357        code-template: |
1358          .record R {}
1359          .function void R.foo(%s) <static> {
1360              return.void
1361          }
1362          .function i32 main() {
1363              %s
1364              call.acc R.foo, v1, v2, v3, 0
1365        cases:
1366          - values:
1367            - u1 a0, u8 a1, i8 a2, u16 a3
1368            - |
1369              #
1370                  ldai 1
1371                  movi v1, 1
1372                  movi v2, 1
1373                  movi v3, 1
1374          - values:
1375            - i16 a0, u32 a1, i64 a2, i32 a3
1376            - |
1377              #
1378                  ldai 1
1379                  movi v1, 1
1380                  movi.64 v2, 1
1381                  movi v3, 1
1382          - values:
1383            - u64 a0, f32 a1, f64 a2, i64 a3
1384            - |
1385              #
1386                  ldai.64 1
1387                  fmovi.64 v1, 1.1
1388                  fmovi.64 v2, 1.1
1389                  movi.64 v3, 1
1390
1391
1392      - file-name: compatible_primitive_args_j
1393        isa:
1394          verification:
1395            - compatible_arguments
1396        runner-options: [verifier-only, use-java, verifier-debug-config]
1397        tags: [verifier]
1398        description: Check 'call.acc' instruction with compatible primitive arguments in Java context.
1399        header-template: [java]
1400        code-template: |
1401          .record R {}
1402          .function void R.foo(%s) <static> {
1403              return.void
1404          }
1405          .function i32 main() {
1406              %s
1407              call.acc R.foo, v1, v2, v3, 3
1408        check-type: exit-positive
1409        cases:
1410          - values:
1411            - u1 a0, f64 a1, u16 a2, i16 a3
1412            - |
1413              #
1414                  movi v1, 1
1415                  fmovi.64 v2, 1.1
1416                  movi v3, 1
1417                  ldai 1
1418          - values:
1419            - i32 a0, i64 a1, f32 a2, i8 a3
1420            - |
1421              #
1422                  movi v1, 1
1423                  movi.64 v2, 1
1424                  fmovi.64 v3, 1.1
1425                  ldai 1
1426
1427
1428      - file-name: compatible_prim_array_args_p
1429        isa:
1430          verification:
1431            - compatible_arguments
1432        runner-options: [verifier-only, verifier-debug-config]
1433        tags: [verifier]
1434        description: Check 'call.acc' instruction called with compatible primitive array arguments in PandaAssembly context.
1435        header-template: []
1436        code-template: |
1437          .function void foo(%s) {
1438              return.void
1439          }
1440          .function i32 main() {
1441              movi v0, 10
1442              newarr v1, v0, %s[]
1443              newarr v2, v0, %s[]
1444              newarr v3, v0, %s[]
1445              newarr v4, v0, %s[]
1446              lda.obj v4
1447              call.acc foo, v1, v2, v3, 3
1448        check-type: exit-positive
1449        cases:
1450          - values:
1451            - u1[] a0, u8[] a1, i8[] a2, u16[] a3
1452            - u1
1453            - u8
1454            - i8
1455            - u16
1456          - values:
1457            - i16[] a0, u32[] a1, f32[][] a2, u64[] a3
1458            - i16
1459            - u32
1460            - f32[]
1461            - u64
1462          - values:
1463            - i64[] a0, f32[] a1, f64[] a2, u1[][] a3
1464            - i64
1465            - f32
1466            - f64
1467            - u1[]
1468          - values:
1469            - u8[][] a0, i8[][] a1, u16[][] a2, i16[][] a3
1470            - u8[]
1471            - i8[]
1472            - u16[]
1473            - i16[]
1474          - values:
1475            - u32[][] a0, i32[][] a1, u64[][] a2, i64[][] a3
1476            - u32[]
1477            - i32[]
1478            - u64[]
1479            - i64[]
1480          - values:
1481            - i32[] a0, f64[][] a1
1482            - i32
1483            - f64[]
1484            - f64[][]
1485            - f64[][][]
1486
1487
1488      - file-name: compatible_prim_array_args_j
1489        isa:
1490          verification:
1491            - compatible_arguments
1492        runner-options: [verifier-only, use-java]
1493        tags: [verifier]
1494        description: Check 'call.acc' instruction called with compatible primitive array arguments in Java context.
1495        header-template: [java]
1496        code-template: |
1497          .function void foo(%s) {
1498              return.void
1499          }
1500          .function i32 main() {
1501              movi v0, 10
1502              newarr v1, v0, %s[]
1503              newarr v2, v0, %s[]
1504              newarr v3, v0, %s[]
1505              lda.obj v3
1506              newarr v4, v0, %s[]
1507              call.acc foo, v1, v2, v4, 2
1508        check-type: exit-positive
1509        cases:
1510          - values:
1511            - u1[] a0, f64[][] a1, u16[] a2, i16[] a3
1512            - u1
1513            - f64[]
1514            - u16
1515            - i16
1516          - values:
1517            - i32[] a0, i64[] a1, f32[] a2, f64[] a3
1518            - i32
1519            - i64
1520            - f32
1521            - f64
1522          - values:
1523            - u1[][] a0, i8[][] a1, u16[][] a2, i16[][] a3
1524            - u1[]
1525            - i8[]
1526            - u16[]
1527            - i16[]
1528          - values:
1529            - i32[][] a0, i64[][] a1, f32[][] a2, i8[] a3
1530            - i32[]
1531            - i64[]
1532            - f32[]
1533            - i8
1534
1535
1536      - file-name: compatible_obj_args_p
1537        isa:
1538          verification:
1539            - compatible_arguments
1540        runner-options: [verifier-only, verifier-debug-config]
1541        tags: [verifier]
1542        description: Check 'call.acc' instruction called with compatible object arguments in PandaAssembly context.
1543        header-template: []
1544        check-type: exit-positive
1545        code-template: |
1546          .record panda.Object <external>
1547          .record panda.Class <external>
1548          .record panda.String <external>
1549          .record Q {}
1550          .record R {}
1551          .function void foo(%s) {
1552              return.void
1553          }
1554          .function i32 main() {
1555              %s
1556              call.acc foo, v1, v2, v3, 3
1557        cases:
1558          # Object of type O is instance of type T if O is the same as T ...
1559          - values:
1560            - Q a0, R a1, panda.Class a2, panda.String a3
1561            - |
1562              #
1563                  newobj v1, Q
1564                  newobj v2, R
1565                  lda.type Q
1566                  sta.obj v3
1567                  lda.str "test"
1568          # ... or is subtype of T
1569          - values:
1570            - panda.Object a0, panda.Object a1, panda.Object a2, panda.Object a3
1571            - |
1572              #
1573                  newobj v1, Q
1574                  lda.str "test"
1575                  sta.obj v2
1576                  lda.type Q
1577                  sta.obj v3
1578                  newobj v4, R
1579                  lda.obj v4
1580            bugid: ['3594']
1581            ignore: true
1582          # For arrays T should be a root type in type hierarchy ...
1583          - values:
1584            - panda.Object a0, panda.Object a1, panda.Object a2, panda.Object a3
1585            - |
1586              #
1587                  movi v0, 10
1588                  newarr v1, v0, i32[]
1589                  newarr v2, v0, f64[][]
1590                  newarr v3, v0, Q[]
1591                  newarr v4, v0, panda.Object[]
1592                  lda.obj v4
1593          - values:
1594            - panda.Object a0, panda.Object a1, panda.Object a2, panda.Object a3
1595            - |
1596              #
1597                  movi v0, 10
1598                  newarr v1, v0, panda.String[]
1599                  newarr v2, v0, panda.Class[]
1600                  newarr v3, v0, Q[][]
1601                  newarr v4, v0, R[]
1602                  lda.obj v4
1603
1604
1605      - file-name: compatible_obj_args_j
1606        isa:
1607          verification:
1608            - compatible_arguments
1609        runner-options: [verifier-only, use-java, verifier-debug-config]
1610        tags: [verifier]
1611        description: Check 'call.acc' instruction called with compatible object arguments in Java context.
1612        header-template: [java]
1613        check-type: exit-positive
1614        code-template: |
1615          .record java.lang.Object <external>
1616          .record java.lang.Class <external>
1617          .record java.lang.String <external>
1618          .record java.io.Serializable <external>
1619          .record I <java.interface> {}
1620          .record E {}
1621          .record Q <java.extends=E, java.implements=I> {}
1622          .record R {}
1623          .function void foo(%s) {
1624              return.void
1625          }
1626          .function i32 main() {
1627              %s
1628              call.acc foo, v1, v2, v3, 0
1629        cases:
1630          # Object of type O is instance of type T if O is the same as T ...
1631          - values:
1632            - Q a0, java.lang.String a1, java.lang.Class a2, E a3
1633            - |
1634              #
1635                  newobj v0, Q
1636                  lda.str "test"
1637                  sta.obj v1
1638                  lda.type Q
1639                  sta.obj v2
1640                  newobj v3, E
1641                  lda.obj v0
1642          # ... or is subtype of T
1643          - values:
1644            - E a0, I a1, java.lang.Object a2, java.lang.Object a3
1645            - |
1646              #
1647                  newobj v0, Q
1648                  newobj v1, Q
1649                  newobj v2, Q
1650                  lda.str "test"
1651                  sta.obj v3
1652                  lda.obj v0
1653          - values:
1654            - java.io.Serializable a0, java.lang.Object a1, java.lang.Object a2
1655            - |
1656              #
1657                  lda.type Q
1658                  sta.obj v1
1659                  newobj v2, R
1660                  lda.type java.lang.String
1661            bugid: ['3594']
1662            ignore: true
1663          # For arrays T should be a root type in type hierarchy ...
1664          - values:
1665            - java.lang.Object a0, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3
1666            - |
1667              #
1668                  movi v0, 10
1669                  newarr v1, v0, i32[]
1670                  newarr v2, v0, f64[][]
1671                  newarr v3, v0, Q[]
1672                  newarr v4, v0, java.lang.Object[]
1673                  lda.obj v4
1674          - values:
1675            - java.lang.Object a0, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3
1676            - |
1677              #
1678                  movi v0, 10
1679                  newarr v1, v0, java.lang.String[]
1680                  newarr v2, v0, java.lang.Class[]
1681                  newarr v3, v0, I[]
1682                  newarr v4, v0, java.lang.Object[][]
1683                  lda.obj v4
1684
1685
1686      - file-name: compatible_obj_array_args_p
1687        isa:
1688          verification:
1689            - compatible_arguments
1690        runner-options: [verifier-only, verifier-debug-config]
1691        tags: [verifier]
1692        description: Check 'call.acc' instruction called with compatible object array arguments in PandaAssembly context.
1693        header-template: []
1694        check-type: exit-positive
1695        code-template: |
1696          .record panda.Object <external>
1697          .record panda.Class <external>
1698          .record panda.String <external>
1699          .record Q {}
1700          .record R {}
1701          .function void foo(%s) {
1702              return.void
1703          }
1704          .function i32 main() {
1705              movi v0, 10
1706              newarr v1, v0, %s
1707              newarr v2, v0, %s
1708              newarr v3, v0, %s
1709              newarr v4, v0, %s
1710              lda.obj v4
1711              call.acc foo, v1, v2, v3, 3
1712        cases:
1713          # T is such array that O array elements are the same as T array elements
1714          - values:
1715            - Q[] a0, Q[][] a1, panda.Object[] a2, panda.Object[][] a3
1716            - Q[]
1717            - Q[][]
1718            - panda.Object[]
1719            - panda.Object[][]
1720          - values:
1721            - panda.String[] a0, panda.String[][] a1, panda.Class[] a2, panda.Class[][] a3
1722            - panda.String[]
1723            - panda.String[][]
1724            - panda.Class[]
1725            - panda.Class[][]
1726          # T is such array that O array elements are subtypes of T array elements
1727          - values:
1728            - panda.Object[] a0, panda.Object[] a1, panda.Object[] a2, panda.Object[] a3
1729            - panda.Object[][]
1730            - Q[]
1731            - Q[][]
1732            - panda.Class[]
1733          - values:
1734            - panda.Object[] a0, panda.Object[] a1, panda.Object[] a2, panda.Object[] a3
1735            - panda.Class[][]
1736            - panda.String[]
1737            - panda.String[][]
1738            - i32[][]
1739          - values:
1740            - panda.Object[] a0, panda.Object[][] a1, panda.Object[][] a2, panda.Object[][] a3
1741            - f64[][][]
1742            - panda.Object[][][]
1743            - panda.Class[][]
1744            - panda.Class[][][]
1745          - values:
1746            - panda.Object[][] a0, panda.Object[][] a1
1747            - i32[][][]
1748            - f64[][][][]
1749            - i32[][][]
1750            - f64[][][][]
1751
1752
1753      - file-name: compatible_obj_array_args_j
1754        isa:
1755          verification:
1756            - compatible_arguments
1757        runner-options: [verifier-only, use-java, verifier-debug-config]
1758        tags: [verifier]
1759        description: Check 'call.acc' instruction called with compatible object array arguments in Java context.
1760        header-template: [java]
1761        code-template: |
1762          .record java.lang.Object <external>
1763          .record java.lang.Class <external>
1764          .record java.lang.String <external>
1765          .record I <java.interface> {}
1766          .record E {}
1767          .record Q <java.extends=E, java.implements=I> {}
1768          .record R {}
1769          .function void foo(%s) {
1770              return.void
1771          }
1772          .function i32 main() {
1773              movi v0, 10
1774              newarr v1, v0, %s
1775              newarr v2, v0, %s
1776              newarr v3, v0, %s
1777              newarr v4, v0, %s
1778              lda.obj v2
1779              call.acc foo, v1, v3, v4, 1
1780        check-type: exit-positive
1781        cases:
1782          # T is such array that O array elements are the same as T array elements
1783          - values:
1784            - Q[] a0, java.lang.String[] a1, Q[][] a2, java.lang.String[][] a3
1785            - Q[]
1786            - java.lang.String[]
1787            - Q[][]
1788            - java.lang.String[][]
1789          - values:
1790            - java.lang.Object[] a0, java.lang.Class[][] a1, java.lang.Class[] a2, java.lang.Object[][] a3
1791            - java.lang.Object[]
1792            - java.lang.Class[][]
1793            - java.lang.Class[]
1794            - java.lang.Object[][]
1795          # T is such array that O array elements are subtypes of T array elements
1796          - values:
1797            - E[] a0, java.lang.Object[] a1, I[] a2, java.lang.Object[] a3
1798            - Q[]
1799            - Q[][]
1800            - Q[]
1801            - java.lang.Class[]
1802          - values:
1803            - java.lang.Object[] a0, java.lang.Object[] a1, java.lang.Object[] a2, java.lang.Object[] a3
1804            - java.lang.Object[][]
1805            - Q[]
1806            - java.lang.String[]
1807            - f64[][][]
1808          - values:
1809            - java.lang.Object[] a0, java.lang.Object[] a1, java.lang.Object[] a2, java.lang.Object[] a3
1810            - java.lang.String[][]
1811            - i32[][]
1812            - I[][]
1813            - u16[][]
1814          # inherited types from object[][]
1815          - values:
1816            - E[][] a0, java.lang.Object[][] a1, I[][] a2, java.lang.Object[][] a3
1817            - Q[][]
1818            - java.lang.Object[][][]
1819            - Q[][]
1820            - java.lang.Class[][][]
1821          - values:
1822            - java.lang.Object[][] a0, java.lang.Object[][] a1
1823            - java.lang.Class[][]
1824            - i32[][][]
1825            - u1[]
1826            - u1[][]
1827
1828
1829      - file-name: compatible_obj_null_args_p
1830        isa:
1831          verification:
1832            - compatible_arguments
1833        runner-options: [verifier-only, verifier-debug-config]
1834        tags: [verifier]
1835        description: Check 'call.acc' instruction called with null object ref in PandaAssembly context.
1836        header-template: []
1837        check-type: exit-positive
1838        code-template: |
1839          .record panda.Object <external>
1840          .record panda.Class <external>
1841          .record panda.String <external>
1842          .record Q {}
1843          .function void foo(%s) {
1844              return.void
1845          }
1846          .function i32 main() {
1847              mov.null v1
1848              mov.null v2
1849              mov.null v3
1850              lda.null
1851              call.acc foo, v1, v2, v3, 0
1852        cases:
1853          - values: ['i32[] a0, f64[][] a1, panda.Object a2, panda.Object[] a3']
1854          - values: ['panda.Object[][] a0, Q a1, Q[][] a2, panda.String a3']
1855          - values: ['panda.String[] a0, panda.Class a1, panda.Class[] a2, u32[][][] a3']
1856
1857
1858      - file-name: compatible_obj_null_args_j
1859        isa:
1860          verification:
1861            - compatible_arguments
1862        runner-options: [verifier-only, use-java, verifier-debug-config]
1863        tags: [verifier]
1864        description: Check 'call.acc' instruction called with null object ref in Java context.
1865        header-template: [java]
1866        code-template: |
1867          .record java.lang.Object <external>
1868          .record java.lang.Class <external>
1869          .record java.lang.String <external>
1870          .record Q {}
1871          .function void foo(%s) {
1872              return.void
1873          }
1874          .function i32 main() {
1875              mov.null v1
1876              mov.null v2
1877              mov.null v3
1878              lda.null
1879              call.acc foo, v1, v2, v3, 1
1880        check-type: exit-positive
1881        cases:
1882          - values: ['i32[] a0, f64[][] a1, java.lang.Object a2, java.lang.Object[] a3']
1883          - values: ['java.lang.Object[][] a0, Q a1, Q[][] a2, java.lang.String a3']
1884          - values: ['java.lang.String[] a0, java.lang.Class a1, java.lang.Class[] a2, u1[][][] a3']
1885
1886
1887      - file-name: values_signed
1888        isa:
1889          instructions:
1890            - sig: call.acc method_id, v1:in:top, v2:in:top, v3:in:top, imm:u2
1891              acc: inout:top
1892              format: [op_v1_4_v2_4_v3_4_imm_4_id_16]
1893        runner-options: []
1894        description: Check 'call.acc' instruction called with integer values.
1895        header-template: []
1896        check-type: empty
1897        code-template: |
1898          .function i32 foo(i32 a0, i64 a1, i32 a2, i64 a3) {
1899              ldai %s
1900              jeq a0, ok1
1901              ldai 1
1902              return
1903          ok1:
1904              ldai.64 %s
1905              cmp.64 a1
1906              jeqz ok2
1907              ldai 2
1908              return
1909          ok2:
1910              ldai %s
1911              jeq a2, ok3
1912              ldai 3
1913              return
1914          ok3:
1915              ldai.64 %s
1916              cmp.64 a3
1917              return
1918          }
1919          .function i32 main() {
1920              movi v0, %s
1921              movi.64 v1, %s
1922              movi v2, %s
1923              movi.64 v3, %s
1924              lda v0
1925              call.acc foo, v1, v2, v3, 0
1926              return
1927          }
1928        cases:
1929          - values: [0, -1, 0x5a5a5a5a, 0xa5a5a5a5cafebabe, 0, -1, 0x5a5a5a5a, 0xa5a5a5a5cafebabe]
1930          - values: [0x11111111, 0xe1e1e1e1e1e1e1e1, 0x7ffffffe, 0x8000000000000001, 0x11111111, 0xe1e1e1e1e1e1e1e1, 0x7ffffffe, 0x8000000000000001]
1931
1932
1933      - file-name: values_unsigned
1934        isa:
1935          instructions:
1936            - sig: call.acc method_id, v1:in:top, v2:in:top, v3:in:top, imm:u2
1937              acc: inout:top
1938              format: [op_v1_4_v2_4_v3_4_imm_4_id_16]
1939        runner-options: []
1940        description: Check 'call.acc' instruction called with unsigned values.
1941        header-template: []
1942        check-type: empty
1943        code-template: |
1944          .function i32 foo(u32 a0, u64 a1, u32 a2, u64 a3) {
1945              ldai %s
1946              ucmp a0
1947              jeqz ok1
1948              ldai 1
1949              return
1950          ok1:
1951              ldai.64 %s
1952              ucmp.64 a1
1953              jeqz ok2
1954              ldai 2
1955              return
1956          ok2:
1957              ldai %s
1958              ucmp a2
1959              jeqz ok3
1960              ldai 3
1961              return
1962          ok3:
1963              ldai.64 %s
1964              ucmp.64 a3
1965              return
1966          }
1967          .function i32 main() {
1968              movi v0, %s
1969              movi.64 v1, %s
1970              movi v2, %s
1971              movi.64 v3, %s
1972              lda.64 v3
1973              call.acc foo, v0, v1, v2, 3
1974              return
1975          }
1976        cases:
1977          - values: [123456789, 0, 0xffffffff, 0xefffffffffffffff, 123456789, 0, 0xffffffff, 0xefffffffffffffff]
1978          - values: [0x1111eeee, 0xeeee1111ffffdddd, 0x5a5a5a5a, 0xa5a5a5a5a5a5a5a5, 0x1111eeee, 0xeeee1111ffffdddd, 0x5a5a5a5a, 0xa5a5a5a5a5a5a5a5]
1979
1980
1981      - file-name: values_float
1982        isa:
1983          instructions:
1984            - sig: call.acc method_id, v1:in:top, v2:in:top, v3:in:top, imm:u2
1985              acc: inout:top
1986              format: [op_v1_4_v2_4_v3_4_imm_4_id_16]
1987        runner-options: []
1988        description: Check 'call.acc' instruction called with float values.
1989        header-template: []
1990        check-type: empty
1991        code-template: |
1992          .function i32 foo(f32 a0, f64 a1, f32 a2, f64 a3) {
1993              fldai %s
1994              fcmpg a0
1995              jeqz ok1
1996              ldai 1
1997              return
1998          ok1:
1999              fldai.64 %s
2000              fcmpg.64 a1
2001              jeqz ok2
2002              ldai 2
2003              return
2004          ok2:
2005              fldai %s
2006              fcmpg a2
2007              jeqz ok3
2008              ldai 3
2009              return
2010          ok3:
2011              fldai.64 %s
2012              fcmpg.64 a3
2013              return
2014          }
2015          .function i32 main() {
2016              fmovi v0, %s
2017              fmovi.64 v1, %s
2018              fmovi v2, %s
2019              fmovi.64 v3, %s
2020              lda.64 v1
2021              call.acc foo, v0, v2, v3, 1
2022              return
2023          }
2024        cases:
2025          - values: [0, -1.1, -1.1, 0.12345678, 0, -1.1, -1.1, 0.12345678]
2026          - values: [0.717171717171717171717171e71, 0.373737373737373737e37, 1.98765e14, -0.000000019e19, 0.717171717171717171717171e71, 0.373737373737373737e37, 1.98765e14, -0.000000019e19]
2027          - values: [0xff800000, 0x7ff0000000000000, 0x7f800000, 0xfff0000000000000, 0xff800000, 0x7ff0000000000000, 0x7f800000, 0xfff0000000000000]
2028
2029
2030      - file-name: values_obj_p
2031        isa:
2032          instructions:
2033            - sig: call.acc method_id, v1:in:top, v2:in:top, v3:in:top, imm:u2
2034              acc: inout:top
2035              format: [op_v1_4_v2_4_v3_4_imm_4_id_16]
2036        runner-options: []
2037        description: Check 'call.acc' instruction called with object values in PandaAssembly context.
2038        header-template: []
2039        check-type: empty
2040        code-template: |
2041          .record panda.Object <external>
2042          .record panda.String <external>
2043          .record R {}
2044          # put objects into array
2045          .function panda.Object foo(panda.Object a0, panda.Object a1, panda.Object a2, panda.Object a3) {
2046              movi v0, 4
2047              newarr v0, v0, panda.Object[]
2048              lda.obj a0
2049              movi v7, 0
2050              starr.obj v0, v7
2051              lda.obj a1
2052              movi v7, 1
2053              starr.obj v0, v7
2054              lda.obj a2
2055              movi v7, 2
2056              starr.obj v0, v7
2057              lda.obj a3
2058              movi v7, 3
2059              starr.obj v0, v7
2060              lda.obj v0
2061              return.obj
2062          }
2063          # check that array contains correct obj refs
2064          .function i32 check(panda.Object a0, panda.Object a1, panda.Object a2, panda.Object a3, panda.Object[] a4) {
2065              ldai 0
2066              ldarr.obj a4
2067              jeq.obj a0, ok1
2068              ldai 1
2069              return
2070          ok1:
2071              ldai 1
2072              ldarr.obj a4
2073              jeq.obj a1, ok2
2074              ldai 2
2075              return
2076          ok2:
2077              ldai 2
2078              ldarr.obj a4
2079              jeq.obj a2, ok3
2080              ldai 3
2081              return
2082          ok3:
2083              ldai 3
2084              ldarr.obj a4
2085              jeq.obj a3, ok4
2086              ldai 4
2087              return
2088          ok4:
2089              ldai 0
2090              return
2091          }
2092          .function i32 main() {
2093              %s
2094              lda.obj v0
2095              call.acc foo, v1, v2, v3, 0    #  acc, v1, v2, v3
2096              sta.obj v4
2097              call.range check, v0
2098              jeqz pass1
2099              return
2100          pass1:
2101              lda.obj v1
2102              call.acc foo, v0, v2, v3, 1    #  v0, acc, v2, v3
2103              sta.obj v4
2104              call.range check, v0
2105              jeqz pass2
2106              return
2107          pass2:
2108              lda.obj v2
2109              call.acc foo, v0, v1, v3, 2    #  v0, v1, acc, v3
2110              sta.obj v4
2111              call.range check, v0
2112              jeqz pass3
2113              return
2114          pass3:
2115              lda.obj v3
2116              call.acc foo, v0, v1, v2, 3    #  v0, v1, v2, acc
2117              sta.obj v4
2118              call.range check, v0
2119              return
2120          }
2121        cases:
2122          - values:
2123            - |
2124              #
2125                  newobj v0, R
2126                  newobj v1, panda.Object
2127                  lda.str "test"
2128                  sta.obj v2
2129                  lda.type panda.String
2130                  sta.obj v3
2131          - values:
2132            - |
2133              #
2134                  mov.null v0
2135                  newobj v1, R
2136                  newobj v2, panda.Object
2137                  mov.null v3
2138          - values:
2139            - |
2140              #
2141                  movi v5, 0
2142                  newarr v0, v5, panda.String[]
2143                  lda.str ""
2144                  sta.obj v1
2145                  newarr v2, v5, R[][]
2146                  newarr v3, v5, i32[]
2147
2148
2149      - file-name: regs_restored
2150        isa:
2151          description: >
2152            Call indicated static method, i.e. create new frame, pass values of arguments and
2153            continue execution from the first instruction of a method.
2154            Callee should treat accumulator value as undefined and cannot use it until accumulator
2155            definition in the new frame.
2156        description: Check 'call.acc' that registers are restored after the call.
2157        tags: [tsan]
2158        header-template: []
2159        code-template: |
2160          .function i32 foo(i32 a0, i32 a1, i32 a2, i32 a3) {
2161              movi a0, -100
2162              movi a1, -200
2163              movi a2, -300
2164              movi a3, -400
2165              movi v0, 100
2166              movi v1, 200
2167              movi v2, 300
2168              movi v3, 400
2169              movi v4, 500
2170              movi v5, 600
2171              movi v6, 700
2172              movi v7, 800
2173              movi v8, 900
2174              movi v9, 1000
2175              movi v10, 1100
2176              movi v11, 1200
2177              movi v12, 1300
2178              movi v13, 1400
2179              movi v14, 1500
2180              movi v15, 1600
2181              ldai 9999
2182              return
2183          }
2184          .function i32 main() {
2185              movi v0, 1
2186              movi v1, 2
2187              movi v2, 3
2188              movi v3, 4
2189              movi v4, 5
2190              movi v5, 6
2191              movi v6, 7
2192              movi v7, 8
2193              movi v8, 9
2194              movi v9, 10
2195              movi v10, 11
2196              movi v11, 12
2197              movi v12, 13
2198              movi v13, 14
2199              movi v14, 15
2200              movi v15, 16
2201              ldai 0
2202              call.acc foo, v0, v1, v2, 3
2203              call.acc foo, v3, v4, v5, 3
2204              call.acc foo, v6, v7, v8, 3
2205              call.acc foo, v9, v10, v11, 3
2206              call.acc foo, v12, v13, v14, 3
2207              call.acc foo, v15, v15, v15, 3
2208              ldai 1
2209              jeq v0, ok1
2210              return
2211          ok1:
2212              ldai 2
2213              jeq v1, ok2
2214              return
2215          ok2:
2216              ldai 3
2217              jeq v2, ok3
2218              return
2219          ok3:
2220              ldai 4
2221              jeq v3, ok4
2222              return
2223          ok4:
2224              ldai 5
2225              jeq v4, ok5
2226              return
2227          ok5:
2228              ldai 6
2229              jeq v5, ok6
2230              return
2231          ok6:
2232              ldai 7
2233              jeq v6, ok7
2234              return
2235          ok7:
2236              ldai 8
2237              jeq v7, ok8
2238              return
2239          ok8:
2240              ldai 9
2241              jeq v8, ok9
2242              return
2243          ok9:
2244              ldai 10
2245              jeq v9, ok10
2246              return
2247          ok10:
2248              ldai 11
2249              jeq v10, ok11
2250              return
2251          ok11:
2252              ldai 12
2253              jeq v11, ok12
2254              return
2255          ok12:
2256              ldai 13
2257              jeq v12, ok13
2258              return
2259          ok13:
2260              ldai 14
2261              jeq v13, ok14
2262              return
2263          ok14:
2264              ldai 15
2265              jeq v14, ok15
2266              return
2267          ok15:
2268              ldai 16
2269              jeq v15, ok16
2270              return
2271          ok16:
2272        check-type: exit-positive
2273