Text file
src/reflect/asm_loong64.s
1 // Copyright 2022 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 #define REGCTXT R29
9
10 // The frames of each of the two functions below contain two locals, at offsets
11 // that are known to the runtime.
12 //
13 // The first local is a bool called retValid with a whole pointer-word reserved
14 // for it on the stack. The purpose of this word is so that the runtime knows
15 // whether the stack-allocated return space contains valid values for stack
16 // scanning.
17 //
18 // The second local is an abi.RegArgs value whose offset is also known to the
19 // runtime, so that a stack map for it can be constructed, since it contains
20 // pointers visible to the GC.
21 #define LOCAL_RETVALID 40
22 #define LOCAL_REGARGS 48
23
24 // The frame size of the functions below is
25 // 32 (args of callReflect) + 8 (bool + padding) + 392 (abi.RegArgs) = 432.
26
27 // makeFuncStub is the code half of the function returned by MakeFunc.
28 // See the comment on the declaration of makeFuncStub in makefunc.go
29 // for more details.
30 // No arg size here, runtime pulls arg map out of the func value.
31 TEXT ·makeFuncStub(SB),(NOSPLIT|WRAPPER),$432
32 NO_LOCAL_POINTERS
33 ADDV $LOCAL_REGARGS, R3, R25 // spillArgs using R25
34 JAL runtime·spillArgs(SB)
35 MOVV REGCTXT, 32(R3) // save REGCTXT > args of moveMakeFuncArgPtrs < LOCAL_REGARGS
36
37 #ifdef GOEXPERIMENT_regabiargs
38 MOVV REGCTXT, R4
39 MOVV R25, R5
40 #else
41 MOVV REGCTXT, 8(R3)
42 MOVV R25, 16(R3)
43 #endif
44 JAL ·moveMakeFuncArgPtrs<ABIInternal>(SB)
45 MOVV 32(R3), REGCTXT // restore REGCTXT
46
47 MOVV REGCTXT, 8(R3)
48 MOVV $argframe+0(FP), R20
49 MOVV R20, 16(R3)
50 MOVV R0, LOCAL_RETVALID(R3)
51 ADDV $LOCAL_RETVALID, R3, R20
52 MOVV R20, 24(R3)
53 ADDV $LOCAL_REGARGS, R3, R20
54 MOVV R20, 32(R3)
55 JAL ·callReflect(SB)
56 ADDV $LOCAL_REGARGS, R3, R25 //unspillArgs using R25
57 JAL runtime·unspillArgs(SB)
58 RET
59
60 // methodValueCall is the code half of the function returned by makeMethodValue.
61 // See the comment on the declaration of methodValueCall in makefunc.go
62 // for more details.
63 // No arg size here; runtime pulls arg map out of the func value.
64 TEXT ·methodValueCall(SB),(NOSPLIT|WRAPPER),$432
65 NO_LOCAL_POINTERS
66 ADDV $LOCAL_REGARGS, R3, R25 // spillArgs using R25
67 JAL runtime·spillArgs(SB)
68 MOVV REGCTXT, 32(R3) // save REGCTXT > args of moveMakeFuncArgPtrs < LOCAL_REGARGS
69 #ifdef GOEXPERIMENT_regabiargs
70 MOVV REGCTXT, R4
71 MOVV R25, R5
72 #else
73 MOVV REGCTXT, 8(R3)
74 MOVV R25, 16(R3)
75 #endif
76 JAL ·moveMakeFuncArgPtrs<ABIInternal>(SB)
77 MOVV 32(R3), REGCTXT // restore REGCTXT
78 MOVV REGCTXT, 8(R3)
79 MOVV $argframe+0(FP), R20
80 MOVV R20, 16(R3)
81 MOVB R0, LOCAL_RETVALID(R3)
82 ADDV $LOCAL_RETVALID, R3, R20
83 MOVV R20, 24(R3)
84 ADDV $LOCAL_REGARGS, R3, R20
85 MOVV R20, 32(R3) // frame size to 32+SP as callreflect args)
86 JAL ·callMethod(SB)
87 ADDV $LOCAL_REGARGS, R3, R25 // unspillArgs using R25
88 JAL runtime·unspillArgs(SB)
89 RET
90
View as plain text