github.com/twelsh-aw/go/src@v0.0.0-20230516233729-a56fe86a7c81/reflect/asm_riscv64.s (about) 1 // Copyright 2019 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/callMethod) + (8 bool with 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 ADD $LOCAL_REGARGS, SP, X25 // spillArgs using X25 32 CALL runtime·spillArgs(SB) 33 MOV CTXT, 32(SP) // save CTXT > args of moveMakeFuncArgPtrs < LOCAL_REGARGS 34 MOV CTXT, 8(SP) 35 MOV X25, 16(SP) 36 CALL ·moveMakeFuncArgPtrs(SB) 37 MOV 32(SP), CTXT // restore CTXT 38 39 MOV CTXT, 8(SP) 40 MOV $argframe+0(FP), T0 41 MOV T0, 16(SP) 42 MOV ZERO, LOCAL_RETVALID(SP) 43 ADD $LOCAL_RETVALID, SP, T1 44 MOV T1, 24(SP) 45 ADD $LOCAL_REGARGS, SP, T1 46 MOV T1, 32(SP) 47 CALL ·callReflect(SB) 48 ADD $LOCAL_REGARGS, SP, X25 // unspillArgs using X25 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 TEXT ·methodValueCall(SB),(NOSPLIT|WRAPPER),$432 57 NO_LOCAL_POINTERS 58 ADD $LOCAL_REGARGS, SP, X25 // spillArgs using X25 59 CALL runtime·spillArgs(SB) 60 MOV CTXT, 32(SP) // save CTXT 61 MOV CTXT, 8(SP) 62 MOV X25, 16(SP) 63 CALL ·moveMakeFuncArgPtrs(SB) 64 MOV 32(SP), CTXT // restore CTXT 65 MOV CTXT, 8(SP) 66 MOV $argframe+0(FP), T0 67 MOV T0, 16(SP) 68 MOV ZERO, LOCAL_RETVALID(SP) 69 ADD $LOCAL_RETVALID, SP, T1 70 MOV T1, 24(SP) 71 ADD $LOCAL_REGARGS, SP, T1 72 MOV T1, 32(SP) // frame size to 32+SP as callreflect args 73 CALL ·callMethod(SB) 74 ADD $LOCAL_REGARGS, SP, X25 // unspillArgs using X25 75 CALL runtime·unspillArgs(SB) 76 RET