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