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# This is an auxiliary file with some basics classes that can be used in checked tests with inter-file communication 15# It is written in pure PandaAssembly i.e. some features are not available e.g. inheritance (it is available only with 16# java extension). 17# The file would be AOT compiled as well. 18# 19 20.record A { 21 i32 data 22} 23 24#! CHECKER ExternalAOT 25#! RUN_PAOC options: "" 26.function i32 A.getConst() <static> { 27 ldai 1 28 return 29} 30 31.function i32 A.getConst_virt(A a0) { 32 ldai 2 33 return 34} 35 36.function i32 A.getParam(i32 a0) <static> { 37 lda a0 38 return 39} 40 41.function i32 A.getParam_virt(A a0, i32 a1) { 42 lda a1 43 return 44} 45 46.function void A.getVoid() <static> { 47 return.void 48} 49 50.function void A.getVoid_virt(A a0) { 51 return.void 52} 53 54.function i32 A.getObj(A a0) <static> { 55 ldobj a0, A.data 56 return 57} 58 59.function i32 A.getObj_virt(A a0) { 60 ldobj a0, A.data 61 return 62} 63 64.function void A.setObj(A a0, i32 a1) <static> { 65 lda a1 66 stobj a0, A.data 67 return.void 68} 69 70.function void A.setObjConst_virt(A a0) { 71 ldai 0x9 72 stobj a0, A.data 73 return.void 74} 75 76.function void A.setObj_virt(A a0, i32 a1) { 77 lda a1 78 stobj a0, A.data 79 return.void 80} 81 82.function i32 A.getObj_wrong_virt(A a0, A a1) { 83 ldobj a1, A.data 84 return 85} 86 87.function void A.setObj_wrong_virt(A a0, i32 a1, A a2) { 88 lda a1 89 stobj a2, A.data 90 return.void 91} 92 93.function void A.setObj_multiple(A a0, i32 a1, i32 a2) <static> { 94 lda a1 95 stobj a0, A.data 96 lda a2 97 stobj a0, A.data 98 return.void 99} 100 101.function i32 A.complexMethod(A a0) { 102 ldobj a0, A.data 103 sta v0 104 ldai 42 105 jne v0, label_1 106 mul v0, v0 107 return 108label_1: 109 movi v1, 42 110 add v0, v1 111 return 112}