# 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. #! CHECKER Use implicit NullCheck for array and object #! SKIP_IF @architecture == "arm32" #! RUN force_jit: true, options: "", entry: "_GLOBAL::main" #! EVENT /Compilation,.*__noinline__call_ldarray.*/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Compilation,.*__noinline__call_starray.*/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Compilation,.*__noinline__call_ldobj_i32.*/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Compilation,.*__noinline__call_stobj_i32.*/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Compilation,.*__noinline__call_ldobj_f64.*/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Compilation,.*__noinline__call_stobj_f64.*/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Compilation,.*__noinline__call_ldobj_obj.*/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Compilation,.*__noinline__call_stobj_obj.*/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! CHECKER Use implicit NullCheck for array and object in AOT #! SKIP_IF @architecture == "arm32" #! RUN_PAOC options: "" #! EVENT /Compilation,.*__noinline__call_ldarray.*/ #! EVENT /Compilation,.*__noinline__call_starray.*/ #! EVENT /Compilation,.*__noinline__call_ldobj_i32.*/ #! EVENT /Compilation,.*__noinline__call_stobj_i32.*/ #! RUN options: "", entry: "_GLOBAL::main" #! EVENT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Exception,.*__noinline__call_ldarray.*NULL_CHECK/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Exception,.*__noinline__call_starray.*NULL_CHECK/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Exception,.*__noinline__call_ldobj_i32.*NULL_CHECK/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Exception,.*__noinline__call_stobj_i32.*NULL_CHECK/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Exception,.*__noinline__call_ldobj_f64.*NULL_CHECK/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Exception,.*__noinline__call_stobj_f64.*NULL_CHECK/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Exception,.*__noinline__call_ldobj_obj.*NULL_CHECK/ #! EVENT_NEXT /ImplicitNullcheck,.*/ #! EVENT_NEXT /Exception,.*__noinline__call_stobj_obj.*NULL_CHECK/ .record panda.String .record panda.NullPointerException .function panda.String panda.NullPointerException.getMessage(panda.NullPointerException a0) .record A { i32 data f64 data_f64 A data_obj } .function i32 __noinline__call_ldarray(i32[] a0) { try_begin: ldai 0 ldarr a0 addi 2 return try_end: catch_block1_begin: sta.obj a0 call.virt panda.NullPointerException.getMessage, a0 jnez.obj catch_block2_begin ldai 0 return catch_block2_begin: ldai 1 return .catch panda.NullPointerException, try_begin, try_end, catch_block1_begin .catchall try_begin, try_end, catch_block2_begin } .function i32 __noinline__call_starray(i32[] a0) { try_begin: ldai 0 movi v0, 0 starr a0, v0 ldai 2 return try_end: catch_block1_begin: sta.obj a0 call.virt panda.NullPointerException.getMessage, a0 jnez.obj catch_block2_begin ldai 0 return catch_block2_begin: ldai 1 return .catch panda.NullPointerException, try_begin, try_end, catch_block1_begin .catchall try_begin, try_end, catch_block2_begin } .function i32 __noinline__call_ldobj_i32(A a0) { try_begin: ldobj a0, A.data addi 2 return try_end: catch_block1_begin: sta.obj a0 call.virt panda.NullPointerException.getMessage, a0 jnez.obj catch_block2_begin ldai 0 return catch_block2_begin: ldai 1 return .catch panda.NullPointerException, try_begin, try_end, catch_block1_begin .catchall try_begin, try_end, catch_block2_begin } .function i32 __noinline__call_stobj_i32(A a0) { try_begin: ldai 0x9 stobj a0, A.data ldai 2 return try_end: catch_block1_begin: sta.obj a0 call.virt panda.NullPointerException.getMessage, a0 jnez.obj catch_block2_begin ldai 0 return catch_block2_begin: ldai 1 return .catch panda.NullPointerException, try_begin, try_end, catch_block1_begin .catchall try_begin, try_end, catch_block2_begin } .function i32 __noinline__call_ldobj_f64(A a0) { try_begin: ldobj a0, A.data_f64 f64toi32 addi 2 return try_end: catch_block1_begin: sta.obj a0 call.virt panda.NullPointerException.getMessage, a0 jnez.obj catch_block2_begin ldai 0 return catch_block2_begin: ldai 1 return .catch panda.NullPointerException, try_begin, try_end, catch_block1_begin .catchall try_begin, try_end, catch_block2_begin } .function i32 __noinline__call_stobj_f64(A a0) { try_begin: fldai.64 1.1 stobj.64 a0, A.data_f64 ldai 2 return try_end: catch_block1_begin: sta.obj a0 call.virt panda.NullPointerException.getMessage, a0 jnez.obj catch_block2_begin ldai 0 return catch_block2_begin: ldai 1 return .catch panda.NullPointerException, try_begin, try_end, catch_block1_begin .catchall try_begin, try_end, catch_block2_begin } .function i32 __noinline__call_ldobj_obj(A a0) { try_begin: ldobj a0, A.data_obj isinstance A addi 2 return try_end: catch_block1_begin: sta.obj a0 call.virt panda.NullPointerException.getMessage, a0 jnez.obj catch_block2_begin ldai 0 return catch_block2_begin: ldai 1 return .catch panda.NullPointerException, try_begin, try_end, catch_block1_begin .catchall try_begin, try_end, catch_block2_begin } .function i32 __noinline__call_stobj_obj(A a0) { try_begin: newobj v0, A lda.obj v0 stobj a0, A.data_obj ldai 2 return try_end: catch_block1_begin: sta.obj a0 call.virt panda.NullPointerException.getMessage, a0 jnez.obj catch_block2_begin ldai 0 return catch_block2_begin: ldai 1 return .catch panda.NullPointerException, try_begin, try_end, catch_block1_begin .catchall try_begin, try_end, catch_block2_begin } .function u1 main() { mov.null v0 call __noinline__call_ldarray, v0 jnez error_exit_1 call __noinline__call_starray, v0 jnez error_exit_2 call __noinline__call_ldobj_i32, v0 jnez error_exit_3 call __noinline__call_stobj_i32, v0 jnez error_exit_4 call __noinline__call_ldobj_f64, v0 jnez error_exit_5 call __noinline__call_stobj_f64, v0 jnez error_exit_6 call __noinline__call_ldobj_obj, v0 jnez error_exit_7 call __noinline__call_stobj_obj, v0 jnez error_exit_8 ldai 0 return error_exit_1: ldai 1 return error_exit_2: ldai 2 return error_exit_3: ldai 3 return error_exit_4: ldai 4 return error_exit_5: ldai 5 return error_exit_6: ldai 6 error_exit_7: ldai 7 return error_exit_8: ldai 8 return }