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  	MOVV	REGCTXT, R4
    38  	MOVV	R25, R5
    39  	JAL	·moveMakeFuncArgPtrs<ABIInternal>(SB)
    40  	MOVV	32(R3), REGCTXT // restore REGCTXT
    41  
    42  	MOVV	REGCTXT, 8(R3)
    43  	MOVV	$argframe+0(FP), R20
    44  	MOVV	R20, 16(R3)
    45  	MOVV	R0, LOCAL_RETVALID(R3)
    46  	ADDV	$LOCAL_RETVALID, R3, R20
    47  	MOVV	R20, 24(R3)
    48  	ADDV	$LOCAL_REGARGS, R3, R20
    49  	MOVV	R20, 32(R3)
    50  	JAL	·callReflect(SB)
    51  	ADDV	$LOCAL_REGARGS, R3, R25	//unspillArgs using R25
    52  	JAL	runtime·unspillArgs(SB)
    53  	RET
    54  
    55  // methodValueCall is the code half of the function returned by makeMethodValue.
    56  // See the comment on the declaration of methodValueCall in makefunc.go
    57  // for more details.
    58  // No arg size here; runtime pulls arg map out of the func value.
    59  TEXT ·methodValueCall(SB),(NOSPLIT|WRAPPER),$432
    60  	NO_LOCAL_POINTERS
    61  	ADDV	$LOCAL_REGARGS, R3, R25 // spillArgs using R25
    62  	JAL	runtime·spillArgs(SB)
    63  	MOVV	REGCTXT, 32(R3) // save REGCTXT > args of moveMakeFuncArgPtrs < LOCAL_REGARGS
    64  	MOVV	REGCTXT, R4
    65  	MOVV	R25, R5
    66  	JAL	·moveMakeFuncArgPtrs<ABIInternal>(SB)
    67  	MOVV	32(R3), REGCTXT // restore REGCTXT
    68  	MOVV	REGCTXT, 8(R3)
    69  	MOVV	$argframe+0(FP), R20
    70  	MOVV	R20, 16(R3)
    71  	MOVB	R0, LOCAL_RETVALID(R3)
    72  	ADDV	$LOCAL_RETVALID, R3, R20
    73  	MOVV	R20, 24(R3)
    74  	ADDV	$LOCAL_REGARGS, R3, R20
    75  	MOVV	R20, 32(R3) // frame size to 32+SP as callreflect args)
    76  	JAL	·callMethod(SB)
    77  	ADDV	$LOCAL_REGARGS, R3, R25 // unspillArgs using R25
    78  	JAL	runtime·unspillArgs(SB)
    79  	RET
    80  

View as plain text