code := abi.FuncPCABI0(makeFuncStub)
// makeFuncImpl contains a stack map for use by the runtime
- _, _, abi := funcLayout(ftyp, nil)
+ _, _, abid := funcLayout(ftyp, nil)
impl := &makeFuncImpl{
makeFuncCtxt: makeFuncCtxt{
fn: code,
- stack: abi.stackPtrs,
- argLen: abi.stackCallArgsSize,
- regPtrs: abi.inRegPtrs,
+ stack: abid.stackPtrs,
+ argLen: abid.stackCallArgsSize,
+ regPtrs: abid.inRegPtrs,
},
ftyp: ftyp,
fn: fn,
code := methodValueCallCodePtr()
// methodValue contains a stack map for use by the runtime
- _, _, abi := funcLayout(ftyp, nil)
+ _, _, abid := funcLayout(ftyp, nil)
fv := &methodValue{
makeFuncCtxt: makeFuncCtxt{
fn: code,
- stack: abi.stackPtrs,
- argLen: abi.stackCallArgsSize,
- regPtrs: abi.inRegPtrs,
+ stack: abid.stackPtrs,
+ argLen: abid.stackCallArgsSize,
+ regPtrs: abid.inRegPtrs,
},
method: int(v.flag) >> flagMethodShift,
rcvr: rcvr,
type layoutType struct {
t *rtype
framePool *sync.Pool
- abi abiDesc
+ abid abiDesc
}
var layoutCache sync.Map // map[layoutKey]layoutType
// The returned type exists only for GC, so we only fill out GC relevant info.
// Currently, that's just size and the GC program. We also fill in
// the name for possible debugging use.
-func funcLayout(t *funcType, rcvr *rtype) (frametype *rtype, framePool *sync.Pool, abi abiDesc) {
+func funcLayout(t *funcType, rcvr *rtype) (frametype *rtype, framePool *sync.Pool, abid abiDesc) {
if t.Kind() != Func {
panic("reflect: funcLayout of non-func type " + t.String())
}
k := layoutKey{t, rcvr}
if lti, ok := layoutCache.Load(k); ok {
lt := lti.(layoutType)
- return lt.t, lt.framePool, lt.abi
+ return lt.t, lt.framePool, lt.abid
}
// Compute the ABI layout.
- abi = newAbiDesc(t, rcvr)
+ abid = newAbiDesc(t, rcvr)
// build dummy rtype holding gc program
x := &rtype{
// reflectcall's frame, not in the allocated frame.
// TODO(mknyszek): Remove this comment when register
// spill space in the frame is no longer required.
- size: align(abi.retOffset+abi.ret.stackBytes, goarch.PtrSize),
- ptrdata: uintptr(abi.stackPtrs.n) * goarch.PtrSize,
+ size: align(abid.retOffset+abid.ret.stackBytes, goarch.PtrSize),
+ ptrdata: uintptr(abid.stackPtrs.n) * goarch.PtrSize,
}
- if abi.stackPtrs.n > 0 {
- x.gcdata = &abi.stackPtrs.data[0]
+ if abid.stackPtrs.n > 0 {
+ x.gcdata = &abid.stackPtrs.data[0]
}
var s string
lti, _ := layoutCache.LoadOrStore(k, layoutType{
t: x,
framePool: framePool,
- abi: abi,
+ abid: abid,
})
lt := lti.(layoutType)
- return lt.t, lt.framePool, lt.abi
+ return lt.t, lt.framePool, lt.abid
}
// ifaceIndir reports whether t is stored indirectly in an interface value.
var regArgs abi.RegArgs
// Compute frame type.
- frametype, framePool, abi := funcLayout(t, rcvrtype)
+ frametype, framePool, abid := funcLayout(t, rcvrtype)
// Allocate a chunk of memory for frame if needed.
var stackArgs unsafe.Pointer
if debugReflectCall {
println("reflect.call", t.String())
- abi.dump()
+ abid.dump()
}
// Copy inputs into args.
// Guaranteed to only be one word in size,
// so it will only take up exactly 1 abiStep (either
// in a register or on the stack).
- switch st := abi.call.steps[0]; st.kind {
+ switch st := abid.call.steps[0]; st.kind {
case abiStepStack:
storeRcvr(rcvr, stackArgs)
case abiStepIntReg, abiStepPointer:
// was possible to use space in the argument frame.
v = v.assignTo("reflect.Value.Call", targ, nil)
stepsLoop:
- for _, st := range abi.call.stepsForValue(i + inStart) {
+ for _, st := range abid.call.stepsForValue(i + inStart) {
switch st.kind {
case abiStepStack:
// Copy values to the "stack."
// TODO(mknyszek): Remove this when we no longer have
// caller reserved spill space.
frameSize = align(frameSize, goarch.PtrSize)
- frameSize += abi.spill
+ frameSize += abid.spill
// Mark pointers in registers for the return path.
- regArgs.ReturnIsPtr = abi.outRegPtrs
+ regArgs.ReturnIsPtr = abid.outRegPtrs
if debugReflectCall {
regArgs.Dump()
}
// Call.
- call(frametype, fn, stackArgs, uint32(frametype.size), uint32(abi.retOffset), uint32(frameSize), ®Args)
+ call(frametype, fn, stackArgs, uint32(frametype.size), uint32(abid.retOffset), uint32(frameSize), ®Args)
// For testing; see TestCallMethodJump.
if callGC {
// Zero the now unused input area of args,
// because the Values returned by this function contain pointers to the args object,
// and will thus keep the args object alive indefinitely.
- typedmemclrpartial(frametype, stackArgs, 0, abi.retOffset)
+ typedmemclrpartial(frametype, stackArgs, 0, abid.retOffset)
}
// Wrap Values around return values in args.
ret[i] = Zero(tv)
continue
}
- steps := abi.ret.stepsForValue(i)
+ steps := abid.ret.stepsForValue(i)
if st := steps[0]; st.kind == abiStepStack {
// This value is on the stack. If part of a value is stack
// allocated, the entire value is according to the ABI. So
ftyp := ctxt.ftyp
f := ctxt.fn
- _, _, abi := funcLayout(ftyp, nil)
+ _, _, abid := funcLayout(ftyp, nil)
// Copy arguments into Values.
ptr := frame
continue
}
v := Value{typ, nil, flag(typ.Kind())}
- steps := abi.call.stepsForValue(i)
+ steps := abid.call.stepsForValue(i)
if st := steps[0]; st.kind == abiStepStack {
if ifaceIndir(typ) {
// value cannot be inlined in interface data.
// target location used as scratch space. See issue 39541.
v = v.assignTo("reflect.MakeFunc", typ, nil)
stepsLoop:
- for _, st := range abi.ret.stepsForValue(i) {
+ for _, st := range abid.ret.stepsForValue(i) {
switch st.kind {
case abiStepStack:
// Copy values to the "stack."