1b1994897Sopenharmony_ci# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2b1994897Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3b1994897Sopenharmony_ci# you may not use this file except in compliance with the License.
4b1994897Sopenharmony_ci# You may obtain a copy of the License at
5b1994897Sopenharmony_ci#
6b1994897Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0
7b1994897Sopenharmony_ci#
8b1994897Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9b1994897Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10b1994897Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11b1994897Sopenharmony_ci# See the License for the specific language governing permissions and
12b1994897Sopenharmony_ci# limitations under the License.
13b1994897Sopenharmony_ci
14b1994897Sopenharmony_ci# Check that OOM during string resolving is handled correctly
15b1994897Sopenharmony_ci
16b1994897Sopenharmony_ci.record panda.Object <external>
17b1994897Sopenharmony_ci.record panda.Class <external>
18b1994897Sopenharmony_ci.record panda.OutOfMemoryError <external>
19b1994897Sopenharmony_ci.record Object <external>
20b1994897Sopenharmony_ci
21b1994897Sopenharmony_ci.function panda.Object Object.createNonMovable(panda.Class a0) <external>
22b1994897Sopenharmony_ci
23b1994897Sopenharmony_ci.record A {
24b1994897Sopenharmony_ci    A next
25b1994897Sopenharmony_ci
26b1994897Sopenharmony_ci    i64 f0
27b1994897Sopenharmony_ci    i64 f1
28b1994897Sopenharmony_ci    i64 f2
29b1994897Sopenharmony_ci    i64 f3
30b1994897Sopenharmony_ci    i64 f4
31b1994897Sopenharmony_ci    i64 f5
32b1994897Sopenharmony_ci    i64 f6
33b1994897Sopenharmony_ci    i64 f7
34b1994897Sopenharmony_ci    i64 f8
35b1994897Sopenharmony_ci    i64 f9
36b1994897Sopenharmony_ci
37b1994897Sopenharmony_ci    i64 f10
38b1994897Sopenharmony_ci    i64 f11
39b1994897Sopenharmony_ci    i64 f12
40b1994897Sopenharmony_ci    i64 f13
41b1994897Sopenharmony_ci    i64 f14
42b1994897Sopenharmony_ci    i64 f15
43b1994897Sopenharmony_ci    i64 f16
44b1994897Sopenharmony_ci    i64 f17
45b1994897Sopenharmony_ci    i64 f18
46b1994897Sopenharmony_ci    i64 f19
47b1994897Sopenharmony_ci}
48b1994897Sopenharmony_ci
49b1994897Sopenharmony_ci.function void A.ctor(A a0) <ctor> {
50b1994897Sopenharmony_ci    return.void
51b1994897Sopenharmony_ci}
52b1994897Sopenharmony_ci
53b1994897Sopenharmony_ci.function i32 main() {
54b1994897Sopenharmony_ci    movi v0, 10000000
55b1994897Sopenharmony_ci    movi v1, 0
56b1994897Sopenharmony_ci    lda.type A
57b1994897Sopenharmony_ci    sta.obj v3
58b1994897Sopenharmony_ci    call Object.createNonMovable, v3
59b1994897Sopenharmony_ci    checkcast A
60b1994897Sopenharmony_ci    sta.obj v3
61b1994897Sopenharmony_ci    call.short A.ctor, v3
62b1994897Sopenharmony_ci    mov.obj v6, v3
63b1994897Sopenharmony_cilabel_1:
64b1994897Sopenharmony_ci    lda v1
65b1994897Sopenharmony_ci    jge v0, label_0
66b1994897Sopenharmony_ci    lda.type A
67b1994897Sopenharmony_ci    sta.obj v4
68b1994897Sopenharmony_ci    call Object.createNonMovable, v4
69b1994897Sopenharmony_ci    checkcast A
70b1994897Sopenharmony_ci    sta.obj v4
71b1994897Sopenharmony_ci    call.short A.ctor, v4
72b1994897Sopenharmony_ci    stobj.v.obj v4, v3, A.next
73b1994897Sopenharmony_ci    mov.obj v3, v4
74b1994897Sopenharmony_ci    inci v1, 1
75b1994897Sopenharmony_cilabel_1end:
76b1994897Sopenharmony_ci    jmp label_1
77b1994897Sopenharmony_cilabel_1catch:
78b1994897Sopenharmony_ci    jmp label_0
79b1994897Sopenharmony_cilabel_0:
80b1994897Sopenharmony_ci    lda.str "abcdef"
81b1994897Sopenharmony_ci    ldai 1
82b1994897Sopenharmony_ci    return
83b1994897Sopenharmony_cilabel_2:
84b1994897Sopenharmony_ci    ldai 0
85b1994897Sopenharmony_ci    return
86b1994897Sopenharmony_ci
87b1994897Sopenharmony_ci.catch panda.OutOfMemoryError, label_1, label_1end, label_1catch
88b1994897Sopenharmony_ci.catch panda.OutOfMemoryError, label_0, label_2, label_2
89b1994897Sopenharmony_ci}
90