1# Copyright (c) 2021-2024 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 E1 {} 15.record E2 <extends=E1> {} 16.record E3 <extends=E2> {} 17 18.function u1 E1.f(E1 a0) { 19 ldai 10 20 return 21} 22 23.function u1 E2.f(E2 a0) { 24 ldai 0 25 return 26} 27 28.function u1 E3.f(E3 a0) { 29 ldai 20 30 return 31} 32 33.function u1 f1() { 34 newobj v0, E2 35try_begin: 36 throw v0 37 ldai 2 38 return 39try_end: 40 41catch_block_begin: 42 ldai 1 43 return 44 45.catch E3, try_begin, try_end, catch_block_begin 46} 47 48.function u1 f2() { 49try_begin: 50 call f1 51 return 52try_end: 53 54catch_block1_begin: 55 sta.obj v0 56 call.virt E1.f, v0 57 return 58 59catch_block2_begin: 60 ldai 2 61 return 62 63catch_block3_begin: 64 ldai 3 65 return 66 67.catch E1, try_begin, try_end, catch_block1_begin 68.catch E2, try_begin, try_end, catch_block2_begin 69.catchall try_begin, try_end, catch_block3_begin 70} 71 72.function u1 main() { 73 call f2 74 return 75} 76