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.NullPointerException <external> 16 17.function panda.String panda.NullPointerException.getMessage(panda.NullPointerException a0) <external> 18 19.record R { 20 i32 f1 21} 22 23# check NullPointerException in case of store to the object 24 25.function i32 main() { 26 mov.null v0 27 ldai 0 28 29try_begin: 30 stobj v0, R.f1 31 ldai 2 32try_end: 33 return 34catch_block1_begin: 35 sta.obj v0 36 call.virt panda.NullPointerException.getMessage, v0 37 jnez.obj return_error 38 ldai 0 39 return 40 41catch_block2_begin: 42 ldai 1 43 return 44 45return_error: 46 ldai 1 47 return 48 49.catch panda.NullPointerException, try_begin, try_end, catch_block1_begin 50.catchall try_begin, try_end, catch_block2_begin 51} 52