# Copyright (c) 2021-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. definitions: - name: PandaAssembly template: | .language PandaAssembly tests: - file-name: "initobj.short" isa: title: Create new object and call initializer description: | Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to the newly created object into accumulator. method_id should resolve to an initializer. Non-range instructions can be used to pass up to 4 arguments. Unused register slot values will be discarded and corresponding registers will not be passed to initializer). instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] commands: - file-name: "invalid_syntax" isa: verification: - method_id_non_static - method_id_accessible - method_init_obj runner-options: [compile-failure] description: Check 'initobj.short' instruction with invalid method id. header-template: [] code-template: | .record A { i32 f32 A fA i32[] f32Array A[] fAArray } .function void A.c2(A a0, u32 a1, u32 a2) { return.void } .function void A.c1(A a0, u64 a1) { return.void } .function void A.c0(A a0) { return.void } .function void A.aFunc(A a0) { return.void } .function i32 main() { begin: initobj.short %s check-type: exit-positive cases: - values: - "" - values: - "label:" - values: - "begin" - values: - "{}" - values: - "}" - values: - "# comment" - values: - "null" - values: - "0" - values: - "v0" - values: - "i32" - values: - i32[] - values: - "\"A\"" - values: - A - values: - "A.f32" - values: - "A.fA" - values: - "A.f32Array" - values: - "A.fAArray" - values: - "A[]" - values: - "panda.Object[]" - values: - "aFunc, v1" - values: - "Object" - values: - A.c2, v1, v2, v3 - values: - A.c2, v1 ignore: true bugid: ['1956','1304'] - values: - A.c2, a1, a2 - values: - A.c2, 0, 1 - values: - A.c1 ignore: true bugid: ['1956','1304'] - values: - A.c1, a1, a2, a3 - values: - A.c1, , , - file-name: "uninitialized_regs_p" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] runner-options: ['verifier-failure', 'verifier-config'] tags: [verifier] description: Check 'initobj.short' instruction with uninitialized registers in PandaAssembly context. header-template: [] code-template: | .record panda.Object .record panda.String .record R {} .function void R.ctor(R a0%s) { return.void } .function i32 main() { %s check-type: exit-positive cases: - values: # v1 not initialized - ", i32 a1" - initobj.short R.ctor, v1 - values: # v2 not initialized - ", i64 a1, f64 a2" - | # movi.64 v1, 1 initobj.short R.ctor, v1, v2 - values: # v1, v2 not initialized - ", u1 a1, u8 a2" - initobj.short R.ctor, v1, v2 - values: # v2 not initialized but not used - ", f64[] a1" - | # movi v0, 10 newarr v1, v0, f64[] initobj.short R.ctor, v1, v2 runner-options: ['verifier-only', 'verifier-config'] - values: # v4, v3 not initialized but not used - "" - initobj.short R.ctor, v4, v3 runner-options: ['verifier-only', 'verifier-config'] - file-name: "uninitialized_regs_j" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] runner-options: [verifier-failure, use-pa, verifier-config] tags: [verifier, pa-verifier] description: Check 'initobj.short' instruction with uninitialized registers in PandaAssembly context. header-template: [PandaAssembly] bugid: ["5271"] code-template: | .record panda.Object .record panda.String .record R {} %s .function i32 main() { %s check-type: exit-positive cases: - values: # v5 not initialized - | .function void R.ctor(R a0, i32 a1) { return.void } - initobj.short R.ctor, v5 - values: # v10 not initialized - | .function void R.ctor(R a0, i64 a1, f64 a2) { return.void } - | # fmovi.64 v1, 1.0 initobj.short R.ctor, v10, v1 - values: # v1, v4 not initialized - | .function void R.ctor(R a0, u1 a1, i8 a2) { return.void } - initobj.short R.ctor, v1, v4 - values: # v4 not initialized but not used - | .function void R.ctor(R a0, panda.String a1) { return.void } - | # lda.str "test" sta.obj v11 initobj.short R.ctor, v11, v4 runner-options: [verifier-only, use-pa, verifier-config] - values: # v3, v4 not initialized but not used - | .record panda.NullPointerException .function void panda.NullPointerException.ctor1(panda.NullPointerException a0) - | # initobj.short panda.NullPointerException.ctor1, v3, v4 runner-options: [verifier-only, use-pa, verifier-config] - values: # v1 is not initialized - | .record panda.NullPointerException .function void panda.NullPointerException.ctor2(panda.NullPointerException a0, panda.String a1) - | # initobj.short panda.NullPointerException.ctor2, v1, v2 - file-name: "reg_v_invalid" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] runner-options: [compile-failure] description: Check 'initobj.short' instruction with invalid 'v' register numbers. header-template: [] code-template: | .record R {} .function void R.c(R a0, i32 a1, i32 a2) { return.void } # .function i32 main() { initobj.short R.c, %s check-type: exit-positive cases: - values: - "v16, v1" - values: - "v0, v255" - values: - "v256, v3" - values: - "v2, v65535" - values: - "v65536, v1" - file-name: "reg_a_invalid" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] runner-options: [compile-failure] description: Check 'initobj.short' instruction with invalid 'a' register numbers. header-template: [] code-template: | .record R {} .function void R.c(R a0, i32 a1, i32 a2) { return.void } .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) { initobj.short R.c, %s return.void } # .function i32 main() { call.range func, v0 check-type: exit-positive cases: - values: - "a16, a15" - values: - "a0, a255" - values: - "a256, a7" - values: - "a0, a65535" - values: - "a65536, a1" - file-name: "reg_v_valid" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' instruction with valid 'v' register numbers. header-template: [] code-template: | .record R {} .function void R.c(R a0, i32 a1, i32 a2) { return.void } # .function i32 main() { movi %s, 100 movi %s, 200 lda.null initobj.short R.c, %s, %s jnez.obj ok ldai 1 return ok: check-type: exit-positive cases: - values: [v0, v1, v0, v1] - values: [v2, v3, v2, v3] - values: [v4, v5, v4, v5] - values: [v6, v7, v6, v7] - values: [v8, v9, v8, v9] - values: [v10, v11, v10, v11] - values: [v12, v13, v12, v13] - values: [v14, v15, v14, v15] - file-name: "reg_a_valid" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] runner-options: ['verifier-only', 'verifier-config'] tags: ['verifier'] description: Check 'initobj.short' instruction with valid 'a' register numbers. header-template: [] code-template: | .record R {} .function void R.c(R a0, i32 a1, i32 a2) { return.void } .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) { initobj.short R.c, a0, a1 initobj.short R.c, a2, a3 initobj.short R.c, a4, a5 initobj.short R.c, a6, a7 initobj.short R.c, a8, a9 initobj.short R.c, a10, a11 initobj.short R.c, a12, a13 initobj.short R.c, a14, a15 return.void } # .function i32 main() { movi v0, 0 movi v1, 1 movi v2, 2 movi v3, 3 movi v4, 4 movi v5, 5 movi v6, 6 movi v7, 7 movi v8, 8 movi v9, 9 movi v10, 10 movi v11, 11 movi v12, 12 movi v13, 13 movi v14, 14 movi v15, 15 call.range func, v0 check-type: exit-positive - file-name: "invalid_ctor_p" isa: verification: - method_id_non_static - method_id_accessible - method_init_obj runner-options: ['verifier-failure', 'verifier-config'] tags: [verifier] description: Check 'initobj.short' instruction with invalid initializer in PandaAssembly context. header-template: [] code-template: | .record R {} %s .function i32 main() { %s check-type: exit-positive cases: # static functions - values: - "" - initobj.short main bugid: ['3585'] - values: - | .function void R.cctor() { return.void } - initobj.short R.cctor bugid: ['3585'] - values: - | .function void R.cctor2(i32 a0) { return.void } - | # movi v1, 1 initobj.short R.cctor2, v1 - values: - | .function void R.statFunc() { return.void } - initobj.short R.statFunc bugid: ['3585'] - values: - | .function void R.ctor() { return.void } .function void R.statFunc2(R a0, i32 a1) { return.void } - | # movi v1, 1 initobj.short R.ctor # should be ok sta.obj v0 initobj.short R.statFunc2, v0, v1 # should fail # virtual functions, not initializers - values: - | .function void R.virtFunc(R a0) { return.void } - initobj.short R.virtFunc bugid: ['3585'] - values: - | .function void R.ctor() { return.void } .function void R.virtFunc2(R a0, i32 a1) { return.void } - | # movi v1, 1 initobj.short R.ctor # should be ok sta.obj v0 initobj.short R.virtFunc2, v0, v1 # should fail - values: - | .record panda.NullPointerException .record panda.String .function panda.String panda.NullPointerException.getMessage(panda.NullPointerException a0) - initobj.short panda.NullPointerException.getMessage bugid: ['3585'] - values: - | .function void R.ctor() { return.void } .record panda.NullPointerException .record panda.String .record panda.Object .function void panda.NullPointerException.ctor(panda.NullPointerException a0, panda.String a1, panda.Object a2) .function panda.String panda.NullPointerException.getMessage(panda.NullPointerException a0) - | # lda.str "message" sta.obj v1 initobj.short R.ctor # should be ok sta.obj v2 initobj.short panda.NullPointerException.ctor, v1, v2 # should be ok sta.obj v0 initobj.short panda.NullPointerException.getMessage, v0 # should fail bugid: ['3585'] # inaccessible methods - values: - .function void R.extFunc(R a0) - initobj.short R.extFunc bugid: ['3585'] - values: - .function void R.nativeFunc(R a0) - initobj.short R.nativeFunc bugid: ['3585'] - values: - .function void R.noimplFunc(R a0) - initobj.short R.noimplFunc bugid: ['3585'] # ctor without return - values: - .function void R.ctorNoReturn(R a0) {} - initobj.short R.ctorNoReturn bugid: ['5607'] ignore: true - file-name: "invalid_ctor_j" isa: verification: - method_id_non_static - method_id_accessible - method_init_obj runner-options: [verifier-failure, use-pa, verifier-config] tags: [verifier, pa-verifier] description: Check 'initobj.short' instruction with invalid initializer in PandaAssembly context. header-template: [PandaAssembly] bugid: ["5271"] code-template: | .record R {} %s .function i32 main() { %s check-type: exit-positive cases: # static functions - values: - "" - initobj.short main bugid: ['3585'] - values: - | .function void R.cctor() { return.void } - initobj.short R.cctor bugid: ['3585'] - values: - | .function void R.cctor(R a0, i32 a1) { return.void } - | # movi v1, 1 initobj.short R.cctor, v1 bugid: ['3585'] - values: - | .function void R.statFunc() { return.void } - initobj.short R.statFunc bugid: ['3585'] - values: - | .function void R.ctor0() { return.void } .function void R.ctor(R a0, i32 a1) { return.void } - | # initobj.short R.ctor0 # should be ok sta.obj v0 movi v1, 1 initobj.short R.ctor, v0, v1 # should fail - values: - | .function void R.ctor(R a0, i32 a1) { return.void } - | # movi v1, 1 initobj.short R.ctor, v1 # should fail bugid: ['3585'] - values: - | .record panda.Long .function panda.Long panda.Long.valueOf(i64 a0) - | # movi.64 v1, 1 initobj.short panda.Long.valueOf, v1 # virtual functions, not initializers - values: - | .function void R.virtFunc(R a0) { return.void } - initobj.short R.virtFunc bugid: ['3585'] - values: - | .function void R.ctor() { return.void } .function void R.virtFunc(R a0, i32 a1) { return.void } - | # initobj.short R.ctor # should be ok sta.obj v0 movi v1, 1 initobj.short R.virtFunc, v0, v1 # should fail - values: - | .record panda.NullPointerException .record panda.String .function void panda.NullPointerException.ctor(panda.NullPointerException a0, panda.String a1) - | # lda.str "message" sta.obj v1 initobj.short panda.NullPointerException.ctor, v1 # should be ok runner-options: [verifier-only, use-pa, verifier-config] - values: - | .record panda.NullPointerException .record panda.String .function panda.String panda.NullPointerException.getMessage(panda.NullPointerException a0) - initobj.short panda.NullPointerException.getMessage bugid: ['3585', '5752'] - values: - | .record panda.NullPointerException .record panda.String .function void panda.NullPointerException.ctor(panda.NullPointerException a0, panda.String a1) .function panda.String panda.NullPointerException.getMessage(panda.NullPointerException a0) - | # lda.str "message" sta.obj v1 initobj.short panda.NullPointerException.ctor, v1 # should be ok sta.obj v0 initobj.short panda.NullPointerException.getMessage, v0 # should fail bugid: ['3585', '5752'] - values: - | .record panda.Long .function i64 panda.Long.longValue(panda.Long a0) - | # initobj.short panda.Long.longValue bugid: ['3585'] - values: - | .record panda.Long .function void panda.Long.ctor(panda.Long a0, i64 a1) .function i64 panda.Long.longValue(panda.Long a0) - | # movi.64 v1, 1234567890 initobj.short panda.Long.ctor, v1 sta.obj v1 initobj.short panda.Long.longValue, v1 bugid: ['3585'] # inaccessible methods - values: - .function void R.extFunc(R a0) - initobj.short R.extFunc bugid: ['3585'] - values: - .function void R.nativeFunc(R a0) - initobj.short R.nativeFunc bugid: ['3585'] - values: - .function void R.noimplFunc(R a0) - initobj.short R.noimplFunc bugid: ['3585'] - values: - | .record I {} .function void I.func(I a0) .record Q {} .function void Q.func(Q a0) { return.void } - | # initobj.short I.func bugid: ['3585'] # ctor without return - values: - .function void R.ctorNoReturn(R a0) {} - initobj.short R.ctorNoReturn bugid: ['5607'] ignore: true - file-name: "incompatible_args_p" isa: verification: - compatible_arguments runner-options: ['verifier-failure', 'verifier-config'] tags: [verifier] description: Check 'initobj.short' instruction with initializer called with incompatible arguments in PandaAssembly context. header-template: [] code-template: | .record panda.Object .record panda.Class .record panda.String .record R {} .function void R.constructor(R a0, %s a1) { return.void } .function i32 main() { *s initobj.short R.constructor, v1 check-type: exit-positive template-cases: - values: - u1 exclude: [i32] - values: - u8 exclude: [i32] - values: - i8 exclude: [i32] - values: - u16 exclude: [i32] - values: - i16 exclude: [i32] - values: - u32 exclude: [i32] - values: - u64 exclude: [i64] - values: - f32 exclude: [f64] - values: - u32[] exclude: [u32a, nul] - values: - u64[] exclude: [u64a, nul] - values: - f32[] exclude: [f32a, nul] - values: - u32[][] exclude: [u32aa, nul] - values: - u64[][] exclude: [u64aa, nul] - values: - f32[][] exclude: [f32aa, nul] - values: - R exclude: [nul] - values: - panda.String exclude: [str, nul] - values: - panda.Class exclude: [typ, nul] - values: - panda.Object exclude: [u32a, u64a, f32a, u32aa, u64aa, f32aa, str, typ, ra, stra, typa, obja, raa, straa, typaa, objaa, nul] - values: - R[] exclude: [ra, nul] - values: - panda.String[] exclude: [stra, nul] - values: - panda.Class[] exclude: [typa, nul] - values: - panda.Object[] exclude: [obja, u32aa, u64aa, f32aa, ra, stra, typa, raa, straa, typaa, objaa, nul] - values: - R[][] exclude: [raa, nul] - values: - panda.String[][] exclude: [straa, nul] - values: - panda.Class[][] exclude: [typaa, nul] - values: - panda.Object[][] exclude: [objaa, raa, straa, typaa, nul] cases: - values: - movi v1, 1 id: i32 - values: - movi.64 v1, 1 id: i64 - values: - fmovi.64 v1, 1.0 id: f64 - values: - | # movi v1, 10 newarr v1, v1, u32[] id: u32a - values: - | # movi v1, 10 newarr v1, v1, u64[] id: u64a - values: - | # movi v1, 10 newarr v1, v1, f32[] id: f32a - values: - | # movi v1, 10 newarr v1, v1, u32[][] id: u32aa - values: - | # movi v1, 10 newarr v1, v1, u64[][] id: u64aa - values: - | # movi v1, 10 newarr v1, v1, f32[][] id: f32aa - values: - | # lda.str "test message" sta.obj v1 id: str - values: - | # lda.type R sta.obj v1 id: typ - values: - | # movi v1, 10 newarr v1, v1, R[] id: ra - values: - | # movi v1, 10 newarr v1, v1, panda.String[] id: stra - values: - | # movi v1, 10 newarr v1, v1, panda.Class[] id: typa - values: - | # movi v1, 10 newarr v1, v1, panda.Object[] id: obja - values: - | # movi v1, 10 newarr v1, v1, R[][] id: raa - values: - | # movi v1, 10 newarr v1, v1, panda.String[][] id: straa - values: - | # movi v1, 10 newarr v1, v1, panda.Class[][] id: typaa - values: - | # movi v1, 10 newarr v1, v1, panda.Object[][] id: objaa - values: - mov.null v1 id: nul - file-name: "incompatible_args_j" isa: verification: - compatible_arguments runner-options: [verifier-failure, use-pa, verifier-config] tags: [verifier, pa-verifier] description: Check 'initobj.short' instruction with initializer called with incompatible arguments in PandaAssembly context. header-template: [PandaAssembly] bugid: ["5271"] code-template: | .record panda.Object .record panda.Class .record R {} .function void R.constructor(R a0, %s a1) { return.void } .function i32 main() { *s initobj.short R.constructor, v1 check-type: exit-positive template-cases: - values: - u1 exclude: [i32] - values: - i8 exclude: [i32] - values: - u16 exclude: [i32] - values: - i16 exclude: [i32] - values: - i32 exclude: [i32] - values: - i64 exclude: [i64] - values: - f32 exclude: [f64] - values: - f64 exclude: [f64] - values: - u1[] exclude: [u1a, nul] - values: - i8[] exclude: [i8a, nul] - values: - u16[] exclude: [u1a, u16a, nul] - values: - i16[] exclude: [i8a, i16a, nul] - values: - i32[] exclude: [i8a, i16a, i32a, nul] - values: - i64[] exclude: [i64a, nul] - values: - f32[] exclude: [f32a, nul] - values: - f64[] exclude: [f32a, f64a, nul] - values: - i32[][] exclude: [i32aa, nul] - values: - f64[][] exclude: [f64aa, nul] - values: - R exclude: [nul] - values: - panda.Class exclude: [typ, nul] - values: - panda.Object exclude: [u1a, i8a, u16a, i16a, i32a, i64a, f32a, f64a, i32aa, f64aa, typ, ra, typa, obja, raa, typaa, objaa, nul] - values: - R[] exclude: [ra, nul] - values: - panda.Class[] exclude: [typa, nul] - values: - panda.Object[] exclude: [obja, i32aa, f64aa, ra, typa, raa, typaa, objaa, nul] - values: - R[][] exclude: [raa, nul] - values: - panda.Class[][] exclude: [typaa, nul] - values: - panda.Object[][] exclude: [objaa, raa, typaa, nul] cases: - values: - movi v1, 1 id: i32 - values: - movi.64 v1, 1 id: i64 - values: - fmovi.64 v1, 1.0 id: f64 - values: - | # movi v1, 10 newarr v1, v1, u1[] id: u1a - values: - | # movi v1, 10 newarr v1, v1, i8[] id: i8a - values: - | # movi v1, 10 newarr v1, v1, u16[] id: u16a - values: - | # movi v1, 10 newarr v1, v1, i16[] id: i16a - values: - | # movi v1, 10 newarr v1, v1, i32[] id: i32a - values: - | # movi v1, 10 newarr v1, v1, i64[] id: i64a - values: - | # movi v1, 10 newarr v1, v1, f32[] id: f32a - values: - | # movi v1, 10 newarr v1, v1, f64[] id: f64a - values: - | # movi v1, 10 newarr v1, v1, i32[][] id: i32aa - values: - | # movi v1, 10 newarr v1, v1, f64[][] id: f64aa - values: - | # lda.type R sta.obj v1 id: typ - values: - | # movi v1, 10 newarr v1, v1, R[] id: ra - values: - | # movi v1, 10 newarr v1, v1, panda.Class[] id: typa - values: - | # movi v1, 10 newarr v1, v1, panda.Object[] id: obja - values: - | # movi v1, 10 newarr v1, v1, R[][] id: raa - values: - | # movi v1, 10 newarr v1, v1, panda.Class[][] id: typaa - values: - | # movi v1, 10 newarr v1, v1, panda.Object[][] id: objaa - values: - mov.null v1 id: nul - file-name: "compatible_primitive_args_p" isa: verification: - compatible_arguments runner-options: ['verifier-only', 'verifier-config'] tags: [verifier] description: Check 'initobj.short' instruction with initializer called with compatible primitive arguments in PandaAssembly context. header-template: [] code-template: | .record R {} .function void R.constructor(R a0, %s a1) { return.void } .function i32 main() { %s initobj.short R.constructor, v1 check-type: exit-positive cases: - values: - u1 - movi v1, 1 - values: - u8 - movi v1, 1 - values: - i8 - movi v1, 1 - values: - u16 - movi v1, 1 - values: - i16 - movi v1, 1 - values: - u32 - movi v1, 1 - values: - i32 - movi v1, 1 - values: - i64 - movi.64 v1, 1 - values: - u64 - movi.64 v1, 1 - values: - f32 - fmovi v1, 1.1 - values: - f64 - fmovi.64 v1, 1.1 - file-name: "compatible_primitive_args_j" isa: verification: - compatible_arguments runner-options: [verifier-only, use-pa, verifier-config] tags: [verifier, pa-verifier] description: Check 'initobj.short' instruction with initializer called with compatible primitive arguments in PandaAssembly context. header-template: [PandaAssembly] code-template: | .record R {} .function void R.constructor(R a0, %s a1) { return.void } .function i32 main() { %s initobj.short R.constructor, v1 check-type: exit-positive cases: - values: - u1 - movi v1, 1 - values: - i8 - movi v1, 1 - values: - u16 - movi v1, 1 - values: - i16 - movi v1, 1 - values: - i32 - movi v1, 1 - values: - i64 - movi.64 v1, 1 - values: - f32 - fmovi v1, 1.1 - values: - f64 - fmovi.64 v1, 1.1 - file-name: "compatible_prim_array_args_p" isa: verification: - compatible_arguments runner-options: ['verifier-only', 'verifier-config'] tags: [verifier] description: Check 'initobj.short' instruction with initializer called with compatible primitive array arguments in PandaAssembly context. header-template: [] code-template: | .record R {} .function void R.constructor(R a0, %s a1) { return.void } .function i32 main() { movi v0, 10 newarr v1, v0, %s initobj.short R.constructor, v1 check-type: exit-positive cases: - values: - "u1[]" - "u1[]" - values: - "u8[]" - "u8[]" - values: - "i8[]" - "i8[]" - values: - "u16[]" - "u16[]" - values: - "i16[]" - "i16[]" - values: - "u32[]" - "u32[]" - values: - "i32[]" - "i32[]" - values: - "u64[]" - "u64[]" - values: - "i64[]" - "i64[]" - values: - "f32[]" - "f32[]" - values: - "f64[]" - "f64[]" - values: - "u1[][]" - "u1[][]" - values: - "u8[][]" - "u8[][]" - values: - "i8[][]" - "i8[][]" - values: - "u16[][]" - "u16[][]" - values: - "i16[][]" - "i16[][]" - values: - "u32[][]" - "u32[][]" - values: - "i32[][]" - "i32[][]" - values: - "u64[][]" - "u64[][]" - values: - "i64[][]" - "i64[][]" - values: - "f32[][]" - "f32[][]" - values: - "f64[][]" - "f64[][]" - file-name: "compatible_prim_array_args_j" isa: verification: - compatible_arguments runner-options: [verifier-only, use-pa, verifier-config] tags: [verifier, pa-verifier] description: Check 'initobj.short' instruction with initializer called with compatible primitive array arguments in PandaAssembly context. header-template: [PandaAssembly] code-template: | .record R {} .function void R.constructor(R a0, %s a1) { return.void } .function i32 main() { movi v0, 10 newarr v1, v0, %s initobj.short R.constructor, v1 check-type: exit-positive cases: - values: - "u1[]" - "u1[]" - values: - "i8[]" - "i8[]" - values: - "u16[]" - "u16[]" - values: - "i16[]" - "i16[]" - values: - "i32[]" - "i32[]" - values: - "i64[]" - "i64[]" - values: - "f32[]" - "f32[]" - values: - "f64[]" - "f64[]" - values: - "u1[][]" - "u1[][]" - values: - "i8[][]" - "i8[][]" - values: - "u16[][]" - "u16[][]" - values: - "i16[][]" - "i16[][]" - values: - "i32[][]" - "i32[][]" - values: - "i64[][]" - "i64[][]" - values: - "f32[][]" - "f32[][]" - values: - "f64[][]" - "f64[][]" - file-name: "compatible_obj_args_p" isa: verification: - compatible_arguments runner-options: ['verifier-only', 'verifier-config'] tags: [verifier] description: Check 'initobj.short' instruction with initializer called with compatible object arguments in PandaAssembly context. header-template: [] code-template: | .record panda.Object .record panda.Class .record panda.String .record Q {} .function void Q.ctor(Q a0) { return.void } .record R {} .function void R.constructor(R a0, %s a1) { return.void } .function i32 main() { %s initobj.short R.constructor, v1 check-type: exit-positive cases: # Object of type O is instance of type T if O is the same as T ... - values: - Q - | # initobj.short Q.ctor sta.obj v1 - values: - panda.String - | # lda.str "test" sta.obj v1 - values: - panda.Class - | # lda.type Q sta.obj v1 # ... or is subtype of T - values: - panda.Object - | # initobj.short Q.ctor sta.obj v1 - values: - panda.Object - | # lda.str "test" sta.obj v1 - values: - panda.Object - | # lda.type Q sta.obj v1 id: cls bugid: ["3594"] ignore: true # For arrays T should be a root type in type hierarchy ... - values: - panda.Object - | # movi v0, 10 newarr v1, v0, i32[] - values: - panda.Object - | # movi v0, 10 newarr v1, v0, f64[][] - values: - panda.Object - | # movi v0, 10 newarr v1, v0, Q[] - values: - panda.Object - | # movi v0, 10 newarr v1, v0, panda.Object[] - values: - panda.Object - | # movi v0, 10 newarr v1, v0, panda.String[] - values: - panda.Object - | # movi v0, 10 newarr v1, v0, panda.Class[] - file-name: "compatible_obj_args_j" isa: verification: - compatible_arguments runner-options: [verifier-only, use-pa, verifier-config] tags: [verifier, pa-verifier] description: Check 'initobj.short' instruction with initializer called with compatible object arguments in PandaAssembly context. header-template: [PandaAssembly] code-template: | .record panda.Object .record panda.Class .record panda.String .record panda.io.Serializable .record I {} .record E {} .record Q {} .function void Q.ctor(Q a0) { return.void } .record R {} .function void R.constructor(R a0, %s a1) { return.void } .function i32 main() { %s initobj.short R.constructor, v1 check-type: exit-positive cases: # Object of type O is instance of type T if O is the same as T ... - values: - Q - | # initobj.short Q.ctor sta.obj v1 - values: - panda.String - | # lda.str "test" sta.obj v1 - values: - panda.Class - | # lda.type Q sta.obj v1 # ... or is subtype of T - values: - E - | # initobj.short Q.ctor sta.obj v1 - values: - I - | # initobj.short Q.ctor sta.obj v1 - values: - panda.Object - | # initobj.short Q.ctor sta.obj v1 - values: - panda.Object - | # lda.str "test" sta.obj v1 - values: - panda.io.Serializable - | # lda.type panda.String sta.obj v1 ignore: true bugid: ['1806'] - values: - panda.Object - | # lda.type Q sta.obj v1 bugid: ['3594'] ignore: true # For arrays T should be a root type in type hierarchy ... - values: - panda.Object - | # movi v0, 10 newarr v1, v0, i32[] - values: - panda.Object - | # movi v0, 10 newarr v1, v0, f64[][] - values: - panda.Object - | # movi v0, 10 newarr v1, v0, Q[] - values: - panda.Object - | # movi v0, 10 newarr v1, v0, panda.Object[] - values: - panda.Object - | # movi v0, 10 newarr v1, v0, panda.String[] - values: - panda.Object - | # movi v0, 10 newarr v1, v0, panda.Class[] - file-name: "compatible_obj_array_args_p" isa: verification: - compatible_arguments runner-options: ['verifier-only', 'verifier-config'] tags: [verifier] description: Check 'initobj.short' instruction with initializer called with compatible object array arguments in PandaAssembly context. header-template: [] code-template: | .record panda.Object .record panda.Class .record panda.String .record Q {} .record R {} .function void R.constructor(R a0, %s a1) { return.void } .function i32 main() { movi v0, 10 newarr v1, v0, %s initobj.short R.constructor, v1 check-type: exit-positive cases: # T is such array that O array elements are the same as T array elements - values: - Q[] - Q[] - values: - Q[][] - Q[][] - values: - "panda.Object[]" - "panda.Object[]" - values: - "panda.Object[][]" - "panda.Object[][]" - values: - panda.String[] - panda.String[] - values: - panda.String[][] - panda.String[][] - values: - panda.Class[] - panda.Class[] - values: - panda.Class[][] - panda.Class[][] # T is such array that O array elements are subtypes of T array elements - values: - "panda.Object[]" - "panda.Object[][]" bugid: ["3608"] - values: - "panda.Object[]" - Q[] bugid: ["3608"] - values: - "panda.Object[]" - Q[][] bugid: ["3608"] - values: - "panda.Object[]" - panda.Class[] bugid: ["3608"] - values: - "panda.Object[]" - panda.Class[][] bugid: ["3608"] - values: - "panda.Object[]" - panda.String[] bugid: ["3608"] - values: - "panda.Object[]" - panda.String[][] bugid: ["3608"] - values: - "panda.Object[]" - i32[][] bugid: ["3608"] - values: - "panda.Object[]" - f64[][][] bugid: ["3608"] # inherited types from panda.Object[][] - values: - "panda.Object[][]" - panda.Object[][][] bugid: ["3608"] - values: - "panda.Object[][]" - panda.Class[][] bugid: ["3608"] - values: - "panda.Object[][]" - panda.Class[][][] bugid: ["3608"] - values: - "panda.Object[][]" - i32[][][] bugid: ["3608"] - values: - "panda.Object[][]" - f64[][][][] bugid: ["3608"] - file-name: "compatible_obj_array_args_j" isa: verification: - compatible_arguments runner-options: [verifier-only, use-pa, verifier-config] tags: [verifier, pa-verifier] description: Check 'initobj.short' instruction with initializer called with compatible object array arguments in PandaAssembly context. header-template: [PandaAssembly] code-template: | .record panda.Object .record panda.Class .record panda.String .record I {} .record E {} .record Q {} .record R {} .function void R.constructor(R a0, %s a1) { return.void } .function i32 main() { movi v0, 10 newarr v1, v0, %s initobj.short R.constructor, v1 check-type: exit-positive cases: # T is such array that O array elements are the same as T array elements - values: - Q[] - Q[] - values: - Q[][] - Q[][] - values: - "panda.Object[]" - "panda.Object[]" - values: - "panda.Object[][]" - "panda.Object[][]" - values: - panda.String[] - panda.String[] - values: - panda.String[][] - panda.String[][] - values: - panda.Class[] - panda.Class[] - values: - panda.Class[][] - panda.Class[][] # T is such array that O array elements are subtypes of T array elements - values: - E[] - Q[] - values: - I[] - Q[] - values: - "panda.Object[]" - "panda.Object[][]" bugid: ["3608"] - values: - "panda.Object[]" - Q[] bugid: ["3608"] - values: - "panda.Object[]" - Q[][] bugid: ["3608"] - values: - "panda.Object[]" - panda.Class[] bugid: ["3608"] - values: - "panda.Object[]" - panda.Class[][] bugid: ["3608"] - values: - "panda.Object[]" - panda.String[] bugid: ["3608"] - values: - "panda.Object[]" - panda.String[][] bugid: ["3608"] - values: - "panda.Object[]" - i32[][] bugid: ["3608"] - values: - "panda.Object[]" - f64[][][] bugid: ["3608"] # inherited types from object[][] - values: - E[][] - Q[][] - values: - I[][] - Q[][] - values: - "panda.Object[][]" - panda.Object[][][] bugid: ["3608"] - values: - "panda.Object[][]" - panda.Class[][] bugid: ["3608"] - values: - "panda.Object[][]" - panda.Class[][][] bugid: ["3608"] - values: - "panda.Object[][]" - i32[][][] bugid: ["3608"] - values: - "panda.Object[][]" - f64[][][][] bugid: ["3608"] - file-name: "compatible_obj_null_args_p" isa: verification: - compatible_arguments runner-options: ['verifier-only', 'verifier-config'] tags: [verifier] description: Check 'initobj.short' instruction with initializer called with null object ref in PandaAssembly context. header-template: [] code-template: | .record panda.Object .record panda.Class .record panda.String .record Q {} .record R {} .function void R.constructor(R a0, %s a1) { return.void } .function i32 main() { mov.null v1 initobj.short R.constructor, v1 check-type: exit-positive cases: - values: ["i32[]"] - values: ["f64[][]"] - values: ["panda.Object"] - values: ["panda.Object[]"] - values: ["panda.Object[][]"] - values: ["Q"] - values: ["Q[][]"] - values: ["panda.String"] - values: ["panda.String[]"] - values: ["panda.Class"] - values: ["panda.Class[]"] - file-name: "compatible_obj_null_args_j" isa: verification: - compatible_arguments runner-options: [verifier-only, use-pa, verifier-config] tags: [verifier, pa-verifier] description: Check 'initobj.short' instruction with initializer called with null object ref in PandaAssembly context. header-template: [PandaAssembly] code-template: | .record panda.Object .record panda.Class .record panda.String .record Q {} .record R {} .function void R.constructor(R a0, %s a1) { return.void } .function i32 main() { mov.null v1 initobj.short R.constructor, v1 check-type: exit-positive cases: - values: ["i32[]"] - values: ["f64[][]"] - values: ["panda.Object"] - values: ["panda.Object[]"] - values: ["panda.Object[][]"] - values: ["Q"] - values: ["Q[][]"] - values: ["panda.String"] - values: ["panda.String[]"] - values: ["panda.Class"] - values: ["panda.Class[]"] - file-name: "valid_instance_p" isa: description: | Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to the newly created object into accumulator. method_id should resolve to an initializer. description: Check 'initobj.short' with valid method id creates expected instance type in PandaAssembly context. tags: ['irtoc_ignore'] header-template: [] code-template: | .record panda.Object .record panda.String .record R {} .function void R.ctor0(R a0) { return.void } .function R R.ctor0x(R a0) { lda.null return.obj } .function void R.ctor1(R a0, i32 a1) { return.void } .function R[] R.ctor1x(R a0, i32 a1) { movi v0, 10 newarr v0, v0, R[] lda.obj v0 return.obj } .function void R.ctor2(R a0, R a1, i16 a2) { return.void } .function R R.ctor2x(R a0, R a1, i16 a2) { lda.null return.obj } .record panda.NullPointerException .function void panda.NullPointerException.ctor(panda.NullPointerException a0, panda.String a1, panda.Object a2) .function i32 main() { # sample data to put in arguments: v1 - v5 movi v1, 1 movi.64 v2, 64 fmovi.64 v3, 3.14 mov.null v4 lda.str "message" sta.obj v5 # create the object initobj.short %s jnez.obj chk1 ldai 1 return chk1: sta.obj v0 isinstance %s jeq v1, chk2 ldai 2 return chk2: lda.obj v0 isinstance panda.Object jeq v1, ok ldai 3 return ok: check-type: exit-positive cases: - values: - R.ctor0 - R - values: - R.ctor0x - R - values: - R.ctor1, v1 - R - values: - R.ctor1x, v1 - R - values: - R.ctor2, v4, v1 - R - values: - R.ctor2x, v4, v1 - R tags: ['tsan'] - values: - panda.NullPointerException.ctor, v5, v4 - panda.NullPointerException tags: ['tsan'] - file-name: "valid_instance_j" isa: description: | Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to the newly created object into accumulator. method_id should resolve to an initializer. description: Check 'initobj.short' with valid method id creates expected instance type in PandaAssembly context. tags: ['irtoc_ignore'] header-template: [PandaAssembly] runner-options: [use-pa] code-template: | .record panda.Object .record panda.String .record R {} .function void R.ctor0(R a0) { return.void } .function R R.ctor0x(R a0) { lda.null return.obj } .function void R.ctor1(R a0, i32 a1) { return.void } .function R R.ctor1x(R a0, i32 a1) { lda.null return.obj } .function void R.ctor2(R a0, R a1, i16 a2) { return.void } .function panda.Object R.ctor2x(R a0, R a1, i16 a2) { lda.null return.obj } .record panda.NullPointerException .function void panda.NullPointerException.ctor(panda.NullPointerException a0, panda.String a1) .function i32 main() { # sample data to put in arguments: v1 - v5 movi v1, 1 movi.64 v2, 64 fmovi.64 v3, 3.14 mov.null v4 lda.str "message" sta.obj v5 # create the object initobj.short %s jnez.obj chk1 ldai 1 return chk1: sta.obj v0 isinstance %s jeq v1, chk2 ldai 2 return chk2: lda.obj v0 isinstance panda.Object jeq v1, ok ldai 3 return ok: check-type: exit-positive cases: - values: - R.ctor0 - R - values: - R.ctor0x - R - values: - R.ctor1, v1 - R tags: ['tsan'] - values: - R.ctor1x, v1 - R - values: - R.ctor2, v4, v1 - R tags: ['tsan'] - values: - R.ctor2x, v4, v1 - R - values: - panda.NullPointerException.ctor, v5 - panda.NullPointerException - file-name: "check_args_num_p" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' constructor behavior with various number of arguments in PandaAssembly context. header-template: [] code-template: | .record R { i32 f1 i32 f2 } .function void R.ctor0(R a0) { return.void } .function void R.ctor1(R a0, i32 a1) { lda a1 stobj a0, R.f1 return.void } .function void R.ctor2(R a0, i32 a1, i32 a2) { lda a1 stobj a0, R.f1 lda a2 stobj a0, R.f2 return.void } .function i32 main() { # sample data to put in args movi v1, 10 movi v2, 20 # create the object %s sta.obj v0 lab1: ldobj v0, R.f1 movi v7, %s jeq v7, lab2 ldai 1 return lab2: ldobj v0, R.f2 movi v7, %s jeq v7, ok ldai 2 return ok: check-type: exit-positive cases: - values: ["initobj.short R.ctor0", 0, 0] - values: ["initobj.short R.ctor1, v2", 20, 0] tags: ['tsan'] - values: ["initobj.short R.ctor2, v2, v1", 20, 10] - file-name: "check_args_num_j" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' constructor behavior with various number of arguments in PandaAssembly context. runner-options: [use-pa] header-template: [PandaAssembly] code-template: | .record R { i32 f1 i32 f2 } .function void R.ctor0(R a0) { return.void } .function void R.ctor1(R a0, i32 a1) { lda a1 stobj a0, R.f1 return.void } .function void R.ctor2(R a0, i32 a1, i32 a2) { lda a1 stobj a0, R.f1 lda a2 stobj a0, R.f2 return.void } .function i32 main() { # sample data to put in args movi v3, 30 movi v4, 40 # create the object %s sta.obj v0 lab1: ldobj v0, R.f1 movi v7, %s jeq v7, lab2 ldai 1 return lab2: ldobj v0, R.f2 movi v7, %s jeq v7, ok ldai 2 return ok: check-type: exit-positive cases: - values: ["initobj.short R.ctor0", 0, 0] - values: ["initobj.short R.ctor1, v4", 40, 0] - values: ["initobj.short R.ctor2, v4, v3", 40, 30] tags: ['tsan'] - file-name: "check_all_32bit_types_p" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' constructor behavior with primitive 32bit argument types in PandaAssembly context. header-template: [] code-template: | .record Z { %s f } .function void Z.ctor1(Z a0) { return.void } .function void Z.ctor2(Z a0, %s a1) { lda a1 stobj a0, Z.f return.void } .function i32 main() { initobj.short Z.ctor1 sta.obj v0 ldobj v0, Z.f jeqz chk2 ldai 1 return chk2: movi v1, %s initobj.short Z.ctor2, v1 sta.obj v0 ldobj v0, Z.f %s jeqz ok ldai 2 return ok: check-type: exit-positive cases: - values: - u1 - u1 - 1 - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - u1 - u1 - 0 - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: [u8, u8, 0, ucmp v1] - values: [u8, u8, 0x000000ff, ucmp v1] - values: [u8, u8, 0x0000005a, ucmp v1] tags: ['tsan'] - values: - i8 - i8 - 0 - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i8 - i8 - 0xffffffff - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i8 - i8 - 0x0000005a - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: [u16, u16, 0, ucmp v1] - values: [u16, u16, 0x0000ffff, ucmp v1] tags: ['tsan'] - values: [u16, u16, 0x00005a5a, ucmp v1] - values: - i16 - i16 - 0 - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i16 - i16 - 0xffffffff - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i16 - i16 - 0x00005a5a - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: [u32, u32, 0, ucmp v1] tags: ['tsan'] - values: [u32, u32, 0xffffffff, ucmp v1] - values: [u32, u32, 0x5a5a5a5a, ucmp v1] - values: - i32 - i32 - 0 - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i32 - i32 - 0xffffffff - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i32 - i32 - 0x5a5a5a5a - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - file-name: "check_all_32bit_types_j" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' constructor behavior with primitive 32bit argument types in PandaAssembly context. runner-options: [use-pa] header-template: [PandaAssembly] code-template: | .record Z { %s f } .function void Z.ctor1(Z a0) { return.void } .function void Z.ctor2(Z a0, %s a1) { lda a1 stobj a0, Z.f return.void } .function i32 main() { initobj.short Z.ctor1 sta.obj v0 ldobj v0, Z.f jeqz chk2 ldai 1 return chk2: movi v1, %s initobj.short Z.ctor2, v1 sta.obj v0 ldobj v0, Z.f %s jeqz ok ldai 2 return ok: check-type: exit-positive cases: - values: - u1 - u1 - 1 - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - u1 - u1 - 0 - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i8 - i8 - 0 - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i8 - i8 - 0xffffffff - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i8 - i8 - 0x0000005a - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return tags: ['tsan'] - values: [u16, u16, 0, ucmp v1] - values: [u16, u16, 0x0000ffff, ucmp v1] tags: ['tsan'] - values: [u16, u16, 0x00005a5a, ucmp v1] - values: - i16 - i16 - 0 - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i16 - i16 - 0xffffffff - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i16 - i16 - 0x00005a5a - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i32 - i32 - 0 - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i32 - i32 - 0xffffffff - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - values: - i32 - i32 - 0x5a5a5a5a - | # jne v1, exit_failure ldai 0 return exit_failure: ldai 1 return - file-name: "check_int_64bit_types_p" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' constructor behavior with primitive integer 64bit argument types in PandaAssembly context. header-template: [] code-template: | .record Z { %s f } .function void Z.ctor1(Z a0) { return.void } .function void Z.ctor2(Z a0, %s a1) { lda.64 a1 stobj.64 a0, Z.f return.void } .function i32 main() { initobj.short Z.ctor1 sta.obj v0 ldobj.64 v0, Z.f movi.64 v1, 0 %s jeqz chk2 ldai 1 return chk2: movi.64 v1, %s initobj.short Z.ctor2, v1 sta.obj v0 ldobj.64 v0, Z.f %s jeqz ok ldai 2 return ok: check-type: exit-positive cases: - values: [u64, u64, ucmp.64 v1, 0, ucmp.64 v1] - values: [u64, u64, ucmp.64 v1, 0xffffffffffffffff, ucmp.64 v1] tags: ['tsan'] - values: [u64, u64, ucmp.64 v1, 0x5a5a5a5a5a5a5a5a, ucmp.64 v1] - values: [i64, i64, ucmp.64 v1, 0, cmp.64 v1] - values: [i64, i64, ucmp.64 v1, 0xffffffffffffffff, cmp.64 v1] - values: [i64, i64, ucmp.64 v1, 0x5a5a5a5a5a5a5a5a, cmp.64 v1] tags: ['tsan'] - file-name: "check_int_64bit_types_j" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' constructor behavior with primitive integer 64bit argument types in PandaAssembly context. runner-options: [use-pa] header-template: [PandaAssembly] code-template: | .record Z { %s f } .function void Z.ctor1(Z a0) { return.void } .function void Z.ctor2(Z a0, %s a1) { lda.64 a1 stobj.64 a0, Z.f return.void } .function i32 main() { initobj.short Z.ctor1 sta.obj v0 ldobj.64 v0, Z.f movi.64 v1, 0 %s jeqz chk2 ldai 1 return chk2: movi.64 v1, %s initobj.short Z.ctor2, v1 sta.obj v0 ldobj.64 v0, Z.f %s jeqz ok ldai 2 return ok: check-type: exit-positive cases: - values: [i64, i64, ucmp.64 v1, 0, cmp.64 v1] - values: [i64, i64, ucmp.64 v1, 0xffffffffffffffff, cmp.64 v1] - values: [i64, i64, ucmp.64 v1, 0x5a5a5a5a5a5a5a5a, cmp.64 v1] tags: ['tsan'] - file-name: "check_float64_type_p" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' constructor behavior with primitive float argument types in PandaAssembly context. tags: ['irtoc_ignore'] header-template: [] code-template: | .record Z { f64 f } .function void Z.ctor1(Z a0) { return.void } .function void Z.ctor2(Z a0, f64 a1) { lda.64 a1 stobj.64 a0, Z.f return.void } .function i32 main() { initobj.short Z.ctor1 sta.obj v0 ldobj.64 v0, Z.f fmovi.64 v1, 0.0 fcmpg.64 v1 jeqz chk2 ldai 1 return chk2: fmovi.64 v1, %s initobj.short Z.ctor2, v1 sta.obj v0 ldobj.64 v0, Z.f fcmpg.64 v1 jeqz ok ldai 2 return ok: check-type: exit-positive cases: - values: [0.0] - values: [4.625] - values: [-4.625] - values: [0xfff0000000000000] # -Inf tags: ['tsan'] - values: [0x7ff0000000000000] # +Inf - values: [0x7ff8000000000000] - values: [0x7ff8000000000010] - values: [0x7fffffffffffffff] - values: [0xffffffffffffffff] tags: ['tsan'] - file-name: "check_float32_type_p" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' constructor behavior with primitive float argument types in PandaAssembly context. tags: ['irtoc_ignore'] header-template: [] code-template: | .record Z { f32 f } .function void Z.ctor1(Z a0) { return.void } .function void Z.ctor2(Z a0, f32 a1) { lda a1 stobj a0, Z.f return.void } .function i32 main() { initobj.short Z.ctor1 sta.obj v0 ldobj v0, Z.f fmovi v1, 0.0 fcmpg v1 jeqz chk2 ldai 1 return chk2: fmovi v1, %s initobj.short Z.ctor2, v1 sta.obj v0 ldobj v0, Z.f fcmpg v1 jeqz ok ldai 2 return ok: check-type: exit-positive cases: - values: [0.0] - values: [4.625] - values: [-4.625] - values: [0xff800000] # -Inf - values: [0x7f800000] # +Inf - values: [0x7fc00000] - values: [0x7fc00010] - values: [0x7fffffff] - values: [0xffffffff] - file-name: "check_float64_type_j" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' constructor behavior with primitive float argument types in PandaAssembly context. tags: ['irtoc_ignore'] runner-options: [use-pa] header-template: [PandaAssembly] code-template: | .record Z { f64 f } .function void Z.ctor1(Z a0) { return.void } .function void Z.ctor2(Z a0, f64 a1) { lda.64 a1 stobj.64 a0, Z.f return.void } .function i32 main() { initobj.short Z.ctor1 sta.obj v0 ldobj.64 v0, Z.f fmovi.64 v1, 0.0 fcmpg.64 v1 jeqz chk2 ldai 1 return chk2: fmovi.64 v1, %s initobj.short Z.ctor2, v1 sta.obj v0 ldobj.64 v0, Z.f fcmpg.64 v1 jeqz ok ldai 2 return ok: check-type: exit-positive cases: - values: [0.0] - values: [4.625] - values: [-4.625] - values: [0xfff0000000000000] # -Inf - values: [0x7ff0000000000000] # +Inf - values: [0x7ff8000000000000] - values: [0x7ff8000000000010] - values: [0x7fffffffffffffff] - values: [0xffffffffffffffff] - file-name: "check_float32_type_j" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' constructor behavior with primitive float argument types in PandaAssembly context. tags: ['irtoc_ignore'] runner-options: [use-pa] header-template: [PandaAssembly] code-template: | .record Z { f32 f } .function void Z.ctor1(Z a0) { return.void } .function void Z.ctor2(Z a0, f32 a1) { lda a1 stobj a0, Z.f return.void } .function i32 main() { initobj.short Z.ctor1 sta.obj v0 ldobj v0, Z.f fmovi v1, 0.0 fcmpg v1 jeqz chk2 ldai 1 return chk2: fmovi v1, %s initobj.short Z.ctor2, v1 sta.obj v0 ldobj v0, Z.f fcmpg v1 jeqz ok ldai 2 return ok: check-type: exit-positive cases: - values: [0.0] - values: [4.625] - values: [-4.625] - values: [0xff800000] # -Inf tags: ['tsan'] - values: [0x7f800000] # +Inf tags: ['tsan'] - values: [0x7fc00000] - values: [0x7fc00010] - values: [0x7fffffff] - values: [0xffffffff] - file-name: "check_obj_types_p" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' constructor behavior with several object type arguments in PandaAssembly context. header-template: [] code-template: | .record panda.Object .record panda.Class .record panda.String .record Z { %s f } .function void Z.ctor1(Z a0) { return.void } .function void Z.ctor2(Z a0, %s a1) { lda.obj a1 stobj.obj a0, Z.f return.void } .function i32 main() { initobj.short Z.ctor1 sta.obj v0 ldobj.obj v0, Z.f jeqz.obj chk2 ldai 1 return chk2: %s sta.obj v1 initobj.short Z.ctor2, v1 sta.obj v0 ldobj.obj v0, Z.f jeq.obj v1, ok ldai 2 return ok: check-type: exit-positive cases: - values: [panda.String, panda.String, lda.str "test"] - values: [panda.Object, panda.String, lda.str "test"] - values: [panda.Class, panda.Class, lda.type Z] - values: - panda.Object - panda.Class - lda.type Z bugid: ["3594"] - values: [panda.Object, panda.Object, initobj.short Z.ctor1] - values: [panda.String, panda.String, lda.null] - values: - "i32[]" - "i32[]" - | # movi v7, 10 newarr v7, v7, i32[] lda.obj v7 - values: - "i64[]" - "i64[]" - | # movi v7, 10 newarr v7, v7, i64[] lda.obj v7 tags: ['tsan'] - values: - "panda.String[]" - "panda.String[]" - | # movi v7, 10 newarr v7, v7, panda.String[] lda.obj v7 - values: - Z[] - Z[] - | # movi v7, 10 newarr v7, v7, Z[] lda.obj v7 - values: - panda.Object - u1[] - | # movi v7, 10 newarr v7, v7, u1[] lda.obj v7 tags: ['tsan'] - values: - panda.Object - panda.Object[] - | # movi v7, 10 newarr v7, v7, Z[] lda.obj v7 bugid: ['3608'] - values: - panda.Object[] - panda.Object[] - | # movi v7, 10 newarr v7, v7, Z[][] lda.obj v7 bugid: ['3608'] - file-name: "check_obj_types_j" isa: instructions: - sig: initobj.short method_id, v1:in:none, v2:in:none acc: out:ref format: [op_v1_4_v2_4_id_16] description: Check 'initobj.short' constructor behavior with several object type arguments in PandaAssembly context. runner-options: [use-pa] header-template: [PandaAssembly] code-template: | .record panda.Object .record panda.Class .record panda.String .record Z { %s f } .function void Z.ctor1(Z a0) { return.void } .function void Z.ctor2(Z a0, %s a1) { lda.obj a1 stobj.obj a0, Z.f return.void } .function i32 main() { initobj.short Z.ctor1 sta.obj v0 ldobj.obj v0, Z.f jeqz.obj chk2 ldai 1 return chk2: %s sta.obj v1 initobj.short Z.ctor2, v1 sta.obj v0 ldobj.obj v0, Z.f jeq.obj v1, ok ldai 2 return ok: check-type: exit-positive cases: - values: [panda.String, panda.String, lda.str "test"] - values: [panda.Object, panda.String, lda.str "test"] - values: [panda.Class, panda.Class, lda.type Z] - values: [panda.Object, panda.Class, lda.type Z] - values: [panda.Object, panda.Object, initobj.short Z.ctor1] - values: [panda.String, panda.String, lda.null] - values: - "i32[]" - "i32[]" - | # movi v7, 10 newarr v7, v7, i32[] lda.obj v7 - values: - "i64[]" - "i64[]" - | # movi v7, 10 newarr v7, v7, i64[] lda.obj v7 - values: - "panda.String[]" - "panda.String[]" - | # movi v7, 10 newarr v7, v7, panda.String[] lda.obj v7 - values: - Z[] - Z[] - | # movi v7, 10 newarr v7, v7, Z[] lda.obj v7 - values: - panda.Object - u1[] - | # movi v7, 10 newarr v7, v7, u1[] lda.obj v7 - values: - panda.Object - panda.Object - | # movi v7, 10 newarr v7, v7, Z[] lda.obj v7 tags: ['tsan'] - values: - panda.Object - panda.Object[] - | # movi v7, 10 newarr v7, v7, panda.String[] lda.obj v7 tags: ['tsan'] - values: - panda.Object[] - panda.Object[] - | # movi v7, 10 newarr v7, v7, panda.String[][] lda.obj v7 bugid: ['3608'] - file-name: 'oome_p' isa: exceptions: - x_oom description: Create objects with 'initobj.short' instruction until OutOfMemoryError in PandaAssembly context tags: ['irtoc_ignore'] header-template: [] panda-options: "--heap-size-limit=67108864" bugid: ['3578', '4170', '4171'] code-template: | .record panda.OutOfMemoryError .record Z { %s } .function void Z.ctor(Z a0) { return.void } .function i32 main() { movi v7, 50000 # array size newarr v6, v7, Z[] # array ref movi v1, 0 # index begin: initobj.short Z.ctor starr.obj v6, v1 inci v1, 1 lda v1 jlt v7, begin end: ldai 1 # Should not reach this line return catch_OOME: ldai 0 # Expected panda.OutOfMemoryError return catch_all: ldai 2 # Unexpected exception, test failed return .catch panda.OutOfMemoryError, begin, end, catch_OOME .catchall begin, end, catch_all check-type: none cases: - values: - "#{[*1..500].map do |i| \" f64 f#{i}\\n\" end .join}" tags: ['tsan'] - file-name: 'oome_j' isa: exceptions: - x_oom description: Create objects with 'initobj.short' instruction until OutOfMemoryError in PandaAssembly context tags: ['irtoc_ignore'] runner-options: [use-pa] header-template: [PandaAssembly] panda-options: "--heap-size-limit=67108864" bugid: ['3578', '4171', '6147'] code-template: | .record panda.OutOfMemoryError .record Z { %s } .function void Z.ctor(Z a0) { return.void } .function i32 main() { movi v7, 50000 # array size newarr v6, v7, Z[] # array ref movi v1, 0 # index begin: initobj.short Z.ctor starr.obj v6, v1 inci v1, 1 lda v1 jlt v7, begin end: ldai 1 # Should not reach this line return catch_OOME: ldai 0 # Expected panda.OutOfMemoryError return catch_all: ldai 2 # Unexpected exception, test failed return .catch panda.OutOfMemoryError, begin, end, catch_OOME .catchall begin, end, catch_all check-type: none cases: - values: - "#{[*1..500].map do |i| \" f64 f#{i}\\n\" end .join}" tags: ['tsan'] - file-name: 'ame_p' isa: exceptions: - x_abstract description: Create objects with 'initobj.short' instruction with AbstractMethodError in PandaAssembly context tags: ['irtoc_ignore'] header-template: [] bugid: ['3625'] code-template: | .record panda.AbstractMethodError .record Z {} .function void Z.ctor0(Z a0) .function void Z.ctor2(Z a0, i32 a1, i32 a2) .function i32 main() { begin: %s initobj.short %s end: ldai 1 # Should not reach this line return catch_AME: ldai 0 # Expected panda.AbstractMethodError return catch_all: ldai 2 # Unexpected exception, test failed return .catch panda.AbstractMethodError, begin, end, catch_AME .catchall begin, end, catch_all check-type: none cases: - values: - "" - Z.ctor0 tags: ['tsan'] - values: - | # movi v1, 10 movi v2, 20 - Z.ctor2, v1, v2 - file-name: 'ame_j' isa: exceptions: - x_abstract description: Create objects with 'initobj.short' instruction with AbstractMethodError in PandaAssembly context header-template: [PandaAssembly] runner-options: [use-pa] tags: ['irtoc_ignore'] bugid: ['3625'] code-template: | .record panda.AbstractMethodError .record Z {} .function void Z.ctor0(Z a0) .function void Z.ctor2(Z a0, i32 a1, i32 a2) .function i32 main() { begin: %s initobj.short %s end: ldai 1 # Should not reach this line return catch_AME: ldai 0 # Expected panda.AbstractMethodError return catch_all: ldai 2 # Unexpected exception, test failed return .catch panda.AbstractMethodError, begin, end, catch_AME .catchall begin, end, catch_all check-type: none cases: - values: - "" - Z.ctor0 - values: - | # movi v3, 30 movi v4, 40 - Z.ctor2, v3, v4 tags: ['tsan'] - file-name: "regs_restored_p" isa: description: | Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to the newly created object into accumulator. method_id should resolve to an initializer. description: Check 'initobj.short' that registers are restored after the initializer call PandaAssembly context. tags: ['tsan'] header-template: [] code-template: | .record R {} .function void R.ctor2(R a0, i16 a1, i32 a2) { movi a1, -100 movi a2, -200 movi v0, 100 movi v1, 200 movi v2, 300 movi v3, 400 movi v4, 500 movi v5, 600 movi v6, 700 movi v7, 800 movi v8, 900 movi v9, 1000 movi v10, 1100 movi v11, 1200 movi v12, 1300 movi v13, 1400 movi v14, 1500 movi v15, 1600 return.void } .function i32 main() { movi v0, 1 movi v1, 2 movi v2, 3 movi v3, 4 movi v4, 5 movi v5, 6 movi v6, 7 movi v7, 8 movi v8, 9 movi v9, 10 movi v10, 11 movi v11, 12 movi v12, 13 movi v13, 14 movi v14, 15 movi v15, 16 initobj.short R.ctor2, v1, v2 initobj.short R.ctor2, v3, v4 initobj.short R.ctor2, v5, v6 initobj.short R.ctor2, v7, v8 initobj.short R.ctor2, v9, v10 initobj.short R.ctor2, v11, v12 initobj.short R.ctor2, v13, v14 initobj.short R.ctor2, v15, v0 ldai 1 jeq v0, ok1 return ok1: ldai 2 jeq v1, ok2 return ok2: ldai 3 jeq v2, ok3 return ok3: ldai 4 jeq v3, ok4 return ok4: ldai 5 jeq v4, ok5 return ok5: ldai 6 jeq v5, ok6 return ok6: ldai 7 jeq v6, ok7 return ok7: ldai 8 jeq v7, ok8 return ok8: ldai 9 jeq v8, ok9 return ok9: ldai 10 jeq v9, ok10 return ok10: ldai 11 jeq v10, ok11 return ok11: ldai 12 jeq v11, ok12 return ok12: ldai 13 jeq v12, ok13 return ok13: ldai 14 jeq v13, ok14 return ok14: ldai 15 jeq v14, ok15 return ok15: ldai 16 jeq v15, ok16 return ok16: check-type: exit-positive - file-name: "regs_restored_j" isa: description: | Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to the newly created object into accumulator. method_id should resolve to an initializer. description: Check 'initobj.short' that registers are restored after the initializer call PandaAssembly context. header-template: [PandaAssembly] tags: ['tsan'] runner-options: [use-pa] code-template: | .record R {} .function void R.ctor2(R a0, i16 a1, i32 a2) { movi a1, -100 movi a2, -200 movi v0, 100 movi v1, 200 movi v2, 300 movi v3, 400 movi v4, 500 movi v5, 600 movi v6, 700 movi v7, 800 movi v8, 900 movi v9, 1000 movi v10, 1100 movi v11, 1200 movi v12, 1300 movi v13, 1400 movi v14, 1500 movi v15, 1600 return.void } .function i32 main() { movi v0, 1 movi v1, 2 movi v2, 3 movi v3, 4 movi v4, 5 movi v5, 6 movi v6, 7 movi v7, 8 movi v8, 9 movi v9, 10 movi v10, 11 movi v11, 12 movi v12, 13 movi v13, 14 movi v14, 15 movi v15, 16 initobj.short R.ctor2, v1, v2 initobj.short R.ctor2, v3, v4 initobj.short R.ctor2, v5, v6 initobj.short R.ctor2, v7, v8 initobj.short R.ctor2, v9, v10 initobj.short R.ctor2, v11, v12 initobj.short R.ctor2, v13, v14 initobj.short R.ctor2, v15, v0 ldai 1 jeq v0, ok1 return ok1: ldai 2 jeq v1, ok2 return ok2: ldai 3 jeq v2, ok3 return ok3: ldai 4 jeq v3, ok4 return ok4: ldai 5 jeq v4, ok5 return ok5: ldai 6 jeq v5, ok6 return ok6: ldai 7 jeq v6, ok7 return ok7: ldai 8 jeq v7, ok8 return ok8: ldai 9 jeq v8, ok9 return ok9: ldai 10 jeq v9, ok10 return ok10: ldai 11 jeq v10, ok11 return ok11: ldai 12 jeq v11, ok12 return ok12: ldai 13 jeq v12, ok13 return ok13: ldai 14 jeq v13, ok14 return ok14: ldai 15 jeq v14, ok15 return ok15: ldai 16 jeq v15, ok16 return ok16: check-type: exit-positive - file-name: "valid_static_initializer_p" isa: description: | Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to the newly created object into accumulator. method_id should resolve to an initializer. description: Check 'initobj.short' with static initializer in PandaAssembly context. header-template: [] code-template: | .record R { i32 cnt } .function void R.ctor(R a0) { ldstatic R.cnt addi 1 ststatic R.cnt return.void } .function void R.cctor() { ldstatic R.cnt addi 1 ststatic R.cnt return.void } .function i32 main() { initobj.short R.ctor initobj.short R.ctor ldstatic R.cnt movi v0, 3 jeq v0, ok ldai 20 return ok: check-type: exit-positive - file-name: "valid_static_initializer_j" isa: description: | Resolve class type from initializer method_id, allocate memory for an object, initialize its fields with their default values (i.e. 0 for primitives and null for objects), call specified initializer and put a reference to the newly created object into accumulator. method_id should resolve to an initializer. description: Check 'initobj.short' with static initializer in PandaAssembly context. runner-options: [use-pa] header-template: [PandaAssembly] code-template: | .record R { i32 cnt } .function void R.cctor() { ldstatic R.cnt addi 1 ststatic R.cnt return.void } .function void R.ctor(R a0) { ldstatic R.cnt addi 1 ststatic R.cnt return.void } .record Q {} .function void Q.ctor(Q a0) { ldstatic R.cnt addi 1 ststatic R.cnt return.void } .function i32 main() { initobj.short Q.ctor initobj.short Q.ctor ldstatic R.cnt movi v0, 3 jeq v0, ok ldai 20 return ok: check-type: exit-positive