# 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. # Check that OOM during string resolving is handled correctly .record panda.Object .record panda.Class .record panda.OutOfMemoryError .record Object .function panda.Object Object.createNonMovable(panda.Class a0) .record A { A next i64 f0 i64 f1 i64 f2 i64 f3 i64 f4 i64 f5 i64 f6 i64 f7 i64 f8 i64 f9 i64 f10 i64 f11 i64 f12 i64 f13 i64 f14 i64 f15 i64 f16 i64 f17 i64 f18 i64 f19 } .function void A.ctor(A a0) { return.void } .function i32 main() { movi v0, 10000000 movi v1, 0 lda.type A sta.obj v3 call Object.createNonMovable, v3 checkcast A sta.obj v3 call.short A.ctor, v3 mov.obj v6, v3 label_1: lda v1 jge v0, label_0 lda.type A sta.obj v4 call Object.createNonMovable, v4 checkcast A sta.obj v4 call.short A.ctor, v4 stobj.v.obj v4, v3, A.next mov.obj v3, v4 inci v1, 1 label_1end: jmp label_1 label_1catch: jmp label_0 label_0: lda.str "abcdef" ldai 1 return label_2: ldai 0 return .catch panda.OutOfMemoryError, label_1, label_1end, label_1catch .catch panda.OutOfMemoryError, label_0, label_2, label_2 }