• 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: "initobj"
21    isa:
22      title: Create new object and call initializer
23      description: |
24        Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their
25        default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to
26        the newly created object into accumulator. method_id should resolve to an initializer.
27        Non-range instructions can be used to pass up to 4 arguments.
28        Unused register slot values will be discarded and corresponding registers will not be passed to initializer).
29      instructions:
30        - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
31          acc: out:ref
32          format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
33    commands:
34
35      - file-name: "invalid_syntax"
36        isa:
37          verification:
38            - method_id_non_static
39            - method_id_accessible
40            - method_init_obj
41        runner-options: [compile-failure]
42        description: Check 'initobj' instruction with invalid method id.
43        header-template: []
44        code-template: |
45          .record A {
46              i32   f32
47              A     fA
48              i32[] f32Array
49              A[]   fAArray
50          }
51          .function void A.c4(A a0, u1 a1, u1 a2, u1 a3, u1 a4) <ctor> {
52              return.void
53          }
54          .function void A.c3(A a0, u16 a1, u16 a2, u16 a3) <ctor> {
55              return.void
56          }
57          .function void A.c2(A a0, u32 a1, u32 a2) <ctor> {
58              return.void
59          }
60          .function void A.c1(A a0, u64 a1) <ctor> {
61              return.void
62          }
63          .function void A.c0(A a0) <ctor> {
64              return.void
65          }
66          .function void A.aFunc(A a0) {
67              return.void
68          }
69          .function i32 main() {
70          begin:
71              initobj %s
72        check-type: exit-positive
73        cases:
74          - values:
75            - ""
76          - values:
77            - "label:"
78          - values:
79            - "begin"
80          - values:
81            - "{}"
82          - values:
83            - "}"
84          - values:
85            - "# comment"
86          - values:
87            - "null"
88          - values:
89            - "0"
90          - values:
91            - "v0"
92          - values:
93            - "i32"
94          - values:
95            - i32[]
96          - values:
97            - "\"A\""
98          - values:
99            - A
100          - values:
101            - "A.f32"
102          - values:
103            - "A.fA"
104          - values:
105            - "A.f32Array"
106          - values:
107            - "A.fAArray"
108          - values:
109            - "A[]"
110          - values:
111            - "panda.Object[]"
112          - values:
113            - "aFunc, v1"
114          - values:
115            - "Object"
116          - values:
117            - A.c4, v1, v2, v3, v4, v5
118          - values:
119            - A.c4, v1, v2, v3
120            ignore: true
121            bugid: ['1956','1304']
122          - values:
123            - A.c4, a1, a2, a3, a4
124          - values:
125            - A.c4, 0, 1, 2, 3
126          - values:
127            - A.c3, v1, v2
128            ignore: true
129            bugid: ['1956','1304']
130          - values:
131            - A.c3, a1, a2, a3
132          - values:
133            - A.c3, , ,
134
135
136      - file-name: "uninitialized_regs_p"
137        isa:
138          instructions:
139            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
140              acc: out:ref
141              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
142        runner-options: ['verifier-failure', 'verifier-config']
143        tags: [verifier]
144        description: Check 'initobj' instruction with uninitialized registers in PandaAssembly context.
145        header-template: []
146        code-template: |
147          .record panda.Object <external>
148          .record panda.String <external>
149          .record R {}
150          .function void R.ctor(R a0, %s) <ctor> {
151              return.void
152          }
153          .function i32 main() {
154              %s
155        check-type: exit-positive
156        cases:
157          - values:
158            # v1 not initialized
159            - i32 a1
160            - initobj R.ctor, v1
161          - values:
162            # v2 not initialized
163            - i64 a1, f64 a2
164            - |
165              #
166                  movi.64 v1, 1
167                  initobj R.ctor, v1, v2
168          - values:
169            # v3 not initialized
170            - i32[] a1, panda.Object a2, R[] a3
171            - |
172              #
173                  movi v1, 10
174                  newarr v1, v1, i32[]
175                  mov.null v2
176                  initobj R.ctor, v1, v2, v3
177          - values:
178            # v4 not initialized
179            - R a1, panda.String a2, f64 a3, panda.Object a4
180            - |
181              #
182                  mov.null v1
183                  lda.str "test string"
184                  sta.obj v2
185                  fmovi.64 v3, 3.14
186                  initobj R.ctor, v1, v2, v3, v4
187          - values:
188            # v1, v2, v3, v4 not initialized
189            - u1 a1, u8 a2, u16 a3, u32 a4
190            - initobj R.ctor, v1, v2, v3, v4
191          - values:
192            # v4 not initialized but not used
193            - f64[] a1, panda.String a2, i8 a3
194            - |
195              #
196                  movi v0, 10
197                  newarr v1, v0, f64[]
198                  lda.str "test"
199                  sta.obj v2
200                  movi v3, 127
201                  initobj R.ctor, v1, v2, v3, v4
202            runner-options: ['verifier-only', 'verifier-config']
203          - values:
204            # v1, v2, v3 not initialized but not used
205            - panda.String[] a1
206            - |
207              #
208                  movi v0, 10
209                  newarr v4, v0, panda.String[]
210                  initobj R.ctor, v4, v3, v2, v1
211            runner-options: ['verifier-only', 'verifier-config']
212
213
214      - file-name: "uninitialized_regs_j"
215        isa:
216          instructions:
217            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
218              acc: out:ref
219              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
220        runner-options: [verifier-failure, use-pa, verifier-config]
221        tags: [verifier, pa-verifier]
222        description: Check 'initobj' instruction with uninitialized registers in PandaAssembly context.
223        header-template: [PandaAssembly]
224        bugid: ["5271"]
225        code-template: |
226          .record panda.Object <external>
227          .record panda.String <external>
228          .record R {}
229          %s
230          .function i32 main() {
231              %s
232        check-type: exit-positive
233        cases:
234          - values:
235            # v1 not initialized
236            - |
237              .function void R.ctor(R a0, i32 a1) <ctor> {
238                  return.void
239              }
240            - initobj R.ctor, v1
241          - values:
242            # v2 not initialized
243            - |
244              .function void R.ctor(R a0, i64 a1, f64 a2) <ctor> {
245                  return.void
246              }
247            - |
248              #
249                  movi.64 v1, 1
250                  initobj R.ctor, v1, v2
251          - values:
252            # v3 not initialized
253            - |
254              .function void R.ctor(R a0, i32[] a1, panda.Object a2, R[] a3) <ctor> {
255                  return.void
256              }
257            - |
258              #
259                  movi v1, 10
260                  newarr v1, v1, i32[]
261                  mov.null v2
262                  initobj R.ctor, v1, v2, v3
263          - values:
264            # v4 not initialized
265            - |
266              .function void R.ctor(R a0, R a1, panda.String a2, f64 a3, panda.Object a4) <ctor> {
267                  return.void
268              }
269            - |
270              #
271                  mov.null v1
272                  lda.str "test string"
273                  sta.obj v2
274                  fmovi.64 v3, 3.14
275                  initobj R.ctor, v1, v2, v3, v4
276          - values:
277            # v1, v2, v3, v4 not initialized
278            - |
279              .function void R.ctor(R a0, u1 a1, i8 a2, u16 a3, i32 a4) <ctor> {
280                  return.void
281              }
282            - initobj R.ctor, v1, v2, v3, v4
283          - values:
284            # v4 not initialized but not used
285            - |
286              .function void R.ctor(R a0, f64[] a1, panda.String a2, i8 a3) <ctor> {
287                  return.void
288              }
289            - |
290              #
291                  movi v0, 10
292                  newarr v1, v0, f64[]
293                  lda.str "test"
294                  sta.obj v2
295                  movi v3, 127
296                  initobj R.ctor, v1, v2, v3, v4
297            runner-options: [verifier-only, use-pa, verifier-config]
298          - values:
299            # v1, v2, v3 not initialized but not used
300            - |
301              .function void R.ctor(R a0, panda.String[] a1) <ctor> {
302                  return.void
303              }
304            - |
305              #
306                  movi v0, 10
307                  newarr v4, v0, panda.String[]
308                  initobj R.ctor, v4, v3, v2, v1
309            runner-options: [verifier-only, use-pa, verifier-config]
310          - values:
311            # v1, v2, v3, v4 not initialized but not used
312            - |
313              .record panda.NullPointerException <external>
314              .function void panda.NullPointerException.ctor1(panda.NullPointerException a0) <external, ctor>
315            - |
316              #
317                  initobj panda.NullPointerException.ctor1, v1, v2, v3, v4
318            runner-options: [verifier-only, use-pa, verifier-config]
319          - values:
320            # v1 is not initialized
321            - |
322              .record panda.NullPointerException <external>
323              .function void panda.NullPointerException.ctor(panda.NullPointerException a0) <external, ctor>
324              .function void panda.NullPointerException.ctor2(panda.NullPointerException a0, panda.String a1) <external, ctor>
325            - |
326              #
327                  initobj panda.NullPointerException.ctor2, v1, v2, v3, v4
328
329
330      - file-name: "reg_v_invalid"
331        isa:
332          instructions:
333            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
334              acc: out:ref
335              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
336        runner-options: [compile-failure]
337        description: Check 'initobj' instruction with invalid 'v' register numbers.
338        header-template: []
339        code-template: |
340          .record R {}
341          .function void R.c(R a0, i32 a1, i32 a2, i32 a3, i32 a4) <ctor> {
342              return.void
343          }
344          #
345          .function i32 main() {
346              initobj R.c, %s
347        check-type: exit-positive
348        cases:
349          - values:
350            - "v16, v1, v2, v3"
351          - values:
352            - "v0, v255, v2, v3"
353          - values:
354            - "v0, v1, v256, v3"
355          - values:
356            - "v0, v1, v2, v65535"
357          - values:
358            - "v65536, v1, v2, v3"
359
360
361      - file-name: "reg_a_invalid"
362        isa:
363          instructions:
364            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
365              acc: out:ref
366              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
367        runner-options: [compile-failure]
368        description: Check 'initobj' instruction with invalid 'a' register numbers.
369        header-template: []
370        code-template: |
371          .record R {}
372          .function void R.c(R a0, i32 a1, i32 a2, i32 a3, i32 a4) <ctor> {
373              return.void
374          }
375          .function void func(i32 a0, i32 a1, i32 a2, i32 a3, i32 a4, i32 a5, i32 a6, i32 a7, i32 a8, i32 a9, i32 a10, i32 a11, i32 a12, i32 a13, i32 a14, i32 a15) {
376              initobj R.c, %s
377              return.void
378          }
379          #
380          .function i32 main() {
381              call.range func, v0
382        check-type: exit-positive
383        cases:
384          - values:
385            - "a16, a15, a14, a13"
386          - values:
387            - "a0, a255, a10, a11"
388          - values:
389            - "a12, a9, a256, a7"
390          - values:
391            - "a0, a0, a0, a65535"
392          - values:
393            - "a65536, a1, a2, a3"
394
395
396      - file-name: "reg_v_valid"
397        isa:
398          instructions:
399            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
400              acc: out:ref
401              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
402        description: Check 'initobj' instruction with valid 'v' register numbers.
403        header-template: []
404        code-template: |
405          .record R {}
406          .function void R.c(R a0, i32 a1, i32 a2, i32 a3, i32 a4) <ctor> {
407              return.void
408          }
409          #
410          .function i32 main() {
411              movi %s, 100
412              movi %s, 200
413              movi %s, 300
414              movi %s, 400
415              lda.null
416              initobj R.c, %s, %s, %s, %s
417              jnez.obj ok
418              ldai 1
419              return
420          ok:
421        check-type: exit-positive
422        cases:
423          - values: [v0, v1, v2, v3, v0, v1, v2, v3]
424          - values: [v4, v5, v6, v7, v4, v5, v6, v7]
425          - values: [v8, v9, v10, v11, v8, v9, v10, v11]
426          - values: [v12, v13, v14, v15, v12, v13, v14, v15]
427
428
429      - file-name: "reg_a_valid"
430        isa:
431          instructions:
432            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
433              acc: out:ref
434              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
435        runner-options: ['verifier-only', 'verifier-config']
436        tags: ['verifier']
437        description: Check 'initobj' instruction with valid 'a' register numbers.
438        header-template: []
439        code-template: |
440          .record R {}
441          .function void R.c(R a0, i32 a1, i32 a2, i32 a3, i32 a4) <ctor> {
442              return.void
443          }
444          .function void func(i32 a0, i32 a1, i32 a2, i32 a3, i32 a4, i32 a5, i32 a6, i32 a7, i32 a8, i32 a9, i32 a10, i32 a11, i32 a12, i32 a13, i32 a14, i32 a15) {
445              initobj R.c, a0, a1, a2, a3
446              initobj R.c, a4, a5, a6, a7
447              initobj R.c, a8, a9, a10, a11
448              initobj R.c, a12, a13, a14, a15
449              return.void
450          }
451          #
452          .function i32 main() {
453              movi v0, 0
454              movi v1, 1
455              movi v2, 2
456              movi v3, 3
457              movi v4, 4
458              movi v5, 5
459              movi v6, 6
460              movi v7, 7
461              movi v8, 8
462              movi v9, 9
463              movi v10, 10
464              movi v11, 11
465              movi v12, 12
466              movi v13, 13
467              movi v14, 14
468              movi v15, 15
469              call.range func, v0
470        check-type: exit-positive
471
472
473      - file-name: "invalid_ctor_p"
474        isa:
475          verification:
476            - method_id_non_static
477            - method_id_accessible
478            - method_init_obj
479        runner-options: ['verifier-failure', 'verifier-config']
480        tags: [verifier]
481        description: Check 'initobj' instruction with invalid initializer in PandaAssembly context.
482        header-template: []
483        code-template: |
484          .record R {}
485          %s
486          .function i32 main() {
487              %s
488        check-type: exit-positive
489        cases:
490          # static functions
491          - values:
492            - ""
493            - initobj main
494            bugid: ['3585']
495          - values:
496            - |
497              .function void R.cctor() <cctor> {
498                  return.void
499              }
500            - initobj R.cctor
501            bugid: ['3585']
502          - values:
503            - |
504              .function void R.cctor2(i32 a0) <cctor> {
505                  return.void
506              }
507            - |
508              #
509                  movi v1, 1
510                  initobj R.cctor2, v1
511          - values:
512            - |
513              .function void R.statFunc() <static> {
514                  return.void
515              }
516            - initobj R.statFunc
517            bugid: ['3585']
518          - values:
519            - |
520              .function void R.ctor() <ctor> {
521                  return.void
522              }
523              .function void R.statFunc2(R a0, i32 a1) <static> {
524                  return.void
525              }
526            - |
527              #
528                  movi v1, 1
529                  initobj R.ctor                 # should be ok
530                  sta.obj v0
531                  initobj R.statFunc2, v0, v1    # should fail
532          # virtual functions, not initializers
533          - values:
534            - |
535              .function void R.virtFunc(R a0) {
536                  return.void
537              }
538            - initobj R.virtFunc
539            bugid: ['3585']
540          - values:
541            - |
542              .function void R.ctor() <ctor> {
543                  return.void
544              }
545              .function void R.virtFunc2(R a0, i32 a1) {
546                  return.void
547              }
548            - |
549              #
550                  movi v1, 1
551                  initobj R.ctor                 # should be ok
552                  sta.obj v0
553                  initobj R.virtFunc2, v0, v1    # should fail
554          - values:
555            - |
556              .record panda.NullPointerException <external>
557              .record panda.String <external>
558              .function panda.String panda.NullPointerException.getMessage(panda.NullPointerException a0) <external>
559            - initobj panda.NullPointerException.getMessage
560            bugid: ['3585']
561          - values:
562            - |
563              .function void R.ctor() <ctor> {
564                  return.void
565              }
566              .record panda.NullPointerException <external>
567              .record panda.String <external>
568              .record panda.Object <external>
569              .function void panda.NullPointerException.ctor(panda.NullPointerException a0, panda.String a1, panda.Object a2) <external, ctor>
570              .function panda.String panda.NullPointerException.getMessage(panda.NullPointerException a0) <external>
571            - |
572              #
573                  lda.str "message"
574                  sta.obj v1
575                  initobj R.ctor                                      # should be ok
576                  sta.obj v2
577                  initobj panda.NullPointerException.ctor, v1, v2     # should be ok
578                  sta.obj v0
579                  initobj panda.NullPointerException.getMessage, v0   # should fail
580            bugid: ['3585']
581          # inaccessible methods
582          - values:
583            - .function void R.extFunc(R a0) <external>
584            - initobj R.extFunc
585            bugid: ['3585']
586          - values:
587            - .function void R.nativeFunc(R a0) <native>
588            - initobj R.nativeFunc
589            bugid: ['3585']
590          - values:
591            - .function void R.noimplFunc(R a0) <noimpl>
592            - initobj R.noimplFunc
593            bugid: ['3585']
594          # ctor without return
595          - values:
596            - .function void R.ctorNoReturn(R a0) <ctor> {}
597            - initobj R.ctorNoReturn
598            bugid: ['5607']
599            ignore: true
600
601
602      - file-name: "invalid_ctor_j"
603        isa:
604          verification:
605            - method_id_non_static
606            - method_id_accessible
607            - method_init_obj
608        runner-options: [verifier-failure, use-pa, verifier-config]
609        tags: [verifier, pa-verifier]
610        description: Check 'initobj' instruction with invalid initializer in PandaAssembly context.
611        header-template: [PandaAssembly]
612        bugid: ["5271"]
613        code-template: |
614          .record R {}
615          %s
616          .function i32 main() {
617              %s
618        check-type: exit-positive
619        cases:
620          # static functions
621          - values:
622            - ""
623            - initobj main
624            bugid: ['3585']
625          - values:
626            - |
627              .function void R.cctor() <cctor> {
628                  return.void
629              }
630            - initobj R.cctor
631            bugid: ['3585']
632          - values:
633            - |
634              .function void R.cctor(R a0, i32 a1) <cctor> {
635                  return.void
636              }
637            - |
638              #
639                  movi v1, 1
640                  initobj R.cctor, v1
641            bugid: ['3585']
642          - values:
643            - |
644              .function void R.statFunc() <static> {
645                  return.void
646              }
647            - initobj R.statFunc
648            bugid: ['3585']
649          - values:
650            - |
651              .function void R.ctor0() <ctor> {
652                  return.void
653              }
654              .function void R.ctor(R a0, i32 a1) <static> {
655                  return.void
656              }
657            - |
658              #
659                  movi v1, 1
660                  initobj R.ctor0           # should be ok
661                  sta.obj v0
662                  initobj R.ctor, v0, v1    # should fail
663          - values:
664            - |
665              .function void R.ctor(R a0, i32 a1) <static> {
666                  return.void
667              }
668            - |
669              #
670                  movi v1, 1
671                  initobj R.ctor, v1    # should fail
672            bugid: ['3585']
673          - values:
674            - |
675              .record panda.Long <external>
676              .function panda.Long panda.Long.valueOf(i64 a0) <external, static>
677            - |
678              #
679                  movi.64 v1, 1
680                  initobj panda.Long.valueOf, v1
681          # virtual functions, not initializers
682          - values:
683            - |
684              .function void R.virtFunc(R a0) {
685                  return.void
686              }
687            - initobj R.virtFunc
688            bugid: ['3585']
689          - values:
690            - |
691              .function void R.ctor() <ctor> {
692                  return.void
693              }
694              .function void R.virtFunc(R a0, i32 a1) {
695                  return.void
696              }
697            - |
698              #
699                  movi v1, 1
700                  initobj R.ctor                 # should be ok
701                  sta.obj v0
702                  initobj R.virtFunc, v0, v1    # should fail
703          - values:
704            - |
705              .record panda.NullPointerException <external>
706              .record panda.String <external>
707              .function void panda.NullPointerException.ctor(panda.NullPointerException a0, panda.String a1) <external, ctor>
708            - |
709              #
710                  lda.str "message"
711                  sta.obj v1
712                  initobj panda.NullPointerException.ctor, v1         # should be ok
713            runner-options: [verifier-only, use-pa, verifier-config]
714          - values:
715            - |
716              .record panda.NullPointerException <external>
717              .record panda.String <external>
718              .function panda.String panda.NullPointerException.getMessage(panda.NullPointerException a0) <external>
719            - initobj panda.NullPointerException.getMessage
720            bugid: ['3585', '5752']
721          - values:
722            - |
723              .record panda.NullPointerException <external>
724              .record panda.String <external>
725              .function void panda.NullPointerException.ctor(panda.NullPointerException a0, panda.String a1) <external, ctor>
726              .function panda.String panda.NullPointerException.getMessage(panda.NullPointerException a0) <external>
727            - |
728              #
729                  lda.str "message"
730                  sta.obj v1
731                  initobj panda.NullPointerException.ctor, v1             # should be ok
732                  sta.obj v0
733                  initobj panda.NullPointerException.getMessage, v0       # should fail
734            bugid: ['3585', '5752']
735          - values:
736              - |
737                .record panda.Long <external>
738                .function i64 panda.Long.longValue(panda.Long a0) <external>
739              - |
740                #
741                    initobj panda.Long.longValue
742            bugid: ['3585']
743          - values:
744              - |
745                .record panda.Long <external>
746                .function void panda.Long.ctor(panda.Long a0, i64 a1) <ctor, external>
747                .function i64 panda.Long.longValue(panda.Long a0) <external>
748              - |
749                #
750                    movi.64 v1, 1234567890
751                    initobj panda.Long.ctor, v1
752                    sta.obj v1
753                    initobj panda.Long.longValue, v1
754            bugid: ['3585']
755          # inaccessible methods
756          - values:
757            - .function void R.extFunc(R a0) <external>
758            - initobj R.extFunc
759            bugid: ['3585']
760          - values:
761            - .function void R.nativeFunc(R a0) <native>
762            - initobj R.nativeFunc
763            bugid: ['3585']
764          - values:
765            - .function void R.noimplFunc(R a0) <noimpl>
766            - initobj R.noimplFunc
767            bugid: ['3585']
768          - values:
769            - |
770              .record I <panda.interface> {}
771              .function void I.func(I a0) <noimpl>
772              .record Q <panda.implements=I> {}
773              .function void Q.func(Q a0) {
774                  return.void
775              }
776            - |
777              #
778                  initobj I.func
779            bugid: ['3585']
780          # ctor without return
781          - values:
782            - .function void R.ctorNoReturn(R a0) <ctor> {}
783            - initobj R.ctorNoReturn
784            bugid: ['5607']
785            ignore: true
786
787
788      - file-name: "incompatible_args_p"
789        isa:
790          verification:
791            - compatible_arguments
792        runner-options: ['verifier-failure', 'verifier-config']
793        tags: [verifier]
794        description: Check 'initobj' instruction with initializer called with incompatible arguments in PandaAssembly context.
795        header-template: []
796        code-template: |
797          .record panda.Object <external>
798          .record panda.Class <external>
799          .record panda.String <external>
800          .record R {}
801          .function void R.constructor(R a0, %s a1) <ctor> {
802              return.void
803          }
804
805          .function i32 main() {
806              *s
807              initobj R.constructor, v1
808        check-type: exit-positive
809        template-cases:
810          - values:
811            - u1
812            exclude: [i32]
813          - values:
814            - u8
815            exclude: [i32]
816          - values:
817            - i8
818            exclude: [i32]
819          - values:
820            - u16
821            exclude: [i32]
822          - values:
823            - i16
824            exclude: [i32]
825          - values:
826            - u32
827            exclude: [i32]
828          - values:
829            - u64
830            exclude: [i64]
831          - values:
832            - f32
833            exclude: [f64]
834          - values:
835            - u32[]
836            exclude: [u32a, nul]
837          - values:
838            - u64[]
839            exclude: [u64a, nul]
840          - values:
841            - f32[]
842            exclude: [f32a, nul]
843          - values:
844            - u32[][]
845            exclude: [u32aa, nul]
846          - values:
847            - u64[][]
848            exclude: [u64aa, nul]
849          - values:
850            - f32[][]
851            exclude: [f32aa, nul]
852          - values:
853            - R
854            exclude: [nul]
855          - values:
856            - panda.String
857            exclude: [str, nul]
858          - values:
859            - panda.Class
860            exclude: [typ, nul]
861          - values:
862            - panda.Object
863            exclude: [u32a, u64a, f32a, u32aa, u64aa, f32aa, str, typ, ra, stra, typa, obja, raa, straa, typaa, objaa, nul]
864          - values:
865            - R[]
866            exclude: [ra, nul]
867          - values:
868            - panda.String[]
869            exclude: [stra, nul]
870          - values:
871            - panda.Class[]
872            exclude: [typa, nul]
873          - values:
874            - panda.Object[]
875            exclude: [obja, u32aa, u64aa, f32aa, ra, stra, typa, raa, straa, typaa, objaa, nul]
876          - values:
877            - R[][]
878            exclude: [raa, nul]
879          - values:
880            - panda.String[][]
881            exclude: [straa, nul]
882          - values:
883            - panda.Class[][]
884            exclude: [typaa, nul]
885          - values:
886            - panda.Object[][]
887            exclude: [objaa, raa, straa, typaa, nul]
888        cases:
889          - values:
890            - movi v1, 1
891            id: i32
892          - values:
893            - movi.64 v1, 1
894            id: i64
895          - values:
896            - fmovi.64 v1, 1.0
897            id: f64
898          - values:
899            - |
900              #
901                  movi v1, 10
902                  newarr v1, v1, u32[]
903            id: u32a
904          - values:
905            - |
906              #
907                  movi v1, 10
908                  newarr v1, v1, u64[]
909            id: u64a
910          - values:
911            - |
912              #
913                  movi v1, 10
914                  newarr v1, v1, f32[]
915            id: f32a
916          - values:
917            - |
918              #
919                  movi v1, 10
920                  newarr v1, v1, u32[][]
921            id: u32aa
922          - values:
923            - |
924              #
925                  movi v1, 10
926                  newarr v1, v1, u64[][]
927            id: u64aa
928          - values:
929            - |
930              #
931                  movi v1, 10
932                  newarr v1, v1, f32[][]
933            id: f32aa
934          - values:
935            - |
936              #
937                  lda.str "test message"
938                  sta.obj v1
939            id: str
940          - values:
941            - |
942              #
943                  lda.type R
944                  sta.obj v1
945            id: typ
946          - values:
947            - |
948              #
949                  movi v1, 10
950                  newarr v1, v1, R[]
951            id: ra
952          - values:
953            - |
954              #
955                  movi v1, 10
956                  newarr v1, v1, panda.String[]
957            id: stra
958          - values:
959            - |
960              #
961                  movi v1, 10
962                  newarr v1, v1, panda.Class[]
963            id: typa
964          - values:
965            - |
966              #
967                  movi v1, 10
968                  newarr v1, v1, panda.Object[]
969            id: obja
970          - values:
971            - |
972              #
973                  movi v1, 10
974                  newarr v1, v1, R[][]
975            id: raa
976          - values:
977            - |
978              #
979                  movi v1, 10
980                  newarr v1, v1, panda.String[][]
981            id: straa
982          - values:
983            - |
984              #
985                  movi v1, 10
986                  newarr v1, v1, panda.Class[][]
987            id: typaa
988          - values:
989            - |
990              #
991                  movi v1, 10
992                  newarr v1, v1, panda.Object[][]
993            id: objaa
994          - values:
995            - mov.null v1
996            id: nul
997
998
999      - file-name: "incompatible_args_j"
1000        isa:
1001          verification:
1002            - compatible_arguments
1003        runner-options: [verifier-failure, use-pa, verifier-config]
1004        tags: [verifier, pa-verifier]
1005        description: Check 'initobj' instruction with initializer called with incompatible arguments in PandaAssembly context.
1006        header-template: [PandaAssembly]
1007        bugid: ["5271"]
1008        code-template: |
1009          .record panda.Object <external>
1010          .record panda.Class <external>
1011          .record R {}
1012          .function void R.constructor(R a0, %s a1) <ctor> {
1013              return.void
1014          }
1015
1016          .function i32 main() {
1017              *s
1018              initobj R.constructor, v1
1019        check-type: exit-positive
1020        template-cases:
1021          - values:
1022            - u1
1023            exclude: [i32]
1024          - values:
1025            - i8
1026            exclude: [i32]
1027          - values:
1028            - u16
1029            exclude: [i32]
1030          - values:
1031            - i16
1032            exclude: [i32]
1033          - values:
1034            - i32
1035            exclude: [i32]
1036          - values:
1037            - i64
1038            exclude: [i64]
1039          - values:
1040            - f32
1041            exclude: [f64]
1042          - values:
1043            - f64
1044            exclude: [f64]
1045          - values:
1046            - u1[]
1047            exclude: [u1a, nul]
1048          - values:
1049            - i8[]
1050            exclude: [i8a, nul]
1051          - values:
1052            - u16[]
1053            exclude: [u1a, u16a, nul]
1054          - values:
1055            - i16[]
1056            exclude: [i8a, i16a, nul]
1057          - values:
1058            - i32[]
1059            exclude: [i8a, i16a, i32a, nul]
1060          - values:
1061            - i64[]
1062            exclude: [i64a, nul]
1063          - values:
1064            - f32[]
1065            exclude: [f32a, nul]
1066          - values:
1067            - f64[]
1068            exclude: [f32a, f64a, nul]
1069          - values:
1070            - i32[][]
1071            exclude: [i32aa, nul]
1072          - values:
1073            - f64[][]
1074            exclude: [f64aa, nul]
1075          - values:
1076            - R
1077            exclude: [nul]
1078          - values:
1079            - panda.Class
1080            exclude: [typ, nul]
1081          - values:
1082            - panda.Object
1083            exclude: [u1a, i8a, u16a, i16a, i32a, i64a, f32a, f64a, i32aa, f64aa, typ, ra, typa, obja, raa, typaa, objaa, nul]
1084          - values:
1085            - R[]
1086            exclude: [ra, nul]
1087          - values:
1088            - panda.Class[]
1089            exclude: [typa, nul]
1090          - values:
1091            - panda.Object[]
1092            exclude: [obja, i32aa, f64aa, ra, typa, raa, typaa, objaa, nul]
1093          - values:
1094            - R[][]
1095            exclude: [raa, nul]
1096          - values:
1097            - panda.Class[][]
1098            exclude: [typaa, nul]
1099          - values:
1100            - panda.Object[][]
1101            exclude: [objaa, raa, typaa, nul]
1102        cases:
1103          - values:
1104            - movi v1, 1
1105            id: i32
1106          - values:
1107            - movi.64 v1, 1
1108            id: i64
1109          - values:
1110            - fmovi.64 v1, 1.0
1111            id: f64
1112          - values:
1113            - |
1114              #
1115                  movi v1, 10
1116                  newarr v1, v1, u1[]
1117            id: u1a
1118          - values:
1119            - |
1120              #
1121                  movi v1, 10
1122                  newarr v1, v1, i8[]
1123            id: i8a
1124          - values:
1125            - |
1126              #
1127                  movi v1, 10
1128                  newarr v1, v1, u16[]
1129            id: u16a
1130          - values:
1131            - |
1132              #
1133                  movi v1, 10
1134                  newarr v1, v1, i16[]
1135            id: i16a
1136          - values:
1137            - |
1138              #
1139                  movi v1, 10
1140                  newarr v1, v1, i32[]
1141            id: i32a
1142          - values:
1143            - |
1144              #
1145                  movi v1, 10
1146                  newarr v1, v1, i64[]
1147            id: i64a
1148          - values:
1149            - |
1150              #
1151                  movi v1, 10
1152                  newarr v1, v1, f32[]
1153            id: f32a
1154          - values:
1155            - |
1156              #
1157                  movi v1, 10
1158                  newarr v1, v1, f64[]
1159            id: f64a
1160          - values:
1161            - |
1162              #
1163                  movi v1, 10
1164                  newarr v1, v1, i32[][]
1165            id: i32aa
1166          - values:
1167            - |
1168              #
1169                  movi v1, 10
1170                  newarr v1, v1, f64[][]
1171            id: f64aa
1172          - values:
1173            - |
1174              #
1175                  lda.type R
1176                  sta.obj v1
1177            id: typ
1178          - values:
1179            - |
1180              #
1181                  movi v1, 10
1182                  newarr v1, v1, R[]
1183            id: ra
1184          - values:
1185            - |
1186              #
1187                  movi v1, 10
1188                  newarr v1, v1, panda.Class[]
1189            id: typa
1190          - values:
1191            - |
1192              #
1193                  movi v1, 10
1194                  newarr v1, v1, panda.Object[]
1195            id: obja
1196          - values:
1197            - |
1198              #
1199                  movi v1, 10
1200                  newarr v1, v1, R[][]
1201            id: raa
1202          - values:
1203            - |
1204              #
1205                  movi v1, 10
1206                  newarr v1, v1, panda.Class[][]
1207            id: typaa
1208          - values:
1209            - |
1210              #
1211                  movi v1, 10
1212                  newarr v1, v1, panda.Object[][]
1213            id: objaa
1214          - values:
1215            - mov.null v1
1216            id: nul
1217
1218
1219      - file-name: "compatible_primitive_args_p"
1220        isa:
1221          verification:
1222            - compatible_arguments
1223        runner-options: ['verifier-only', 'verifier-config']
1224        tags: [verifier]
1225        description: Check 'initobj' instruction with initializer called with compatible primitive arguments in PandaAssembly context.
1226        header-template: []
1227        code-template: |
1228          .record R {}
1229          .function void R.constructor(R a0, %s a1) <ctor> {
1230              return.void
1231          }
1232          .function i32 main() {
1233              %s
1234              initobj R.constructor, v1
1235        check-type: exit-positive
1236        cases:
1237          - values:
1238            - u1
1239            - movi v1, 1
1240          - values:
1241            - u8
1242            - movi v1, 1
1243          - values:
1244            - i8
1245            - movi v1, 1
1246          - values:
1247            - u16
1248            - movi v1, 1
1249          - values:
1250            - i16
1251            - movi v1, 1
1252          - values:
1253            - u32
1254            - movi v1, 1
1255          - values:
1256            - i32
1257            - movi v1, 1
1258          - values:
1259            - i64
1260            - movi.64 v1, 1
1261          - values:
1262            - u64
1263            - movi.64 v1, 1
1264          - values:
1265            - f32
1266            - fmovi v1, 1.1
1267          - values:
1268            - f64
1269            - fmovi.64 v1, 1.1
1270
1271
1272      - file-name: "compatible_primitive_args_j"
1273        isa:
1274          verification:
1275            - compatible_arguments
1276        runner-options: [verifier-only, use-pa, verifier-config]
1277        tags: [verifier, pa-verifier]
1278        description: Check 'initobj' instruction with initializer called with compatible primitive arguments in PandaAssembly context.
1279        header-template: [PandaAssembly]
1280        code-template: |
1281          .record R {}
1282          .function void R.constructor(R a0, %s a1) <ctor> {
1283              return.void
1284          }
1285          .function i32 main() {
1286              %s
1287              initobj R.constructor, v1
1288        check-type: exit-positive
1289        cases:
1290          - values:
1291            - u1
1292            - movi v1, 1
1293          - values:
1294            - i8
1295            - movi v1, 1
1296          - values:
1297            - u16
1298            - movi v1, 1
1299          - values:
1300            - i16
1301            - movi v1, 1
1302          - values:
1303            - i32
1304            - movi v1, 1
1305          - values:
1306            - i64
1307            - movi.64 v1, 1
1308          - values:
1309            - f32
1310            - fmovi v1, 1.1
1311          - values:
1312            - f64
1313            - fmovi.64 v1, 1.1
1314
1315
1316      - file-name: "compatible_prim_array_args_p"
1317        isa:
1318          verification:
1319            - compatible_arguments
1320        runner-options: ['verifier-only', 'verifier-config']
1321        tags: [verifier]
1322        description: Check 'initobj' instruction with initializer called with compatible primitive array arguments in PandaAssembly context.
1323        header-template: []
1324        code-template: |
1325          .record R {}
1326          .function void R.constructor(R a0, %s a1) <ctor> {
1327              return.void
1328          }
1329          .function i32 main() {
1330              movi v0, 10
1331              newarr v1, v0, %s
1332              initobj R.constructor, v1
1333        check-type: exit-positive
1334        cases:
1335          - values:
1336            - "u1[]"
1337            - "u1[]"
1338          - values:
1339            - "u8[]"
1340            - "u8[]"
1341          - values:
1342            - "i8[]"
1343            - "i8[]"
1344          - values:
1345            - "u16[]"
1346            - "u16[]"
1347          - values:
1348            - "i16[]"
1349            - "i16[]"
1350          - values:
1351            - "u32[]"
1352            - "u32[]"
1353          - values:
1354            - "i32[]"
1355            - "i32[]"
1356          - values:
1357            - "u64[]"
1358            - "u64[]"
1359          - values:
1360            - "i64[]"
1361            - "i64[]"
1362          - values:
1363            - "f32[]"
1364            - "f32[]"
1365          - values:
1366            - "f64[]"
1367            - "f64[]"
1368          - values:
1369            - "u1[][]"
1370            - "u1[][]"
1371          - values:
1372            - "u8[][]"
1373            - "u8[][]"
1374          - values:
1375            - "i8[][]"
1376            - "i8[][]"
1377          - values:
1378            - "u16[][]"
1379            - "u16[][]"
1380          - values:
1381            - "i16[][]"
1382            - "i16[][]"
1383          - values:
1384            - "u32[][]"
1385            - "u32[][]"
1386          - values:
1387            - "i32[][]"
1388            - "i32[][]"
1389          - values:
1390            - "u64[][]"
1391            - "u64[][]"
1392          - values:
1393            - "i64[][]"
1394            - "i64[][]"
1395          - values:
1396            - "f32[][]"
1397            - "f32[][]"
1398          - values:
1399            - "f64[][]"
1400            - "f64[][]"
1401
1402
1403      - file-name: "compatible_prim_array_args_j"
1404        isa:
1405          verification:
1406            - compatible_arguments
1407        runner-options: [verifier-only, use-pa, verifier-config]
1408        tags: [verifier, pa-verifier]
1409        description: Check 'initobj' instruction with initializer called with compatible primitive array arguments in PandaAssembly context.
1410        header-template: [PandaAssembly]
1411        code-template: |
1412          .record R {}
1413          .function void R.constructor(R a0, %s a1) <ctor> {
1414              return.void
1415          }
1416          .function i32 main() {
1417              movi v0, 10
1418              newarr v1, v0, %s
1419              initobj R.constructor, v1
1420        check-type: exit-positive
1421        cases:
1422          - values:
1423            - "u1[]"
1424            - "u1[]"
1425          - values:
1426            - "i8[]"
1427            - "i8[]"
1428          - values:
1429            - "u16[]"
1430            - "u16[]"
1431          - values:
1432            - "i16[]"
1433            - "i16[]"
1434          - values:
1435            - "i32[]"
1436            - "i32[]"
1437          - values:
1438            - "i64[]"
1439            - "i64[]"
1440          - values:
1441            - "f32[]"
1442            - "f32[]"
1443          - values:
1444            - "f64[]"
1445            - "f64[]"
1446          - values:
1447            - "u1[][]"
1448            - "u1[][]"
1449          - values:
1450            - "i8[][]"
1451            - "i8[][]"
1452          - values:
1453            - "u16[][]"
1454            - "u16[][]"
1455          - values:
1456            - "i16[][]"
1457            - "i16[][]"
1458          - values:
1459            - "i32[][]"
1460            - "i32[][]"
1461          - values:
1462            - "i64[][]"
1463            - "i64[][]"
1464          - values:
1465            - "f32[][]"
1466            - "f32[][]"
1467          - values:
1468            - "f64[][]"
1469            - "f64[][]"
1470
1471
1472      - file-name: "compatible_obj_args_p"
1473        isa:
1474          verification:
1475            - compatible_arguments
1476        runner-options: ['verifier-only', 'verifier-config']
1477        tags: [verifier]
1478        description: Check 'initobj' instruction with initializer called with compatible object arguments in PandaAssembly context.
1479        header-template: []
1480        code-template: |
1481          .record panda.Object <external>
1482          .record panda.Class <external>
1483          .record panda.String <external>
1484          .record Q {}
1485          .function void Q.ctor(Q a0) <ctor> {
1486              return.void
1487          }
1488          .record R {}
1489          .function void R.constructor(R a0, %s a1) <ctor> {
1490              return.void
1491          }
1492          .function i32 main() {
1493              %s
1494              initobj R.constructor, v1
1495        check-type: exit-positive
1496        cases:
1497          # Object of type O is instance of type T if O is the same as T ...
1498          - values:
1499            - Q
1500            - |
1501              #
1502                  initobj Q.ctor
1503                  sta.obj v1
1504          - values:
1505            - panda.String
1506            - |
1507              #
1508                  lda.str "test"
1509                  sta.obj v1
1510          - values:
1511            - panda.Class
1512            - |
1513              #
1514                  lda.type Q
1515                  sta.obj v1
1516          # ... or is subtype of T
1517          - values:
1518            - panda.Object
1519            - |
1520              #
1521                  initobj Q.ctor
1522                  sta.obj v1
1523          - values:
1524            - panda.Object
1525            - |
1526              #
1527                  lda.str "test"
1528                  sta.obj v1
1529          - values:
1530            - panda.Object
1531            - |
1532              #
1533                  lda.type Q
1534                  sta.obj v1
1535            id: cls
1536            bugid: ["3594"]
1537            ignore: true
1538          # For arrays T should be a root type in type hierarchy ...
1539          - values:
1540            - panda.Object
1541            - |
1542              #
1543                  movi v0, 10
1544                  newarr v1, v0, i32[]
1545          - values:
1546            - panda.Object
1547            - |
1548              #
1549                  movi v0, 10
1550                  newarr v1, v0, f64[][]
1551          - values:
1552            - panda.Object
1553            - |
1554              #
1555                  movi v0, 10
1556                  newarr v1, v0, Q[]
1557          - values:
1558            - panda.Object
1559            - |
1560              #
1561                  movi v0, 10
1562                  newarr v1, v0, panda.Object[]
1563          - values:
1564            - panda.Object
1565            - |
1566              #
1567                  movi v0, 10
1568                  newarr v1, v0, panda.String[]
1569          - values:
1570            - panda.Object
1571            - |
1572              #
1573                  movi v0, 10
1574                  newarr v1, v0, panda.Class[]
1575
1576
1577      - file-name: "compatible_obj_args_j"
1578        isa:
1579          verification:
1580            - compatible_arguments
1581        runner-options: [verifier-only, use-pa, verifier-config]
1582        tags: [verifier, pa-verifier]
1583        description: Check 'initobj' instruction with initializer called with compatible object arguments in PandaAssembly context.
1584        header-template: [PandaAssembly]
1585        code-template: |
1586          .record panda.Object <external>
1587          .record panda.Class <external>
1588          .record panda.String <external>
1589          .record panda.io.Serializable <external>
1590          .record I <panda.interface> {}
1591          .record E {}
1592          .record Q <panda.extends=E, panda.implements=I> {}
1593          .function void Q.ctor(Q a0) <ctor> {
1594              return.void
1595          }
1596          .record R {}
1597          .function void R.constructor(R a0, %s a1) <ctor> {
1598              return.void
1599          }
1600          .function i32 main() {
1601              %s
1602              initobj R.constructor, v1
1603        check-type: exit-positive
1604        cases:
1605          # Object of type O is instance of type T if O is the same as T ...
1606          - values:
1607            - Q
1608            - |
1609              #
1610                  initobj Q.ctor
1611                  sta.obj v1
1612          - values:
1613            - panda.String
1614            - |
1615              #
1616                  lda.str "test"
1617                  sta.obj v1
1618          - values:
1619            - panda.Class
1620            - |
1621              #
1622                  lda.type Q
1623                  sta.obj v1
1624          # ... or is subtype of T
1625          - values:
1626            - E
1627            - |
1628              #
1629                  initobj Q.ctor
1630                  sta.obj v1
1631          - values:
1632            - I
1633            - |
1634              #
1635                  initobj Q.ctor
1636                  sta.obj v1
1637          - values:
1638            - panda.Object
1639            - |
1640              #
1641                  initobj Q.ctor
1642                  sta.obj v1
1643          - values:
1644            - panda.Object
1645            - |
1646              #
1647                  lda.str "test"
1648                  sta.obj v1
1649          - values:
1650            - panda.io.Serializable
1651            - |
1652              #
1653                  lda.type panda.String
1654                  sta.obj v1
1655            ignore: true
1656            bugid: ['1806']
1657          - values:
1658            - panda.Object
1659            - |
1660              #
1661                  lda.type Q
1662                  sta.obj v1
1663            bugid: ["3594"]
1664            ignore: true
1665          # For arrays T should be a root type in type hierarchy ...
1666          - values:
1667            - panda.Object
1668            - |
1669              #
1670                  movi v0, 10
1671                  newarr v1, v0, i32[]
1672          - values:
1673            - panda.Object
1674            - |
1675              #
1676                  movi v0, 10
1677                  newarr v1, v0, f64[][]
1678          - values:
1679            - panda.Object
1680            - |
1681              #
1682                  movi v0, 10
1683                  newarr v1, v0, Q[]
1684          - values:
1685            - panda.Object
1686            - |
1687              #
1688                  movi v0, 10
1689                  newarr v1, v0, panda.Object[]
1690          - values:
1691            - panda.Object
1692            - |
1693              #
1694                  movi v0, 10
1695                  newarr v1, v0, panda.String[]
1696          - values:
1697            - panda.Object
1698            - |
1699              #
1700                  movi v0, 10
1701                  newarr v1, v0, panda.Class[]
1702
1703
1704      - file-name: "compatible_obj_array_args_p"
1705        isa:
1706          verification:
1707            - compatible_arguments
1708        runner-options: ['verifier-only', 'verifier-config']
1709        tags: [verifier]
1710        description: Check 'initobj' instruction with initializer called with compatible object array arguments in PandaAssembly context.
1711        header-template: []
1712        code-template: |
1713          .record panda.Object <external>
1714          .record panda.Class <external>
1715          .record panda.String <external>
1716          .record Q {}
1717          .record R {}
1718          .function void R.constructor(R a0, %s a1) <ctor> {
1719              return.void
1720          }
1721          .function i32 main() {
1722              movi v0, 10
1723              newarr v1, v0, %s
1724              initobj R.constructor, v1
1725        check-type: exit-positive
1726        cases:
1727          # T is such array that O array elements are the same as T array elements
1728          - values:
1729            - Q[]
1730            - Q[]
1731          - values:
1732            - Q[][]
1733            - Q[][]
1734          - values:
1735            - "panda.Object[]"
1736            - "panda.Object[]"
1737          - values:
1738            - "panda.Object[][]"
1739            - "panda.Object[][]"
1740          - values:
1741            - panda.String[]
1742            - panda.String[]
1743          - values:
1744            - panda.String[][]
1745            - panda.String[][]
1746          - values:
1747            - panda.Class[]
1748            - panda.Class[]
1749          - values:
1750            - panda.Class[][]
1751            - panda.Class[][]
1752          # T is such array that O array elements are subtypes of T array elements
1753          - values:
1754            - "panda.Object[]"
1755            - "panda.Object[][]"
1756            bugid: ["3608"]
1757          - values:
1758            - "panda.Object[]"
1759            - Q[]
1760            bugid: ["3608"]
1761          - values:
1762            - "panda.Object[]"
1763            - Q[][]
1764            bugid: ["3608"]
1765          - values:
1766            - "panda.Object[]"
1767            - panda.Class[]
1768            bugid: ["3608"]
1769          - values:
1770            - "panda.Object[]"
1771            - panda.Class[][]
1772            bugid: ["3608"]
1773          - values:
1774            - "panda.Object[]"
1775            - panda.String[]
1776            bugid: ["3608"]
1777          - values:
1778            - "panda.Object[]"
1779            - panda.String[][]
1780            bugid: ["3608"]
1781          - values:
1782            - "panda.Object[]"
1783            - i32[][]
1784            bugid: ["3608"]
1785          - values:
1786            - "panda.Object[]"
1787            - f64[][][]
1788            bugid: ["3608"]
1789          # inherited types from panda.Object[][]
1790          - values:
1791            - "panda.Object[][]"
1792            - panda.Object[][][]
1793            bugid: ["3608"]
1794          - values:
1795            - "panda.Object[][]"
1796            - panda.Class[][]
1797            bugid: ["3608"]
1798          - values:
1799            - "panda.Object[][]"
1800            - panda.Class[][][]
1801            bugid: ["3608"]
1802          - values:
1803            - "panda.Object[][]"
1804            - i32[][][]
1805            bugid: ["3608"]
1806          - values:
1807            - "panda.Object[][]"
1808            - f64[][][][]
1809            bugid: ["3608"]
1810
1811
1812      - file-name: "compatible_obj_array_args_j"
1813        isa:
1814          verification:
1815            - compatible_arguments
1816        runner-options: [verifier-only, use-pa, verifier-config]
1817        tags: [verifier, pa-verifier]
1818        description: Check 'initobj' instruction with initializer called with compatible object array arguments in PandaAssembly context.
1819        header-template: [PandaAssembly]
1820        code-template: |
1821          .record panda.Object <external>
1822          .record panda.Class <external>
1823          .record panda.String <external>
1824          .record I <panda.interface> {}
1825          .record E {}
1826          .record Q <panda.extends=E, panda.implements=I> {}
1827          .record R {}
1828          .function void R.constructor(R a0, %s a1) <ctor> {
1829              return.void
1830          }
1831          .function i32 main() {
1832              movi v0, 10
1833              newarr v1, v0, %s
1834              initobj R.constructor, v1
1835        check-type: exit-positive
1836        cases:
1837          # T is such array that O array elements are the same as T array elements
1838          - values:
1839            - Q[]
1840            - Q[]
1841          - values:
1842            - Q[][]
1843            - Q[][]
1844          - values:
1845            - "panda.Object[]"
1846            - "panda.Object[]"
1847          - values:
1848            - "panda.Object[][]"
1849            - "panda.Object[][]"
1850          - values:
1851            - panda.String[]
1852            - panda.String[]
1853          - values:
1854            - panda.String[][]
1855            - panda.String[][]
1856          - values:
1857            - panda.Class[]
1858            - panda.Class[]
1859          - values:
1860            - panda.Class[][]
1861            - panda.Class[][]
1862          # T is such array that O array elements are subtypes of T array elements
1863          - values:
1864            - E[]
1865            - Q[]
1866          - values:
1867            - I[]
1868            - Q[]
1869          - values:
1870            - "panda.Object[]"
1871            - "panda.Object[][]"
1872            bugid: ["3608"]
1873          - values:
1874            - "panda.Object[]"
1875            - Q[]
1876            bugid: ["3608"]
1877          - values:
1878            - "panda.Object[]"
1879            - Q[][]
1880            bugid: ["3608"]
1881          - values:
1882            - "panda.Object[]"
1883            - panda.Class[]
1884            bugid: ["3608"]
1885          - values:
1886            - "panda.Object[]"
1887            - panda.Class[][]
1888            bugid: ["3608"]
1889          - values:
1890            - "panda.Object[]"
1891            - panda.String[]
1892            bugid: ["3608"]
1893          - values:
1894            - "panda.Object[]"
1895            - panda.String[][]
1896            bugid: ["3608"]
1897          - values:
1898            - "panda.Object[]"
1899            - i32[][]
1900            bugid: ["3608"]
1901          - values:
1902            - "panda.Object[]"
1903            - f64[][][]
1904            bugid: ["3608"]
1905          # inherited types from object[][]
1906          - values:
1907            - E[][]
1908            - Q[][]
1909          - values:
1910            - I[][]
1911            - Q[][]
1912          - values:
1913            - "panda.Object[][]"
1914            - panda.Object[][][]
1915            bugid: ["3608"]
1916          - values:
1917            - "panda.Object[][]"
1918            - panda.Class[][]
1919            bugid: ["3608"]
1920          - values:
1921            - "panda.Object[][]"
1922            - panda.Class[][][]
1923            bugid: ["3608"]
1924          - values:
1925            - "panda.Object[][]"
1926            - i32[][][]
1927            bugid: ["3608"]
1928          - values:
1929            - "panda.Object[][]"
1930            - f64[][][][]
1931            bugid: ["3608"]
1932
1933
1934      - file-name: "compatible_obj_null_args_p"
1935        isa:
1936          verification:
1937            - compatible_arguments
1938        runner-options: ['verifier-only', 'verifier-config']
1939        tags: [verifier]
1940        description: Check 'initobj' instruction with initializer called with null object ref in PandaAssembly context.
1941        header-template: []
1942        code-template: |
1943          .record panda.Object <external>
1944          .record panda.Class <external>
1945          .record panda.String <external>
1946          .record Q {}
1947          .record R {}
1948          .function void R.constructor(R a0, %s a1) <ctor> {
1949              return.void
1950          }
1951          .function i32 main() {
1952              mov.null v1
1953              initobj R.constructor, v1
1954        check-type: exit-positive
1955        cases:
1956          - values: ["i32[]"]
1957          - values: ["f64[][]"]
1958          - values: ["panda.Object"]
1959          - values: ["panda.Object[]"]
1960          - values: ["panda.Object[][]"]
1961          - values: ["Q"]
1962          - values: ["Q[][]"]
1963          - values: ["panda.String"]
1964          - values: ["panda.String[]"]
1965          - values: ["panda.Class"]
1966          - values: ["panda.Class[]"]
1967
1968
1969      - file-name: "compatible_obj_null_args_j"
1970        isa:
1971          verification:
1972            - compatible_arguments
1973        runner-options: [verifier-only, use-pa, verifier-config]
1974        tags: [verifier, pa-verifier]
1975        description: Check 'initobj' instruction with initializer called with null object ref in PandaAssembly context.
1976        header-template: [PandaAssembly]
1977        code-template: |
1978          .record panda.Object <external>
1979          .record panda.Class <external>
1980          .record panda.String <external>
1981          .record Q {}
1982          .record R {}
1983          .function void R.constructor(R a0, %s a1) <ctor> {
1984              return.void
1985          }
1986          .function i32 main() {
1987              mov.null v1
1988              initobj R.constructor, v1
1989        check-type: exit-positive
1990        cases:
1991          - values: ["i32[]"]
1992          - values: ["f64[][]"]
1993          - values: ["panda.Object"]
1994          - values: ["panda.Object[]"]
1995          - values: ["panda.Object[][]"]
1996          - values: ["Q"]
1997          - values: ["Q[][]"]
1998          - values: ["panda.String"]
1999          - values: ["panda.String[]"]
2000          - values: ["panda.Class"]
2001          - values: ["panda.Class[]"]
2002
2003
2004      - file-name: "valid_instance_p"
2005        isa:
2006          description: |
2007            Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their
2008            default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to
2009            the newly created object into accumulator. method_id should resolve to an initializer.
2010        description: Check 'initobj' with valid method id creates expected instance type in PandaAssembly context.
2011        tags: ['irtoc_ignore']
2012        header-template: []
2013        code-template: |
2014          .record panda.Object <external>
2015          .record panda.String <external>
2016          .record R {}
2017          .function void R.ctor0(R a0) <ctor> {
2018              return.void
2019          }
2020          .function R R.ctor0x(R a0) <ctor> {
2021              lda.null
2022              return.obj
2023          }
2024          .function void R.ctor1(R a0, i32 a1) <ctor> {
2025              return.void
2026          }
2027          .function R[] R.ctor1x(R a0, i32 a1) <ctor> {
2028              movi v0, 10
2029              newarr v0, v0, R[]
2030              lda.obj v0
2031              return.obj
2032          }
2033          .function void R.ctor2(R a0, R a1, i16 a2) <ctor> {
2034              return.void
2035          }
2036          .function R R.ctor2x(R a0, R a1, i16 a2) <ctor> {
2037              lda.null
2038              return.obj
2039          }
2040          .function void R.ctor3(R a0, i32[] a1, R[] a2, i8 a3) <ctor> {
2041              return.void
2042          }
2043          .function panda.Object[] R.ctor3x(R a0, i32[] a1, R[] a2, i8 a3) <ctor> {
2044              movi v0, 10
2045              newarr v0, v0, panda.Object[]
2046              lda.obj v0
2047              return.obj
2048          }
2049          .function void R.ctor4(R a0, R[][] a1, i64 a2, panda.Object a3, f64 a4) <ctor> {
2050              return.void
2051          }
2052          .record panda.NullPointerException <external>
2053          .function void panda.NullPointerException.ctor(panda.NullPointerException a0, panda.String a1, panda.Object a2) <external, ctor>
2054
2055          .function i32 main() {
2056          # sample data to put in arguments: v1 - v5
2057              movi v1, 1
2058              movi.64 v2, 64
2059              fmovi.64 v3, 3.14
2060              mov.null v4
2061              lda.str "message"
2062              sta.obj v5
2063          # create the object
2064              initobj %s
2065              jnez.obj chk1
2066              ldai 1
2067              return
2068          chk1:
2069              sta.obj v0
2070              isinstance %s
2071              jeq v1, chk2
2072              ldai 2
2073              return
2074          chk2:
2075              lda.obj v0
2076              isinstance panda.Object
2077              jeq v1, ok
2078              ldai 3
2079              return
2080          ok:
2081        check-type: exit-positive
2082        cases:
2083          - values:
2084            - R.ctor0
2085            - R
2086          - values:
2087            - R.ctor0x
2088            - R
2089            tags: ['tsan']
2090          - values:
2091            - R.ctor1, v1
2092            - R
2093          - values:
2094            - R.ctor1x, v1
2095            - R
2096          - values:
2097            - R.ctor2, v4, v1
2098            - R
2099            tags: ['tsan']
2100          - values:
2101            - R.ctor2x, v4, v1
2102            - R
2103          - values:
2104            - R.ctor3, v4, v4, v1
2105            - R
2106          - values:
2107            - R.ctor3x, v4, v4, v1
2108            - R
2109          - values:
2110            - R.ctor4, v4, v2, v5, v3
2111            - R
2112            tags: ['tsan']
2113          - values:
2114            - panda.NullPointerException.ctor, v5, v4
2115            - panda.NullPointerException
2116
2117
2118      - file-name: "valid_instance_j"
2119        isa:
2120          description: |
2121            Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their
2122            default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to
2123            the newly created object into accumulator. method_id should resolve to an initializer.
2124        description: Check 'initobj' with valid method id creates expected instance type in PandaAssembly context.
2125        tags: ['irtoc_ignore']
2126        header-template: [PandaAssembly]
2127        runner-options: [use-pa]
2128        code-template: |
2129          .record panda.Object <external>
2130          .record panda.String <external>
2131          .record R {}
2132          .function void R.ctor0(R a0) <ctor> {
2133              return.void
2134          }
2135          .function R R.ctor0x(R a0) <ctor> {
2136              lda.null
2137              return.obj
2138          }
2139          .function void R.ctor1(R a0, i32 a1) <ctor> {
2140              return.void
2141          }
2142          .function R R.ctor1x(R a0, i32 a1) <ctor> {
2143              lda.null
2144              return.obj
2145          }
2146          .function void R.ctor2(R a0, R a1, i16 a2) <ctor> {
2147              return.void
2148          }
2149          .function panda.Object R.ctor2x(R a0, R a1, i16 a2) <ctor> {
2150              lda.null
2151              return.obj
2152          }
2153          .function void R.ctor3(R a0, i32[] a1, R[] a2, i8 a3) <ctor> {
2154              return.void
2155          }
2156          .function panda.Object[] R.ctor3x(R a0, i32[] a1, R[] a2, i8 a3) <ctor> {
2157              movi v0, 10
2158              newarr v0, v0, panda.Object[]
2159              lda.obj v0
2160              return.obj
2161          }
2162          .function void R.ctor4(R a0, R[][] a1, i64 a2, panda.Object a3, f64 a4) <ctor> {
2163              return.void
2164          }
2165          .record panda.NullPointerException <external>
2166          .function void panda.NullPointerException.ctor(panda.NullPointerException a0, panda.String a1) <external, ctor>
2167
2168          .function i32 main() {
2169          # sample data to put in arguments: v1 - v5
2170              movi v1, 1
2171              movi.64 v2, 64
2172              fmovi.64 v3, 3.14
2173              mov.null v4
2174              lda.str "message"
2175              sta.obj v5
2176          # create the object
2177              initobj %s
2178              jnez.obj chk1
2179              ldai 1
2180              return
2181          chk1:
2182              sta.obj v0
2183              isinstance %s
2184              jeq v1, chk2
2185              ldai 2
2186              return
2187          chk2:
2188              lda.obj v0
2189              isinstance panda.Object
2190              jeq v1, ok
2191              ldai 3
2192              return
2193          ok:
2194        check-type: exit-positive
2195        cases:
2196          - values:
2197            - R.ctor0
2198            - R
2199            tags: ['tsan']
2200          - values:
2201            - R.ctor0x
2202            - R
2203          - values:
2204            - R.ctor1, v1
2205            - R
2206          - values:
2207            - R.ctor1x, v1
2208            - R
2209            tags: ['tsan']
2210          - values:
2211            - R.ctor2, v4, v1
2212            - R
2213          - values:
2214            - R.ctor2x, v4, v1
2215            - R
2216          - values:
2217            - R.ctor3, v4, v4, v1
2218            - R
2219            tags: ['tsan']
2220          - values:
2221            - R.ctor3x, v4, v4, v1
2222            - R
2223          - values:
2224            - R.ctor4, v4, v2, v5, v3
2225            - R
2226          - values:
2227            - panda.NullPointerException.ctor, v5
2228            - panda.NullPointerException
2229
2230
2231      - file-name: "check_args_num_p"
2232        isa:
2233          instructions:
2234            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
2235              acc: out:ref
2236              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
2237        description: Check 'initobj' constructor behavior with various number of arguments in PandaAssembly context.
2238        header-template: []
2239        code-template: |
2240          .record R {
2241              i32      f1
2242              i32      f2
2243              i32      f3
2244              i32      f4
2245          }
2246          .function void R.ctor0(R a0) <ctor> {
2247              return.void
2248          }
2249          .function void R.ctor1(R a0, i32 a1) <ctor> {
2250              lda a1
2251              stobj a0, R.f1
2252              return.void
2253          }
2254          .function void R.ctor2(R a0, i32 a1, i32 a2) <ctor> {
2255              lda a1
2256              stobj a0, R.f1
2257              lda a2
2258              stobj a0, R.f2
2259              return.void
2260          }
2261          .function void R.ctor3(R a0, i32 a1, i32 a2, i32 a3) <ctor> {
2262              lda a1
2263              stobj a0, R.f1
2264              lda a2
2265              stobj a0, R.f2
2266              lda a3
2267              stobj a0, R.f3
2268              return.void
2269          }
2270          .function void R.ctor4(R a0, i32 a1, i32 a2, i32 a3, i32 a4) <ctor> {
2271              lda a1
2272              stobj a0, R.f1
2273              lda a2
2274              stobj a0, R.f2
2275              lda a3
2276              stobj a0, R.f3
2277              lda a4
2278              stobj a0, R.f4
2279              return.void
2280          }
2281          .function i32 main() {
2282          # sample data to put in args
2283              movi v1, 10
2284              movi v2, 20
2285              movi v3, 30
2286              movi v4, 40
2287          # create the object
2288              %s
2289              sta.obj v0
2290          lab1:
2291              ldobj v0, R.f1
2292              movi v7, %s
2293              jeq v7, lab2
2294              ldai 1
2295              return
2296          lab2:
2297              ldobj v0, R.f2
2298              movi v7, %s
2299              jeq v7, lab3
2300              ldai 2
2301              return
2302          lab3:
2303              ldobj v0, R.f3
2304              movi v7, %s
2305              jeq v7, lab4
2306              ldai 3
2307              return
2308          lab4:
2309              ldobj v0, R.f4
2310              movi v7, %s
2311              jeq v7, ok
2312              ldai 4
2313              return
2314          ok:
2315        check-type: exit-positive
2316        cases:
2317          - values: ["initobj R.ctor0", 0, 0, 0, 0]
2318          - values: ["initobj R.ctor1, v4", 40, 0, 0, 0]
2319            tags: ['tsan']
2320          - values: ["initobj R.ctor2, v2, v3", 20, 30, 0, 0]
2321          - values: ["initobj R.ctor3, v3, v1, v2", 30, 10, 20, 0]
2322          - values: ["initobj R.ctor4, v1, v3, v2, v1", 10, 30, 20, 10]
2323            tags: ['tsan']
2324
2325
2326      - file-name: "check_args_num_j"
2327        isa:
2328          instructions:
2329            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
2330              acc: out:ref
2331              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
2332        description: Check 'initobj' constructor behavior with various number of arguments in PandaAssembly context.
2333        runner-options: [use-pa]
2334        header-template: [PandaAssembly]
2335        code-template: |
2336          .record R {
2337              i32      f1
2338              i32      f2
2339              i32      f3
2340              i32      f4
2341          }
2342          .function void R.ctor0(R a0) <ctor> {
2343              return.void
2344          }
2345          .function void R.ctor1(R a0, i32 a1) <ctor> {
2346              lda a1
2347              stobj a0, R.f1
2348              return.void
2349          }
2350          .function void R.ctor2(R a0, i32 a1, i32 a2) <ctor> {
2351              lda a1
2352              stobj a0, R.f1
2353              lda a2
2354              stobj a0, R.f2
2355              return.void
2356          }
2357          .function void R.ctor3(R a0, i32 a1, i32 a2, i32 a3) <ctor> {
2358              lda a1
2359              stobj a0, R.f1
2360              lda a2
2361              stobj a0, R.f2
2362              lda a3
2363              stobj a0, R.f3
2364              return.void
2365          }
2366          .function void R.ctor4(R a0, i32 a1, i32 a2, i32 a3, i32 a4) <ctor> {
2367              lda a1
2368              stobj a0, R.f1
2369              lda a2
2370              stobj a0, R.f2
2371              lda a3
2372              stobj a0, R.f3
2373              lda a4
2374              stobj a0, R.f4
2375              return.void
2376          }
2377          .function i32 main() {
2378          # sample data to put in args
2379              movi v1, 10
2380              movi v2, 20
2381              movi v3, 30
2382              movi v4, 40
2383          # create the object
2384              %s
2385              sta.obj v0
2386          lab1:
2387              ldobj v0, R.f1
2388              movi v7, %s
2389              jeq v7, lab2
2390              ldai 1
2391              return
2392          lab2:
2393              ldobj v0, R.f2
2394              movi v7, %s
2395              jeq v7, lab3
2396              ldai 2
2397              return
2398          lab3:
2399              ldobj v0, R.f3
2400              movi v7, %s
2401              jeq v7, lab4
2402              ldai 3
2403              return
2404          lab4:
2405              ldobj v0, R.f4
2406              movi v7, %s
2407              jeq v7, ok
2408              ldai 4
2409              return
2410          ok:
2411        check-type: exit-positive
2412        cases:
2413          - values: ["initobj R.ctor0", 0, 0, 0, 0]
2414            tags: ['tsan']
2415          - values: ["initobj R.ctor1, v4", 40, 0, 0, 0]
2416          - values: ["initobj R.ctor2, v2, v3", 20, 30, 0, 0]
2417          - values: ["initobj R.ctor3, v3, v1, v2", 30, 10, 20, 0]
2418            tags: ['tsan']
2419          - values: ["initobj R.ctor4, v1, v3, v2, v1", 10, 30, 20, 10]
2420
2421
2422      - file-name: "check_all_32bit_types_p"
2423        isa:
2424          instructions:
2425            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
2426              acc: out:ref
2427              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
2428        description: Check 'initobj' constructor behavior with primitive 32bit argument types in PandaAssembly context.
2429        header-template: []
2430        code-template: |
2431          .record Z {
2432              %s    f
2433          }
2434          .function void Z.ctor1(Z a0) <ctor> {
2435              return.void
2436          }
2437          .function void Z.ctor2(Z a0, %s a1) <ctor> {
2438              lda a1
2439              stobj a0, Z.f
2440              return.void
2441          }
2442          .function i32 main() {
2443              initobj Z.ctor1
2444              sta.obj v0
2445              ldobj v0, Z.f
2446              jeqz chk2
2447              ldai 1
2448              return
2449          chk2:
2450              movi v1, %s
2451              initobj Z.ctor2, v1
2452              sta.obj v0
2453              ldobj v0, Z.f
2454              %s
2455              jeqz ok
2456              ldai 2
2457              return
2458          ok:
2459        check-type: exit-positive
2460        cases:
2461          - values:
2462            - u1
2463            - u1
2464            - 1
2465            - |
2466              #
2467                  jne v1, exit_failure
2468                  ldai 0
2469                  return
2470              exit_failure:
2471                  ldai 1
2472                  return
2473          - values:
2474            - u1
2475            - u1
2476            - 0
2477            - |
2478              #
2479                  jne v1, exit_failure
2480                  ldai 0
2481                  return
2482              exit_failure:
2483                  ldai 1
2484                  return
2485          - values: [u8, u8, 0, ucmp v1]
2486          - values: [u8, u8, 0x000000ff, ucmp v1]
2487          - values: [u8, u8, 0x0000005a, ucmp v1]
2488          - values:
2489            - i8
2490            - i8
2491            - 0
2492            - |
2493              #
2494                  jne v1, exit_failure
2495                  ldai 0
2496                  return
2497              exit_failure:
2498                  ldai 1
2499                  return
2500          - values:
2501            - i8
2502            - i8
2503            - 0xffffffff
2504            - |
2505              #
2506                  jne v1, exit_failure
2507                  ldai 0
2508                  return
2509              exit_failure:
2510                  ldai 1
2511                  return
2512          - values:
2513            - i8
2514            - i8
2515            - 0x0000005a
2516            - |
2517              #
2518                  jne v1, exit_failure
2519                  ldai 0
2520                  return
2521              exit_failure:
2522                  ldai 1
2523                  return
2524            tags: ['tsan']
2525          - values: [u16, u16, 0, ucmp v1]
2526          - values: [u16, u16, 0x0000ffff, ucmp v1]
2527          - values: [u16, u16, 0x00005a5a, ucmp v1]
2528          - values:
2529            - i16
2530            - i16
2531            - 0
2532            - |
2533              #
2534                  jne v1, exit_failure
2535                  ldai 0
2536                  return
2537              exit_failure:
2538                  ldai 1
2539                  return
2540          - values:
2541            - i16
2542            - i16
2543            - 0xffffffff
2544            - |
2545              #
2546                  jne v1, exit_failure
2547                  ldai 0
2548                  return
2549              exit_failure:
2550                  ldai 1
2551                  return
2552          - values:
2553            - i16
2554            - i16
2555            - 0x00005a5a
2556            - |
2557              #
2558                  jne v1, exit_failure
2559                  ldai 0
2560                  return
2561              exit_failure:
2562                  ldai 1
2563                  return
2564            tags: ['tsan']
2565          - values: [u32, u32, 0, ucmp v1]
2566          - values: [u32, u32, 0xffffffff, ucmp v1]
2567          - values: [u32, u32, 0x5a5a5a5a, ucmp v1]
2568          - values:
2569            - i32
2570            - i32
2571            - 0
2572            - |
2573              #
2574                  jne v1, exit_failure
2575                  ldai 0
2576                  return
2577              exit_failure:
2578                  ldai 1
2579                  return
2580          - values:
2581            - i32
2582            - i32
2583            - 0xffffffff
2584            - |
2585              #
2586                  jne v1, exit_failure
2587                  ldai 0
2588                  return
2589              exit_failure:
2590                  ldai 1
2591                  return
2592          - values:
2593            - i32
2594            - i32
2595            - 0x5a5a5a5a
2596            - |
2597              #
2598                  jne v1, exit_failure
2599                  ldai 0
2600                  return
2601              exit_failure:
2602                  ldai 1
2603                  return
2604            tags: ['tsan']
2605
2606
2607      - file-name: "check_all_32bit_types_j"
2608        isa:
2609          instructions:
2610            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
2611              acc: out:ref
2612              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
2613        description: Check 'initobj' constructor behavior with primitive 32bit argument types in PandaAssembly context.
2614        runner-options: [use-pa]
2615        header-template: [PandaAssembly]
2616        code-template: |
2617          .record Z {
2618              %s    f
2619          }
2620          .function void Z.ctor1(Z a0) <ctor> {
2621              return.void
2622          }
2623          .function void Z.ctor2(Z a0, %s a1) <ctor> {
2624              lda a1
2625              stobj a0, Z.f
2626              return.void
2627          }
2628          .function i32 main() {
2629              initobj Z.ctor1
2630              sta.obj v0
2631              ldobj v0, Z.f
2632              jeqz chk2
2633              ldai 1
2634              return
2635          chk2:
2636              movi v1, %s
2637              initobj Z.ctor2, v1
2638              sta.obj v0
2639              ldobj v0, Z.f
2640              %s
2641              jeqz ok
2642              ldai 2
2643              return
2644          ok:
2645        check-type: exit-positive
2646        cases:
2647          - values:
2648            - u1
2649            - u1
2650            - 1
2651            - |
2652              #
2653                  jne v1, exit_failure
2654                  ldai 0
2655                  return
2656              exit_failure:
2657                  ldai 1
2658                  return
2659          - values:
2660            - u1
2661            - u1
2662            - 0
2663            - |
2664              #
2665                  jne v1, exit_failure
2666                  ldai 0
2667                  return
2668              exit_failure:
2669                  ldai 1
2670                  return
2671          - values:
2672            - i8
2673            - i8
2674            - 0
2675            - |
2676              #
2677                  jne v1, exit_failure
2678                  ldai 0
2679                  return
2680              exit_failure:
2681                  ldai 1
2682                  return
2683          - values:
2684            - i8
2685            - i8
2686            - 0xffffffff
2687            - |
2688              #
2689                  jne v1, exit_failure
2690                  ldai 0
2691                  return
2692              exit_failure:
2693                  ldai 1
2694                  return
2695          - values:
2696            - i8
2697            - i8
2698            - 0x0000005a
2699            - |
2700              #
2701                  jne v1, exit_failure
2702                  ldai 0
2703                  return
2704              exit_failure:
2705                  ldai 1
2706                  return
2707            tags: ['tsan']
2708          - values: [u16, u16, 0, ucmp v1]
2709          - values: [u16, u16, 0x0000ffff, ucmp v1]
2710          - values: [u16, u16, 0x00005a5a, ucmp v1]
2711            tags: ['tsan']
2712          - values:
2713            - i16
2714            - i16
2715            - 0
2716            - |
2717              #
2718                  jne v1, exit_failure
2719                  ldai 0
2720                  return
2721              exit_failure:
2722                  ldai 1
2723                  return
2724          - values:
2725            - i16
2726            - i16
2727            - 0xffffffff
2728            - |
2729              #
2730                  jne v1, exit_failure
2731                  ldai 0
2732                  return
2733              exit_failure:
2734                  ldai 1
2735                  return
2736          - values:
2737            - i16
2738            - i16
2739            - 0x00005a5a
2740            - |
2741              #
2742                  jne v1, exit_failure
2743                  ldai 0
2744                  return
2745              exit_failure:
2746                  ldai 1
2747                  return
2748          - values:
2749            - i32
2750            - i32
2751            - 0
2752            - |
2753              #
2754                  jne v1, exit_failure
2755                  ldai 0
2756                  return
2757              exit_failure:
2758                  ldai 1
2759                  return
2760          - values:
2761            - i32
2762            - i32
2763            - 0xffffffff
2764            - |
2765              #
2766                  jne v1, exit_failure
2767                  ldai 0
2768                  return
2769              exit_failure:
2770                  ldai 1
2771                  return
2772          - values:
2773            - i32
2774            - i32
2775            - 0x5a5a5a5a
2776            - |
2777              #
2778                  jne v1, exit_failure
2779                  ldai 0
2780                  return
2781              exit_failure:
2782                  ldai 1
2783                  return
2784            tags: ['tsan']
2785
2786
2787      - file-name: "check_int_64bit_types_p"
2788        isa:
2789          instructions:
2790            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
2791              acc: out:ref
2792              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
2793        description: Check 'initobj' constructor behavior with primitive integer 64bit argument types in PandaAssembly context.
2794        tags: ['irtoc_ignore']
2795        header-template: []
2796        code-template: |
2797          .record Z {
2798              %s    f
2799          }
2800          .function void Z.ctor1(Z a0) <ctor> {
2801              return.void
2802          }
2803          .function void Z.ctor2(Z a0, %s a1) <ctor> {
2804              lda.64 a1
2805              stobj.64 a0, Z.f
2806              return.void
2807          }
2808          .function i32 main() {
2809              initobj Z.ctor1
2810              sta.obj v0
2811              ldobj.64 v0, Z.f
2812              movi.64 v1, 0
2813              %s
2814              jeqz chk2
2815              ldai 1
2816              return
2817          chk2:
2818              movi.64 v1, %s
2819              initobj Z.ctor2, v1
2820              sta.obj v0
2821              ldobj.64 v0, Z.f
2822              %s
2823              jeqz ok
2824              ldai 2
2825              return
2826          ok:
2827        check-type: exit-positive
2828        cases:
2829          - values: [u64, u64, ucmp.64 v1, 0, ucmp.64 v1]
2830          - values: [u64, u64, ucmp.64 v1, 0xffffffffffffffff, ucmp.64 v1]
2831            tags: ['tsan']
2832          - values: [u64, u64, ucmp.64 v1, 0x5a5a5a5a5a5a5a5a, ucmp.64 v1]
2833          - values: [i64, i64, ucmp.64 v1, 0, cmp.64 v1]
2834            tags: ['tsan']
2835          - values: [i64, i64, ucmp.64 v1, 0xffffffffffffffff, cmp.64 v1]
2836          - values: [i64, i64, ucmp.64 v1, 0x5a5a5a5a5a5a5a5a, cmp.64 v1]
2837
2838
2839      - file-name: "check_int_64bit_types_j"
2840        isa:
2841          instructions:
2842            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
2843              acc: out:ref
2844              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
2845        description: Check 'initobj' constructor behavior with primitive integer 64bit argument types in PandaAssembly context.
2846        tags: ['irtoc_ignore']
2847        runner-options: [use-pa]
2848        header-template: [PandaAssembly]
2849        code-template: |
2850          .record Z {
2851              %s    f
2852          }
2853          .function void Z.ctor1(Z a0) <ctor> {
2854              return.void
2855          }
2856          .function void Z.ctor2(Z a0, %s a1) <ctor> {
2857              lda.64 a1
2858              stobj.64 a0, Z.f
2859              return.void
2860          }
2861          .function i32 main() {
2862              initobj Z.ctor1
2863              sta.obj v0
2864              ldobj.64 v0, Z.f
2865              movi.64 v1, 0
2866              %s
2867              jeqz chk2
2868              ldai 1
2869              return
2870          chk2:
2871              movi.64 v1, %s
2872              initobj Z.ctor2, v1
2873              sta.obj v0
2874              ldobj.64 v0, Z.f
2875              %s
2876              jeqz ok
2877              ldai 2
2878              return
2879          ok:
2880        check-type: exit-positive
2881        cases:
2882          - values: [i64, i64, ucmp.64 v1, 0, cmp.64 v1]
2883          - values: [i64, i64, ucmp.64 v1, 0xffffffffffffffff, cmp.64 v1]
2884          - values: [i64, i64, ucmp.64 v1, 0x5a5a5a5a5a5a5a5a, cmp.64 v1]
2885            tags: ['tsan']
2886
2887
2888      - file-name: "check_float64_type_p"
2889        isa:
2890          instructions:
2891            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
2892              acc: out:ref
2893              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
2894        description: Check 'initobj' constructor behavior with primitive float argument types in PandaAssembly context.
2895        tags: ['irtoc_ignore']
2896        header-template: []
2897        code-template: |
2898          .record Z {
2899              f64    f
2900          }
2901          .function void Z.ctor1(Z a0) <ctor> {
2902              return.void
2903          }
2904          .function void Z.ctor2(Z a0, f64 a1) <ctor> {
2905              lda.64 a1
2906              stobj.64 a0, Z.f
2907              return.void
2908          }
2909          .function i32 main() {
2910              initobj Z.ctor1
2911              sta.obj v0
2912              ldobj.64 v0, Z.f
2913              fmovi.64 v1, 0.0
2914              fcmpg.64 v1
2915              jeqz chk2
2916              ldai 1
2917              return
2918          chk2:
2919              fmovi.64 v1, %s
2920              initobj Z.ctor2, v1
2921              sta.obj v0
2922              ldobj.64 v0, Z.f
2923              fcmpg.64 v1
2924              jeqz ok
2925              ldai 2
2926              return
2927          ok:
2928        check-type: exit-positive
2929        cases:
2930          - values: [0.0]
2931          - values: [4.625]
2932          - values: [-4.625]
2933          - values: [0xfff0000000000000] # -Inf
2934            tags: ['tsan']
2935          - values: [0x7ff0000000000000] # +Inf
2936          - values: [0x7ff8000000000000]
2937          - values: [0x7ff8000000000010]
2938          - values: [0x7fffffffffffffff]
2939          - values: [0xffffffffffffffff]
2940            tags: ['tsan']
2941
2942      - file-name: "check_float32_type_p"
2943        isa:
2944          instructions:
2945            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
2946              acc: out:ref
2947              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
2948        description: Check 'initobj' constructor behavior with primitive float argument types in PandaAssembly context.
2949        tags: ['irtoc_ignore']
2950        header-template: []
2951        code-template: |
2952          .record Z {
2953              f32    f
2954          }
2955          .function void Z.ctor1(Z a0) <ctor> {
2956              return.void
2957          }
2958          .function void Z.ctor2(Z a0, f32 a1) <ctor> {
2959              lda a1
2960              stobj a0, Z.f
2961              return.void
2962          }
2963          .function i32 main() {
2964              initobj Z.ctor1
2965              sta.obj v0
2966              ldobj v0, Z.f
2967              fmovi v1, 0.0
2968              fcmpg v1
2969              jeqz chk2
2970              ldai 1
2971              return
2972          chk2:
2973              fmovi v1, %s
2974              initobj Z.ctor2, v1
2975              sta.obj v0
2976              ldobj v0, Z.f
2977              fcmpg v1
2978              jeqz ok
2979              ldai 2
2980              return
2981          ok:
2982        check-type: exit-positive
2983        cases:
2984          - values: [0.0]
2985          - values: [4.625]
2986          - values: [-4.625]
2987          - values: [0xff800000] # -Inf
2988          - values: [0x7f800000] # +Inf
2989          - values: [0x7fc00000]
2990          - values: [0x7fc00010]
2991          - values: [0x7fffffff]
2992          - values: [0xffffffff]
2993            tags: ['tsan']
2994
2995      - file-name: "check_float64_type_j"
2996        isa:
2997          instructions:
2998            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
2999              acc: out:ref
3000              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
3001        description: Check 'initobj' constructor behavior with primitive float argument types in PandaAssembly context.
3002        tags: ['irtoc_ignore']
3003        runner-options: [use-pa]
3004        header-template: [PandaAssembly]
3005        code-template: |
3006          .record Z {
3007              f64    f
3008          }
3009          .function void Z.ctor1(Z a0) <ctor> {
3010              return.void
3011          }
3012          .function void Z.ctor2(Z a0, f64 a1) <ctor> {
3013              lda.64 a1
3014              stobj.64 a0, Z.f
3015              return.void
3016          }
3017          .function i32 main() {
3018              initobj Z.ctor1
3019              sta.obj v0
3020              ldobj.64 v0, Z.f
3021              fmovi.64 v1, 0.0
3022              fcmpg.64 v1
3023              jeqz chk2
3024              ldai 1
3025              return
3026          chk2:
3027              fmovi.64 v1, %s
3028              initobj Z.ctor2, v1
3029              sta.obj v0
3030              ldobj.64 v0, Z.f
3031              fcmpg.64 v1
3032              jeqz ok
3033              ldai 2
3034              return
3035          ok:
3036        check-type: exit-positive
3037        cases:
3038          - values: [0.0]
3039          - values: [4.625]
3040          - values: [-4.625]
3041          - values: [0xfff0000000000000] # -Inf
3042          - values: [0x7ff0000000000000] # +Inf
3043          - values: [0x7ff8000000000000]
3044          - values: [0x7ff8000000000010]
3045          - values: [0x7fffffffffffffff]
3046          - values: [0xffffffffffffffff]
3047
3048      - file-name: "check_float32_type_j"
3049        isa:
3050          instructions:
3051            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
3052              acc: out:ref
3053              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
3054        description: Check 'initobj' constructor behavior with primitive float argument types in PandaAssembly context.
3055        tags: ['irtoc_ignore']
3056        runner-options: [use-pa]
3057        header-template: [PandaAssembly]
3058        code-template: |
3059          .record Z {
3060              f32    f
3061          }
3062          .function void Z.ctor1(Z a0) <ctor> {
3063              return.void
3064          }
3065          .function void Z.ctor2(Z a0, f32 a1) <ctor> {
3066              lda a1
3067              stobj a0, Z.f
3068              return.void
3069          }
3070          .function i32 main() {
3071              initobj Z.ctor1
3072              sta.obj v0
3073              ldobj v0, Z.f
3074              fmovi v1, 0.0
3075              fcmpg v1
3076              jeqz chk2
3077              ldai 1
3078              return
3079          chk2:
3080              fmovi v1, %s
3081              initobj Z.ctor2, v1
3082              sta.obj v0
3083              ldobj v0, Z.f
3084              fcmpg v1
3085              jeqz ok
3086              ldai 2
3087              return
3088          ok:
3089        check-type: exit-positive
3090        cases:
3091          - values: [0.0]
3092          - values: [4.625]
3093            tags: ['tsan']
3094          - values: [-4.625]
3095            tags: ['tsan']
3096          - values: [0xff800000] # -Inf
3097          - values: [0x7f800000] # +Inf
3098          - values: [0x7fc00000]
3099          - values: [0x7fc00010]
3100          - values: [0x7fffffff]
3101          - values: [0xffffffff]
3102
3103      - file-name: "check_obj_types_p"
3104        isa:
3105          instructions:
3106            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
3107              acc: out:ref
3108              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
3109        description: Check 'initobj' constructor behavior with several object type arguments in PandaAssembly context.
3110        header-template: []
3111        code-template: |
3112          .record panda.Object <external>
3113          .record panda.Class <external>
3114          .record panda.String <external>
3115          .record Z {
3116              %s    f
3117          }
3118          .function void Z.ctor1(Z a0) <ctor> {
3119              return.void
3120          }
3121          .function void Z.ctor2(Z a0, %s a1) <ctor> {
3122              lda.obj a1
3123              stobj.obj a0, Z.f
3124              return.void
3125          }
3126          .function i32 main() {
3127              initobj Z.ctor1
3128              sta.obj v0
3129              ldobj.obj v0, Z.f
3130              jeqz.obj chk2
3131              ldai 1
3132              return
3133          chk2:
3134              %s
3135              sta.obj v1
3136              initobj Z.ctor2, v1
3137              sta.obj v0
3138              ldobj.obj v0, Z.f
3139              jeq.obj v1, ok
3140              ldai 2
3141              return
3142          ok:
3143        check-type: exit-positive
3144        cases:
3145          - values: [panda.String, panda.String, lda.str "test"]
3146          - values: [panda.Object, panda.String, lda.str "test"]
3147          - values: [panda.Class, panda.Class, lda.type Z]
3148          - values:
3149            - panda.Object
3150            - panda.Class
3151            - lda.type Z
3152            bugid: ["3594"]
3153          - values: [panda.Object, panda.Object, initobj Z.ctor1]
3154          - values: [panda.String, panda.String, lda.null]
3155          - values:
3156            - "i32[]"
3157            - "i32[]"
3158            - |
3159              #
3160                  movi v7, 10
3161                  newarr v7, v7, i32[]
3162                  lda.obj v7
3163          - values:
3164            - "i64[]"
3165            - "i64[]"
3166            - |
3167              #
3168                  movi v7, 10
3169                  newarr v7, v7, i64[]
3170                  lda.obj v7
3171          - values:
3172            - "panda.String[]"
3173            - "panda.String[]"
3174            - |
3175              #
3176                  movi v7, 10
3177                  newarr v7, v7, panda.String[]
3178                  lda.obj v7
3179          - values:
3180            - Z[]
3181            - Z[]
3182            - |
3183              #
3184                  movi v7, 10
3185                  newarr v7, v7, Z[]
3186                  lda.obj v7
3187            tags: ['tsan']
3188          - values:
3189            - panda.Object
3190            - u1[]
3191            - |
3192              #
3193                  movi v7, 10
3194                  newarr v7, v7, u1[]
3195                  lda.obj v7
3196          - values:
3197            - panda.Object
3198            - panda.Object[]
3199            - |
3200              #
3201                  movi v7, 10
3202                  newarr v7, v7, Z[]
3203                  lda.obj v7
3204            bugid: ['3608']
3205          - values:
3206            - panda.Object[]
3207            - panda.Object[]
3208            - |
3209              #
3210                  movi v7, 10
3211                  newarr v7, v7, Z[][]
3212                  lda.obj v7
3213            bugid: ['3608']
3214            tags: ['tsan']
3215
3216
3217      - file-name: "check_obj_types_j"
3218        isa:
3219          instructions:
3220            - sig: initobj method_id, v1:in:none, v2:in:none, v3:in:none, v4:in:none
3221              acc: out:ref
3222              format: [op_v1_4_v2_4_v3_4_v4_4_id_16]
3223        description: Check 'initobj' constructor behavior with several object type arguments in PandaAssembly context.
3224        runner-options: [use-pa]
3225        header-template: [PandaAssembly]
3226        code-template: |
3227          .record panda.Object <external>
3228          .record panda.Class <external>
3229          .record panda.String <external>
3230          .record Z {
3231              %s    f
3232          }
3233          .function void Z.ctor1(Z a0) <ctor> {
3234              return.void
3235          }
3236          .function void Z.ctor2(Z a0, %s a1) <ctor> {
3237              lda.obj a1
3238              stobj.obj a0, Z.f
3239              return.void
3240          }
3241          .function i32 main() {
3242              initobj Z.ctor1
3243              sta.obj v0
3244              ldobj.obj v0, Z.f
3245              jeqz.obj chk2
3246              ldai 1
3247              return
3248          chk2:
3249              %s
3250              sta.obj v1
3251              initobj Z.ctor2, v1
3252              sta.obj v0
3253              ldobj.obj v0, Z.f
3254              jeq.obj v1, ok
3255              ldai 2
3256              return
3257          ok:
3258        check-type: exit-positive
3259        cases:
3260          - values: [panda.String, panda.String, lda.str "test"]
3261          - values: [panda.Object, panda.String, lda.str "test"]
3262          - values: [panda.Class, panda.Class, lda.type Z]
3263          - values: [panda.Object, panda.Class, lda.type Z]
3264          - values: [panda.Object, panda.Object, initobj Z.ctor1]
3265          - values: [panda.String, panda.String, lda.null]
3266          - values:
3267            - "i32[]"
3268            - "i32[]"
3269            - |
3270              #
3271                  movi v7, 10
3272                  newarr v7, v7, i32[]
3273                  lda.obj v7
3274            tags: ['tsan']
3275          - values:
3276            - "i64[]"
3277            - "i64[]"
3278            - |
3279              #
3280                  movi v7, 10
3281                  newarr v7, v7, i64[]
3282                  lda.obj v7
3283          - values:
3284            - "panda.String[]"
3285            - "panda.String[]"
3286            - |
3287              #
3288                  movi v7, 10
3289                  newarr v7, v7, panda.String[]
3290                  lda.obj v7
3291            tags: ['tsan']
3292          - values:
3293            - Z[]
3294            - Z[]
3295            - |
3296              #
3297                  movi v7, 10
3298                  newarr v7, v7, Z[]
3299                  lda.obj v7
3300          - values:
3301            - panda.Object
3302            - u1[]
3303            - |
3304              #
3305                  movi v7, 10
3306                  newarr v7, v7, u1[]
3307                  lda.obj v7
3308          - values:
3309            - panda.Object
3310            - panda.Object
3311            - |
3312              #
3313                  movi v7, 10
3314                  newarr v7, v7, Z[]
3315                  lda.obj v7
3316          - values:
3317            - panda.Object
3318            - panda.Object[]
3319            - |
3320              #
3321                  movi v7, 10
3322                  newarr v7, v7, panda.String[]
3323                  lda.obj v7
3324          - values:
3325            - panda.Object[]
3326            - panda.Object[]
3327            - |
3328              #
3329                  movi v7, 10
3330                  newarr v7, v7, panda.String[][]
3331                  lda.obj v7
3332            tags: ['tsan']
3333            bugid: ['3608']
3334
3335
3336      - file-name: 'oome_p'
3337        isa:
3338          exceptions:
3339            - x_oom
3340        description: Create objects with 'initobj' instruction until OutOfMemoryError in PandaAssembly context
3341        tags: ['irtoc_ignore']
3342        header-template: []
3343        panda-options: "--heap-size-limit=67108864"
3344        bugid: ['3578', '4170', '4171']
3345        code-template: |
3346          .record panda.OutOfMemoryError <external>
3347          .record Z {
3348          %s
3349          }
3350          .function void Z.ctor(Z a0) <ctor> {
3351              return.void
3352          }
3353          .function i32 main() {
3354              movi v7, 50000   # array size
3355              newarr v6, v7, Z[]       # array ref
3356              movi v1, 0       # index
3357          begin:
3358              initobj Z.ctor
3359              starr.obj v6, v1
3360              inci v1, 1
3361              lda v1
3362              jlt v7, begin
3363          end:
3364              ldai 1 # Should not reach this line
3365              return
3366
3367          catch_OOME:
3368              ldai 0 # Expected panda.OutOfMemoryError
3369              return
3370
3371          catch_all:
3372              ldai 2 # Unexpected exception, test failed
3373              return
3374
3375          .catch panda.OutOfMemoryError, begin, end, catch_OOME
3376          .catchall begin, end, catch_all
3377        check-type: none
3378        cases:
3379          - values:
3380            - "#{[*1..500].map do |i| \"    f64   f#{i}\\n\" end .join}"
3381            tags: ['tsan']
3382
3383
3384      - file-name: 'oome_j'
3385        isa:
3386          exceptions:
3387            - x_oom
3388        description: Create objects with 'initobj' instruction until OutOfMemoryError in PandaAssembly context
3389        tags: ['irtoc_ignore']
3390        runner-options: [use-pa]
3391        header-template: [PandaAssembly]
3392        panda-options: "--heap-size-limit=67108864"
3393        bugid: ['3578', '4171', '6147']
3394        code-template: |
3395          .record panda.OutOfMemoryError <external>
3396          .record Z {
3397          %s
3398          }
3399          .function void Z.ctor(Z a0) <ctor> {
3400              return.void
3401          }
3402          .function i32 main() {
3403              movi v7, 50000   # array size
3404              newarr v6, v7, Z[]       # array ref
3405              movi v1, 0       # index
3406          begin:
3407              initobj Z.ctor
3408              starr.obj v6, v1
3409              inci v1, 1
3410              lda v1
3411              jlt v7, begin
3412          end:
3413              ldai 1 # Should not reach this line
3414              return
3415
3416          catch_OOME:
3417              ldai 0 # Expected panda.OutOfMemoryError
3418              return
3419
3420          catch_all:
3421              ldai 2 # Unexpected exception, test failed
3422              return
3423
3424          .catch panda.OutOfMemoryError, begin, end, catch_OOME
3425          .catchall begin, end, catch_all
3426        check-type: none
3427        cases:
3428          - values:
3429            - "#{[*1..500].map do |i| \"    f64   f#{i}\\n\" end .join}"
3430            tags: ['tsan']
3431
3432
3433      - file-name: 'ame_p'
3434        isa:
3435          exceptions:
3436            - x_abstract
3437        description: Create objects with 'initobj' instruction with AbstractMethodError in PandaAssembly context
3438        header-template: []
3439        tags: ['irtoc_ignore']
3440        bugid: ['3625']
3441        code-template: |
3442          .record panda.AbstractMethodError <external>
3443          .record Z {}
3444          .function void Z.ctor0(Z a0) <ctor, noimpl>
3445          .function void Z.ctor4(Z a0, i32 a1, i32 a2, i32 a3, i32 a4) <ctor, noimpl>
3446          .function i32 main() {
3447          begin:
3448              %s
3449              initobj %s
3450          end:
3451              ldai 1 # Should not reach this line
3452              return
3453
3454          catch_AME:
3455              ldai 0 # Expected panda.AbstractMethodError
3456              return
3457
3458          catch_all:
3459              ldai 2 # Unexpected exception, test failed
3460              return
3461
3462          .catch panda.AbstractMethodError, begin, end, catch_AME
3463          .catchall begin, end, catch_all
3464        check-type: none
3465        cases:
3466          - values:
3467            - ""
3468            - Z.ctor0
3469            tags: ['tsan']
3470          - values:
3471            - |
3472              #
3473                  movi v1, 10
3474                  movi v2, 20
3475                  movi v3, 30
3476                  movi v4, 40
3477            - Z.ctor4, v1, v2, v3, v4
3478
3479
3480      - file-name: 'ame_j'
3481        isa:
3482          exceptions:
3483            - x_abstract
3484        description: Create objects with 'initobj' instruction with AbstractMethodError in PandaAssembly context
3485        header-template: [PandaAssembly]
3486        tags: ['irtoc_ignore']
3487        runner-options: [use-pa]
3488        bugid: ['3625']
3489        code-template: |
3490          .record panda.AbstractMethodError <external>
3491          .record Z {}
3492          .function void Z.ctor0(Z a0) <ctor, noimpl>
3493          .function void Z.ctor4(Z a0, i32 a1, i32 a2, i32 a3, i32 a4) <ctor, noimpl>
3494          .function i32 main() {
3495          begin:
3496              %s
3497              initobj %s
3498          end:
3499              ldai 1 # Should not reach this line
3500              return
3501
3502          catch_AME:
3503              ldai 0 # Expected panda.AbstractMethodError
3504              return
3505
3506          catch_all:
3507              ldai 2 # Unexpected exception, test failed
3508              return
3509
3510          .catch panda.AbstractMethodError, begin, end, catch_AME
3511          .catchall begin, end, catch_all
3512        check-type: none
3513        cases:
3514          - values:
3515            - ""
3516            - Z.ctor0
3517          - values:
3518            - |
3519              #
3520                  movi v1, 10
3521                  movi v2, 20
3522                  movi v3, 30
3523                  movi v4, 40
3524            - Z.ctor4, v1, v2, v3, v4
3525            tags: ['tsan']
3526
3527      - file-name: 'x_call_j'
3528        isa:
3529          exceptions:
3530            - x_call
3531        description: Create objects with 'initobj' instruction with Exception in PandaAssembly context
3532        header-template: [PandaAssembly]
3533        tags: ['irtoc_ignore']
3534        runner-options: [use-pa]
3535        code-template: |
3536          .record panda.Throwable <external>
3537          .record E1 <panda.extends=panda.Throwable> {}
3538          .record Z {}
3539          .function void Z.ctor1(Z a0) <ctor> {
3540              newobj v0, E1
3541              throw v0
3542              return.void
3543          }
3544          .function i32 main() {
3545              jmp try_begin
3546          catch_E1:
3547              ldai 0
3548              return
3549          try_begin:
3550              initobj Z.ctor1
3551              sta.obj v0
3552          try_end:
3553          .catch E1, try_begin, try_end, catch_E1
3554              ldai 1
3555              return
3556        check-type: none
3557
3558      - file-name: "regs_restored_p"
3559        isa:
3560          description: |
3561            Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their
3562            default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to
3563            the newly created object into accumulator. method_id should resolve to an initializer.
3564        description: Check 'initobj' that registers are restored after the initializer call PandaAssembly context.
3565        header-template: []
3566        code-template: |
3567          .record R {}
3568          .function void R.ctor4(R a0, i16 a1, i32 a2, i16 a3, i32 a4) <ctor> {
3569              movi a1, -100
3570              movi a2, -200
3571              movi a3, -300
3572              movi a4, -400
3573              movi v0, 100
3574              movi v1, 200
3575              movi v2, 300
3576              movi v3, 400
3577              movi v4, 500
3578              movi v5, 600
3579              movi v6, 700
3580              movi v7, 800
3581              movi v8, 900
3582              movi v9, 1000
3583              movi v10, 1100
3584              movi v11, 1200
3585              movi v12, 1300
3586              movi v13, 1400
3587              movi v14, 1500
3588              movi v15, 1600
3589              return.void
3590          }
3591          .function i32 main() {
3592              movi v0, 1
3593              movi v1, 2
3594              movi v2, 3
3595              movi v3, 4
3596              movi v4, 5
3597              movi v5, 6
3598              movi v6, 7
3599              movi v7, 8
3600              movi v8, 9
3601              movi v9, 10
3602              movi v10, 11
3603              movi v11, 12
3604              movi v12, 13
3605              movi v13, 14
3606              movi v14, 15
3607              movi v15, 16
3608              initobj R.ctor4, v1, v2, v3, v4
3609              initobj R.ctor4, v5, v6, v7, v8
3610              initobj R.ctor4, v9, v10, v11, v12
3611              initobj R.ctor4, v13, v14, v15, v0
3612              ldai 1
3613              jeq v0, ok1
3614              return
3615          ok1:
3616              ldai 2
3617              jeq v1, ok2
3618              return
3619          ok2:
3620              ldai 3
3621              jeq v2, ok3
3622              return
3623          ok3:
3624              ldai 4
3625              jeq v3, ok4
3626              return
3627          ok4:
3628              ldai 5
3629              jeq v4, ok5
3630              return
3631          ok5:
3632              ldai 6
3633              jeq v5, ok6
3634              return
3635          ok6:
3636              ldai 7
3637              jeq v6, ok7
3638              return
3639          ok7:
3640              ldai 8
3641              jeq v7, ok8
3642              return
3643          ok8:
3644              ldai 9
3645              jeq v8, ok9
3646              return
3647          ok9:
3648              ldai 10
3649              jeq v9, ok10
3650              return
3651          ok10:
3652              ldai 11
3653              jeq v10, ok11
3654              return
3655          ok11:
3656              ldai 12
3657              jeq v11, ok12
3658              return
3659          ok12:
3660              ldai 13
3661              jeq v12, ok13
3662              return
3663          ok13:
3664              ldai 14
3665              jeq v13, ok14
3666              return
3667          ok14:
3668              ldai 15
3669              jeq v14, ok15
3670              return
3671          ok15:
3672              ldai 16
3673              jeq v15, ok16
3674              return
3675          ok16:
3676        check-type: exit-positive
3677
3678
3679      - file-name: "regs_restored_j"
3680        isa:
3681          description: |
3682            Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their
3683            default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to
3684            the newly created object into accumulator. method_id should resolve to an initializer.
3685        description: Check 'initobj' that registers are restored after the initializer call PandaAssembly context.
3686        header-template: [PandaAssembly]
3687        tags: ['tsan']
3688        runner-options: [use-pa]
3689        code-template: |
3690          .record R {}
3691          .function void R.ctor4(R a0, i16 a1, i32 a2, i16 a3, i32 a4) <ctor> {
3692              movi a1, -100
3693              movi a2, -200
3694              movi a3, -300
3695              movi a4, -400
3696              movi v0, 100
3697              movi v1, 200
3698              movi v2, 300
3699              movi v3, 400
3700              movi v4, 500
3701              movi v5, 600
3702              movi v6, 700
3703              movi v7, 800
3704              movi v8, 900
3705              movi v9, 1000
3706              movi v10, 1100
3707              movi v11, 1200
3708              movi v12, 1300
3709              movi v13, 1400
3710              movi v14, 1500
3711              movi v15, 1600
3712              return.void
3713          }
3714          .function i32 main() {
3715              movi v0, 1
3716              movi v1, 2
3717              movi v2, 3
3718              movi v3, 4
3719              movi v4, 5
3720              movi v5, 6
3721              movi v6, 7
3722              movi v7, 8
3723              movi v8, 9
3724              movi v9, 10
3725              movi v10, 11
3726              movi v11, 12
3727              movi v12, 13
3728              movi v13, 14
3729              movi v14, 15
3730              movi v15, 16
3731              initobj R.ctor4, v1, v2, v3, v4
3732              initobj R.ctor4, v5, v6, v7, v8
3733              initobj R.ctor4, v9, v10, v11, v12
3734              initobj R.ctor4, v13, v14, v15, v0
3735              ldai 1
3736              jeq v0, ok1
3737              return
3738          ok1:
3739              ldai 2
3740              jeq v1, ok2
3741              return
3742          ok2:
3743              ldai 3
3744              jeq v2, ok3
3745              return
3746          ok3:
3747              ldai 4
3748              jeq v3, ok4
3749              return
3750          ok4:
3751              ldai 5
3752              jeq v4, ok5
3753              return
3754          ok5:
3755              ldai 6
3756              jeq v5, ok6
3757              return
3758          ok6:
3759              ldai 7
3760              jeq v6, ok7
3761              return
3762          ok7:
3763              ldai 8
3764              jeq v7, ok8
3765              return
3766          ok8:
3767              ldai 9
3768              jeq v8, ok9
3769              return
3770          ok9:
3771              ldai 10
3772              jeq v9, ok10
3773              return
3774          ok10:
3775              ldai 11
3776              jeq v10, ok11
3777              return
3778          ok11:
3779              ldai 12
3780              jeq v11, ok12
3781              return
3782          ok12:
3783              ldai 13
3784              jeq v12, ok13
3785              return
3786          ok13:
3787              ldai 14
3788              jeq v13, ok14
3789              return
3790          ok14:
3791              ldai 15
3792              jeq v14, ok15
3793              return
3794          ok15:
3795              ldai 16
3796              jeq v15, ok16
3797              return
3798          ok16:
3799        check-type: exit-positive
3800
3801
3802      - file-name: "valid_static_initializer_p"
3803        isa:
3804          description: |
3805            Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their
3806            default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to
3807            the newly created object into accumulator. method_id should resolve to an initializer.
3808        description: Check 'initobj' with static initializer in PandaAssembly context.
3809        header-template: []
3810        tags: ['tsan']
3811        code-template: |
3812          .record R {
3813              i32   cnt   <static>
3814          }
3815          .function void R.ctor(R a0) <ctor> {
3816              ldstatic R.cnt
3817              addi 1
3818              ststatic R.cnt
3819              return.void
3820          }
3821          .function void R.cctor() <cctor> {
3822              ldstatic R.cnt
3823              addi 1
3824              ststatic R.cnt
3825              return.void
3826          }
3827          .function i32 main() {
3828              initobj R.ctor
3829              initobj R.ctor
3830              ldstatic R.cnt
3831              movi v0, 3
3832              jeq v0, ok
3833              ldai 20
3834              return
3835          ok:
3836        check-type: exit-positive
3837
3838
3839      - file-name: "valid_static_initializer_j"
3840        isa:
3841          description: |
3842            Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their
3843            default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to
3844            the newly created object into accumulator. method_id should resolve to an initializer.
3845        description: Check 'initobj' with static initializer in PandaAssembly context.
3846        runner-options: [use-pa]
3847        header-template: [PandaAssembly]
3848        code-template: |
3849          .record R {
3850              i32   cnt   <static>
3851          }
3852          .function void R.cctor() <cctor> {
3853              ldstatic R.cnt
3854              addi 1
3855              ststatic R.cnt
3856              return.void
3857          }
3858          .function void R.ctor(R a0) <ctor> {
3859              ldstatic R.cnt
3860              addi 1
3861              ststatic R.cnt
3862              return.void
3863          }
3864          .record Q <panda.extends=R> {}
3865          .function void Q.ctor(Q a0) <ctor> {
3866              ldstatic R.cnt
3867              addi 1
3868              ststatic R.cnt
3869              return.void
3870          }
3871          .function i32 main() {
3872              initobj Q.ctor
3873              initobj Q.ctor
3874              ldstatic R.cnt
3875              movi v0, 3
3876              jeq v0, ok
3877              ldai 20
3878              return
3879          ok:
3880        check-type: exit-positive
3881
3882