# 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. .record A { i32 a } .function void A.init(A a0, i32 a1) { lda a1 stobj a0, A.a return.void } .function i32 A.get_a(A a0) { ldobj a0, A.a return } .function i32 main() { movi v0, 42 initobj.short A.init, v0 sta.obj v1 call.virt.short A.get_a, v1 addi -42 jnez exit lda.obj v1 call.virt.acc.short A.get_a, v0, 0 addi -42 exit: return }