Text file
src/reflect/asm_amd64.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 #include "go_asm.h"
8
9 // The frames of each of the two functions below contain two locals, at offsets
10 // that are known to the runtime.
11 //
12 // The first local is a bool called retValid with a whole pointer-word reserved
13 // for it on the stack. The purpose of this word is so that the runtime knows
14 // whether the stack-allocated return space contains valid values for stack
15 // scanning.
16 //
17 // The second local is an abi.RegArgs value whose offset is also known to the
18 // runtime, so that a stack map for it can be constructed, since it contains
19 // pointers visible to the GC.
20 #define LOCAL_RETVALID 32
21 #define LOCAL_REGARGS 40
22
23 // makeFuncStub is the code half of the function returned by MakeFunc.
24 // See the comment on the declaration of makeFuncStub in makefunc.go
25 // for more details.
26 // No arg size here; runtime pulls arg map out of the func value.
27 // This frame contains two locals. See the comment above LOCAL_RETVALID.
28 TEXT ·makeFuncStub(SB),(NOSPLIT|WRAPPER),$312
29 NO_LOCAL_POINTERS
30 // NO_LOCAL_POINTERS is a lie. The stack map for the two locals in this
31 // frame is specially handled in the runtime. See the comment above LOCAL_RETVALID.
32 LEAQ LOCAL_REGARGS(SP), R12
33 CALL runtime·spillArgs(SB)
34 MOVQ DX, 24(SP) // outside of moveMakeFuncArgPtrs's arg area
35 MOVQ DX, 0(SP)
36 MOVQ R12, 8(SP)
37 CALL ·moveMakeFuncArgPtrs(SB)
38 MOVQ 24(SP), DX
39 MOVQ DX, 0(SP)
40 LEAQ argframe+0(FP), CX
41 MOVQ CX, 8(SP)
42 MOVB $0, LOCAL_RETVALID(SP)
43 LEAQ LOCAL_RETVALID(SP), AX
44 MOVQ AX, 16(SP)
45 LEAQ LOCAL_REGARGS(SP), AX
46 MOVQ AX, 24(SP)
47 CALL ·callReflect(SB)
48 LEAQ LOCAL_REGARGS(SP), R12
49 CALL runtime·unspillArgs(SB)
50 RET
51
52 // methodValueCall is the code half of the function returned by makeMethodValue.
53 // See the comment on the declaration of methodValueCall in makefunc.go
54 // for more details.
55 // No arg size here; runtime pulls arg map out of the func value.
56 // This frame contains two locals. See the comment above LOCAL_RETVALID.
57 TEXT ·methodValueCall(SB),(NOSPLIT|WRAPPER),$312
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 LEAQ LOCAL_REGARGS(SP), R12
62 CALL runtime·spillArgs(SB)
63 MOVQ DX, 24(SP) // outside of moveMakeFuncArgPtrs's arg area
64 MOVQ DX, 0(SP)
65 MOVQ R12, 8(SP)
66 CALL ·moveMakeFuncArgPtrs(SB)
67 MOVQ 24(SP), DX
68 MOVQ DX, 0(SP)
69 LEAQ argframe+0(FP), CX
70 MOVQ CX, 8(SP)
71 MOVB $0, LOCAL_RETVALID(SP)
72 LEAQ LOCAL_RETVALID(SP), AX
73 MOVQ AX, 16(SP)
74 LEAQ LOCAL_REGARGS(SP), AX
75 MOVQ AX, 24(SP)
76 CALL ·callMethod(SB)
77 LEAQ LOCAL_REGARGS(SP), R12
78 CALL runtime·unspillArgs(SB)
79 RET
80
View as plain text