...
Text file
src/reflect/asm_arm64.s
Documentation: reflect
1// Copyright 2012 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5#include "textflag.h"
6#include "funcdata.h"
7
8// The frames of each of the two functions below contain two locals, at offsets
9// that are known to the runtime.
10//
11// The first local is a bool called retValid with a whole pointer-word reserved
12// for it on the stack. The purpose of this word is so that the runtime knows
13// whether the stack-allocated return space contains valid values for stack
14// scanning.
15//
16// The second local is an abi.RegArgs value whose offset is also known to the
17// runtime, so that a stack map for it can be constructed, since it contains
18// pointers visible to the GC.
19#define LOCAL_RETVALID 40
20#define LOCAL_REGARGS 48
21
22// The frame size of the functions below is
23// 32 (args of callReflect) + 8 (bool + padding) + 392 (abi.RegArgs) = 432.
24
25// makeFuncStub is the code half of the function returned by MakeFunc.
26// See the comment on the declaration of makeFuncStub in makefunc.go
27// for more details.
28// No arg size here, runtime pulls arg map out of the func value.
29TEXT ·makeFuncStub(SB),(NOSPLIT|WRAPPER),$432
30 NO_LOCAL_POINTERS
31 // NO_LOCAL_POINTERS is a lie. The stack map for the two locals in this
32 // frame is specially handled in the runtime. See the comment above LOCAL_RETVALID.
33 ADD $LOCAL_REGARGS, RSP, R20
34 CALL runtime·spillArgs(SB)
35 MOVD R26, 32(RSP) // outside of moveMakeFuncArgPtrs's arg area
36 MOVD R26, R0
37 MOVD R20, R1
38 CALL ·moveMakeFuncArgPtrs<ABIInternal>(SB)
39 MOVD 32(RSP), R26
40 MOVD R26, 8(RSP)
41 MOVD $argframe+0(FP), R3
42 MOVD R3, 16(RSP)
43 MOVB $0, LOCAL_RETVALID(RSP)
44 ADD $LOCAL_RETVALID, RSP, R3
45 MOVD R3, 24(RSP)
46 ADD $LOCAL_REGARGS, RSP, R3
47 MOVD R3, 32(RSP)
48 CALL ·callReflect(SB)
49 ADD $LOCAL_REGARGS, RSP, R20
50 CALL runtime·unspillArgs(SB)
51 RET
52
53// methodValueCall is the code half of the function returned by makeMethodValue.
54// See the comment on the declaration of methodValueCall in makefunc.go
55// for more details.
56// No arg size here; runtime pulls arg map out of the func value.
57TEXT ·methodValueCall(SB),(NOSPLIT|WRAPPER),$432
58 NO_LOCAL_POINTERS
59 // NO_LOCAL_POINTERS is a lie. The stack map for the two locals in this
60 // frame is specially handled in the runtime. See the comment above LOCAL_RETVALID.
61 ADD $LOCAL_REGARGS, RSP, R20
62 CALL runtime·spillArgs(SB)
63 MOVD R26, 32(RSP) // outside of moveMakeFuncArgPtrs's arg area
64 MOVD R26, R0
65 MOVD R20, R1
66 CALL ·moveMakeFuncArgPtrs<ABIInternal>(SB)
67 MOVD 32(RSP), R26
68 MOVD R26, 8(RSP)
69 MOVD $argframe+0(FP), R3
70 MOVD R3, 16(RSP)
71 MOVB $0, LOCAL_RETVALID(RSP)
72 ADD $LOCAL_RETVALID, RSP, R3
73 MOVD R3, 24(RSP)
74 ADD $LOCAL_REGARGS, RSP, R3
75 MOVD R3, 32(RSP)
76 CALL ·callMethod(SB)
77 ADD $LOCAL_REGARGS, RSP, R20
78 CALL runtime·unspillArgs(SB)
79 RET
View as plain text