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