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 14.record panda.String <external> 15.record panda.Object <external> 16 17#! CHECKER Removing RefTypeCheck for string arrays 18#! RUN force_jit: true, options: "", entry: "_GLOBAL::main" 19#! EVENT /Compilation,_GLOBAL::main,.*COMPILED/ 20#! METHOD "_GLOBAL::main" 21#! PASS_AFTER "IrBuilder" 22#! INST "RefTypeCheck" 23#! INST "LoadString" 24#! INST "NewArray" 25#! PASS_AFTER "ChecksElimination" 26#! INST "LoadString" 27#! INST "NewArray" 28#! INST_NOT "RefTypeCheck " 29 30.function u1 main() { 31 movi v0, 1 #sizeof(array) 32 newarr v1, v0, panda.String[] 33 movi v2, 0 #index 34 lda.str "Hello!" 35 starr.obj v1, v2 36 ldai 0 37 return 38} 39 40#! CHECKER Removing RefTypeCheck for panda.Object INT mode 41#! RUN options: "--compiler-enable-jit=false", entry: "_GLOBAL::main1" 42 43#! CHECKER Removing RefTypeCheck for panda.Object 44#! RUN force_jit: true, options: "", entry: "_GLOBAL::main1" 45#! METHOD "_GLOBAL::store_string__noinline__" 46#! PASS_AFTER "IrBuilder" 47#! INST "RefTypeCheck" 48#! INST "NewArray" 49#! PASS_AFTER "ChecksElimination" 50#! INST "NewArray" 51#! INST_NOT "RefTypeCheck " 52.function panda.Object[] store_string__noinline__(panda.String a0) <static> { 53 movi v0, 1 #sizeof(array) 54 newarr v1, v0, panda.Object[] 55 movi v2, 0 #index 56 lda.obj a0 57 starr.obj v1, v2 58 lda.obj v1 59 return.obj 60} 61 62.function u1 main1() { 63 lda.str "Hello!" 64 sta.obj v0 65 call store_string__noinline__, v0 66 sta.obj v1 67 ldai 0 #index 68 ldarr.obj v1 69 jne.obj v0, error_exit 70 ldai 0 71 return 72error_exit: 73 ldai 1 74 return 75} 76