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