...

Text file src/reflect/asm_ppc64x.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//go:build ppc64 || ppc64le
     6
     7#include "textflag.h"
     8#include "funcdata.h"
     9#include "asm_ppc64x.h"
    10
    11// The frames of each of the two functions below contain two locals, at offsets
    12// that are known to the runtime.
    13//
    14// The first local is a bool called retValid with a whole pointer-word reserved
    15// for it on the stack. The purpose of this word is so that the runtime knows
    16// whether the stack-allocated return space contains valid values for stack
    17// scanning.
    18//
    19// The second local is an abi.RegArgs value whose offset is also known to the
    20// runtime, so that a stack map for it can be constructed, since it contains
    21// pointers visible to the GC.
    22
    23#define LOCAL_RETVALID 32+FIXED_FRAME
    24#define LOCAL_REGARGS 40+FIXED_FRAME
    25
    26// The frame size of the functions below is
    27// 32 (args of callReflect) + 8 (bool + padding) + 296 (abi.RegArgs) = 336.
    28
    29// makeFuncStub is the code half of the function returned by MakeFunc.
    30// See the comment on the declaration of makeFuncStub in makefunc.go
    31// for more details.
    32// No arg size here, runtime pulls arg map out of the func value.
    33TEXT ·makeFuncStub(SB),(NOSPLIT|WRAPPER),$336
    34	NO_LOCAL_POINTERS
    35	// NO_LOCAL_POINTERS is a lie. The stack map for the two locals in this
    36	// frame is specially handled in the runtime. See the comment above LOCAL_RETVALID.
    37	ADD	$LOCAL_REGARGS, R1, R20
    38	CALL	runtime·spillArgs(SB)
    39	MOVD	R11, FIXED_FRAME+32(R1)	// save R11
    40	MOVD	R11, FIXED_FRAME+0(R1)	// arg for moveMakeFuncArgPtrs
    41	MOVD	R20, FIXED_FRAME+8(R1)	// arg for local args
    42	CALL	·moveMakeFuncArgPtrs(SB)
    43	MOVD	FIXED_FRAME+32(R1), R11	// restore R11 ctxt
    44	MOVD	R11, FIXED_FRAME+0(R1)	// ctxt (arg0)
    45	MOVD	$argframe+0(FP), R3	// save arg to callArg
    46	MOVD	R3, FIXED_FRAME+8(R1)	// frame (arg1)
    47	ADD	$LOCAL_RETVALID, R1, R3 // addr of return flag
    48	MOVB	R0, (R3)		// clear flag
    49	MOVD	R3, FIXED_FRAME+16(R1)	// addr retvalid (arg2)
    50	ADD     $LOCAL_REGARGS, R1, R3
    51	MOVD	R3, FIXED_FRAME+24(R1)	// abiregargs (arg3)
    52	BL	·callReflect(SB)
    53	ADD	$LOCAL_REGARGS, R1, R20	// set address of spill area
    54	CALL	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),$336
    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	ADD	$LOCAL_REGARGS, R1, R20
    66	CALL	runtime·spillArgs(SB)
    67	MOVD	R11, FIXED_FRAME+0(R1) // arg0 ctxt
    68	MOVD	R11, FIXED_FRAME+32(R1) // save for later
    69	MOVD	R20, FIXED_FRAME+8(R1) // arg1 abiregargs
    70	CALL	·moveMakeFuncArgPtrs(SB)
    71	MOVD	FIXED_FRAME+32(R1), R11 // restore ctxt
    72	MOVD	R11, FIXED_FRAME+0(R1) // set as arg0
    73	MOVD	$argframe+0(FP), R3	// frame pointer
    74	MOVD	R3, FIXED_FRAME+8(R1)	// set as arg1
    75	ADD	$LOCAL_RETVALID, R1, R3
    76	MOVB	$0, (R3)		// clear ret flag
    77	MOVD	R3, FIXED_FRAME+16(R1)	// addr of return flag
    78	ADD	$LOCAL_REGARGS, R1, R3	// addr of abiregargs
    79	MOVD	R3, FIXED_FRAME+24(R1)	// set as arg3
    80	BL	·callMethod(SB)
    81	ADD     $LOCAL_REGARGS, R1, R20
    82	CALL	runtime·unspillArgs(SB)
    83	RET

View as plain text