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# Check that OOM during string resolving is handled correctly 15 16.record panda.Object <external> 17.record panda.Class <external> 18.record panda.OutOfMemoryError <external> 19.record Object <external> 20 21.function panda.Object Object.createNonMovable(panda.Class a0) <external> 22 23.record A { 24 A next 25 26 i64 f0 27 i64 f1 28 i64 f2 29 i64 f3 30 i64 f4 31 i64 f5 32 i64 f6 33 i64 f7 34 i64 f8 35 i64 f9 36 37 i64 f10 38 i64 f11 39 i64 f12 40 i64 f13 41 i64 f14 42 i64 f15 43 i64 f16 44 i64 f17 45 i64 f18 46 i64 f19 47} 48 49.function void A.ctor(A a0) <ctor> { 50 return.void 51} 52 53.function i32 main() { 54 movi v0, 10000000 55 movi v1, 0 56 lda.type A 57 sta.obj v3 58 call Object.createNonMovable, v3 59 checkcast A 60 sta.obj v3 61 call.short A.ctor, v3 62 mov.obj v6, v3 63label_1: 64 lda v1 65 jge v0, label_0 66 lda.type A 67 sta.obj v4 68 call Object.createNonMovable, v4 69 checkcast A 70 sta.obj v4 71 call.short A.ctor, v4 72 stobj.v.obj v4, v3, A.next 73 mov.obj v3, v4 74 inci v1, 1 75label_1end: 76 jmp label_1 77label_1catch: 78 jmp label_0 79label_0: 80 lda.str "abcdef" 81 ldai 1 82 return 83label_2: 84 ldai 0 85 return 86 87.catch panda.OutOfMemoryError, label_1, label_1end, label_1catch 88.catch panda.OutOfMemoryError, label_0, label_2, label_2 89} 90