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#! CHECKER Check that save state gracefully handle 0 when optimizations are disabled, test for 5372 15#! RUN force_jit: true, options: "--compiler-non-optimizing=true", entry: "_GLOBAL::main0" 16#! EVENT /Compilation,_GLOBAL::main0,.*COMPILED/ 17 18#! CHECKER Check that save state correctly propogated in presense of null ref, test for 5372 19#! RUN force_jit: true, options: "--compiler-lowering=false", entry: "_GLOBAL::main1" 20#! EVENT /Compilation,_GLOBAL::main1,.*COMPILED/ 21 22.record E {} 23 24.function void __noinline__call(u64 a0) { 25 newobj v0, E 26 throw v0 27} 28 29.function u1 main0() { 30 movi.64 v0, 0 31try_begin: 32 call __noinline__call, v0 33 ldai 1 34 return 35try_end: 36catch_begin: 37 ldai 0 38 return 39.catchall try_begin, try_end, catch_begin 40} 41 42.record C {} 43.record IO <external> 44# fake mehod, never used 45.function void IO.printObj(E a0) <external> 46 47.function void C.static__noinline__call(E a0) <static> { 48 return.void 49} 50 51.function void delegate_call(E a0) { 52 call C.static__noinline__call, a0 53 return.void 54} 55 56.function u1 main1() { 57 mov.null v0 58 newobj v1, E 59try_begin: 60 call delegate_call, v1 61 ldai 0 62 return 63try_end: 64catch_begin: 65 call.short IO.printObj, v0 66 ldai 0 67 return 68.catchall try_begin, try_end, catch_begin 69}