# 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 Object .record panda.Object .function void Object.monitorEnter(panda.Object a0) .function void Object.monitorExit(panda.Object a0) .record Obj { i32 data } #! CHECKER Check monitors for inlined functions: lse isn't applied #! RUN force_jit: true, options: "", entry: "_GLOBAL::main" #! EVENT /Inline,_GLOBAL::main,_GLOBAL::foo,.*STATIC,SUCCESS/ #! METHOD "_GLOBAL::main" #! PASS_AFTER "LSE" #! INST "CallStatic.Inlined" #! INST "Monitor" #! INST "LoadObject" #! INST "Monitor" .function i32 foo(Obj a0) { call Object.monitorEnter, a0 ldobj a0, Obj.data sta v0 call Object.monitorExit, a0 lda v0 return } .function u1 main() { newobj v0, Obj ldai 0 stobj v0, Obj.data call.short foo, v0 return } #! CHECKER Check monitors for inlined functions: lse is applied #! RUN force_jit: true, options: "", entry: "_GLOBAL::main1" #! EVENT /Inline,_GLOBAL::main1,_GLOBAL::foo,.*STATIC,SUCCESS/ #! METHOD "_GLOBAL::main1" #! PASS_AFTER "Inline" #! INST "CallStatic.Inlined" #! INST "Monitor" #! INST "LoadObject" #! INST "Monitor" #! PASS_AFTER "LICM" #! INST_NOT "CallStatic.Inlined" #! INST_NOT "Monitor" #! INST "LoadObject" #! PASS_AFTER "LSE" #! INST_NOT "LoadObject" # Inlined function removed on first BranchElimination, but the checker checks second BranchElimination, so LICM is used .function u1 main1() { newobj v0, Obj ldai 0 stobj v0, Obj.data jeqz lable call.short foo, v0 return lable: ldobj v0, Obj.data return }