Text file
src/reflect/asm_s390x.s
Documentation: reflect
1// Copyright 2016 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
20#define LOCAL_RETVALID 40
21#define LOCAL_REGARGS 48
22
23// The frame size of the functions below is
24// 32 (args of callReflect/callMethod) + 8 (bool + padding) + 264 (abi.RegArgs) = 304.
25
26// makeFuncStub is the code half of the function returned by MakeFunc.
27// See the comment on the declaration of makeFuncStub in makefunc.go
28// for more details.
29// No arg size here, runtime pulls arg map out of the func value.
30TEXT ·makeFuncStub(SB),(NOSPLIT|WRAPPER),$304
31 NO_LOCAL_POINTERS
32 ADD $LOCAL_REGARGS, R15, R10 // spillArgs using R10
33 BL runtime·spillArgs(SB)
34 MOVD R12, 32(R15) // save context reg R12 > args of moveMakeFuncArgPtrs < LOCAL_REGARGS
35#ifdef GOEXPERIMENT_regabiargs
36 MOVD R12, R2
37 MOVD R10, R3
38#else
39 MOVD R12, 8(R15)
40 MOVD R10, 16(R15)
41#endif
42 BL ·moveMakeFuncArgPtrs<ABIInternal>(SB)
43 MOVD 32(R15), R12 // restore context reg R12
44 MOVD R12, 8(R15)
45 MOVD $argframe+0(FP), R1
46 MOVD R1, 16(R15)
47 MOVB $0, LOCAL_RETVALID(R15)
48 ADD $LOCAL_RETVALID, R15, R1
49 MOVD R1, 24(R15)
50 ADD $LOCAL_REGARGS, R15, R1
51 MOVD R1, 32(R15)
52 BL ·callReflect(SB)
53 ADD $LOCAL_REGARGS, R15, R10 // unspillArgs using R10
54 BL runtime·unspillArgs(SB)
55 RET
56
57// methodValueCall is the code half of the function returned by makeMethodValue.
58// See the comment on the declaration of methodValueCall in makefunc.go
59// for more details.
60// No arg size here; runtime pulls arg map out of the func value.
61TEXT ·methodValueCall(SB),(NOSPLIT|WRAPPER),$304
62 NO_LOCAL_POINTERS
63 ADD $LOCAL_REGARGS, R15, R10 // spillArgs using R10
64 BL runtime·spillArgs(SB)
65 MOVD R12, 32(R15) // save context reg R12 > args of moveMakeFuncArgPtrs < LOCAL_REGARGS
66#ifdef GOEXPERIMENT_regabiargs
67 MOVD R12, R2
68 MOVD R10, R3
69#else
70 MOVD R12, 8(R15)
71 MOVD R10, 16(R15)
72#endif
73 BL ·moveMakeFuncArgPtrs<ABIInternal>(SB)
74 MOVD 32(R15), R12 // restore context reg R12
75 MOVD R12, 8(R15)
76 MOVD $argframe+0(FP), R1
77 MOVD R1, 16(R15)
78 MOVB $0, LOCAL_RETVALID(R15)
79 ADD $LOCAL_RETVALID, R15, R1
80 MOVD R1, 24(R15)
81 ADD $LOCAL_REGARGS, R15, R1
82 MOVD R1, 32(R15)
83 BL ·callMethod(SB)
84 ADD $LOCAL_REGARGS, R15, R10 // unspillArgs using R10
85 BL runtime·unspillArgs(SB)
86 RET
View as plain text