Text file
src/reflect/asm_arm64.s
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.
29 TEXT ·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 #ifdef GOEXPERIMENT_regabiargs
37 MOVD R26, R0
38 MOVD R20, R1
39 #else
40 MOVD R26, 8(RSP)
41 MOVD R20, 16(RSP)
42 #endif
43 CALL ·moveMakeFuncArgPtrs<ABIInternal>(SB)
44 MOVD 32(RSP), R26
45 MOVD R26, 8(RSP)
46 MOVD $argframe+0(FP), R3
47 MOVD R3, 16(RSP)
48 MOVB $0, LOCAL_RETVALID(RSP)
49 ADD $LOCAL_RETVALID, RSP, R3
50 MOVD R3, 24(RSP)
51 ADD $LOCAL_REGARGS, RSP, R3
52 MOVD R3, 32(RSP)
53 CALL ·callReflect(SB)
54 ADD $LOCAL_REGARGS, RSP, R20
55 CALL runtime·unspillArgs(SB)
56 RET
57
58 // methodValueCall is the code half of the function returned by makeMethodValue.
59 // See the comment on the declaration of methodValueCall in makefunc.go
60 // for more details.
61 // No arg size here; runtime pulls arg map out of the func value.
62 TEXT ·methodValueCall(SB),(NOSPLIT|WRAPPER),$432
63 NO_LOCAL_POINTERS
64 // NO_LOCAL_POINTERS is a lie. The stack map for the two locals in this
65 // frame is specially handled in the runtime. See the comment above LOCAL_RETVALID.
66 ADD $LOCAL_REGARGS, RSP, R20
67 CALL runtime·spillArgs(SB)
68 MOVD R26, 32(RSP) // outside of moveMakeFuncArgPtrs's arg area
69 #ifdef GOEXPERIMENT_regabiargs
70 MOVD R26, R0
71 MOVD R20, R1
72 #else
73 MOVD R26, 8(RSP)
74 MOVD R20, 16(RSP)
75 #endif
76 CALL ·moveMakeFuncArgPtrs<ABIInternal>(SB)
77 MOVD 32(RSP), R26
78 MOVD R26, 8(RSP)
79 MOVD $argframe+0(FP), R3
80 MOVD R3, 16(RSP)
81 MOVB $0, LOCAL_RETVALID(RSP)
82 ADD $LOCAL_RETVALID, RSP, R3
83 MOVD R3, 24(RSP)
84 ADD $LOCAL_REGARGS, RSP, R3
85 MOVD R3, 32(RSP)
86 CALL ·callMethod(SB)
87 ADD $LOCAL_REGARGS, RSP, R20
88 CALL runtime·unspillArgs(SB)
89 RET
90
View as plain text