...
Text file
src/reflect/asm_amd64.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#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// makeFuncStub must be ABIInternal because it is placed directly
28// in function values.
29// This frame contains two locals. See the comment above LOCAL_RETVALID.
30TEXT ·makeFuncStub<ABIInternal>(SB),(NOSPLIT|WRAPPER),$312
31 NO_LOCAL_POINTERS
32 // NO_LOCAL_POINTERS is a lie. The stack map for the two locals in this
33 // frame is specially handled in the runtime. See the comment above LOCAL_RETVALID.
34 LEAQ LOCAL_REGARGS(SP), R12
35 CALL runtime·spillArgs<ABIInternal>(SB)
36 MOVQ DX, 24(SP) // outside of moveMakeFuncArgPtrs's arg area
37 MOVQ DX, 0(SP)
38 MOVQ R12, 8(SP)
39 CALL ·moveMakeFuncArgPtrs(SB)
40 MOVQ 24(SP), DX
41 MOVQ DX, 0(SP)
42 LEAQ argframe+0(FP), CX
43 MOVQ CX, 8(SP)
44 MOVB $0, LOCAL_RETVALID(SP)
45 LEAQ LOCAL_RETVALID(SP), AX
46 MOVQ AX, 16(SP)
47 LEAQ LOCAL_REGARGS(SP), AX
48 MOVQ AX, 24(SP)
49 CALL ·callReflect(SB)
50 LEAQ LOCAL_REGARGS(SP), R12
51 CALL runtime·unspillArgs<ABIInternal>(SB)
52 RET
53
54// methodValueCall is the code half of the function returned by makeMethodValue.
55// See the comment on the declaration of methodValueCall in makefunc.go
56// for more details.
57// No arg size here; runtime pulls arg map out of the func value.
58// methodValueCall must be ABIInternal because it is placed directly
59// in function values.
60// This frame contains two locals. See the comment above LOCAL_RETVALID.
61TEXT ·methodValueCall<ABIInternal>(SB),(NOSPLIT|WRAPPER),$312
62 NO_LOCAL_POINTERS
63 // NO_LOCAL_POINTERS is a lie. The stack map for the two locals in this
64 // frame is specially handled in the runtime. See the comment above LOCAL_RETVALID.
65 LEAQ LOCAL_REGARGS(SP), R12
66 CALL runtime·spillArgs<ABIInternal>(SB)
67 MOVQ DX, 24(SP) // outside of moveMakeFuncArgPtrs's arg area
68 MOVQ DX, 0(SP)
69 MOVQ R12, 8(SP)
70 CALL ·moveMakeFuncArgPtrs(SB)
71 MOVQ 24(SP), DX
72 MOVQ DX, 0(SP)
73 LEAQ argframe+0(FP), CX
74 MOVQ CX, 8(SP)
75 MOVB $0, LOCAL_RETVALID(SP)
76 LEAQ LOCAL_RETVALID(SP), AX
77 MOVQ AX, 16(SP)
78 LEAQ LOCAL_REGARGS(SP), AX
79 MOVQ AX, 24(SP)
80 CALL ·callMethod(SB)
81 LEAQ LOCAL_REGARGS(SP), R12
82 CALL runtime·unspillArgs<ABIInternal>(SB)
83 RET
View as plain text