# 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. .record panda.String .record panda.Object #! CHECKER Removing RefTypeCheck for string arrays #! RUN force_jit: true, options: "", entry: "_GLOBAL::main" #! EVENT /Compilation,_GLOBAL::main,.*COMPILED/ #! METHOD "_GLOBAL::main" #! PASS_AFTER "IrBuilder" #! INST "RefTypeCheck" #! INST "LoadString" #! INST "NewArray" #! PASS_AFTER "ChecksElimination" #! INST "LoadString" #! INST "NewArray" #! INST_NOT "RefTypeCheck " .function u1 main() { movi v0, 1 #sizeof(array) newarr v1, v0, panda.String[] movi v2, 0 #index lda.str "Hello!" starr.obj v1, v2 ldai 0 return } #! CHECKER Removing RefTypeCheck for panda.Object INT mode #! RUN options: "--compiler-enable-jit=false", entry: "_GLOBAL::main1" #! CHECKER Removing RefTypeCheck for panda.Object #! RUN force_jit: true, options: "", entry: "_GLOBAL::main1" #! METHOD "_GLOBAL::store_string__noinline__" #! PASS_AFTER "IrBuilder" #! INST "RefTypeCheck" #! INST "NewArray" #! PASS_AFTER "ChecksElimination" #! INST "NewArray" #! INST_NOT "RefTypeCheck " .function panda.Object[] store_string__noinline__(panda.String a0) { movi v0, 1 #sizeof(array) newarr v1, v0, panda.Object[] movi v2, 0 #index lda.obj a0 starr.obj v1, v2 lda.obj v1 return.obj } .function u1 main1() { lda.str "Hello!" sta.obj v0 call store_string__noinline__, v0 sta.obj v1 ldai 0 #index ldarr.obj v1 jne.obj v0, error_exit ldai 0 return error_exit: ldai 1 return }