1
0
mirror of https://github.com/golang/go synced 2024-11-26 22:51:23 -07:00

reflect: fix register ABI spill space calculation

Currently this does things the old way by computing the number of
registers, but we're going to be using their ABI0 layout for the spill
space for now.

Change-Id: Ibcef1ee48fd834af7cbdaabe704bcabe066ed358
Reviewed-on: https://go-review.googlesource.com/c/go/+/293011
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Michael Anthony Knyszek 2021-02-17 19:14:03 +00:00 committed by Michael Knyszek
parent d8e33d558e
commit cda8ee095e

View File

@ -334,8 +334,7 @@ func newAbiDesc(t *funcType, rcvr *rtype) abiDesc {
// //
// TODO(mknyszek): Remove this when we no longer have // TODO(mknyszek): Remove this when we no longer have
// caller reserved spill space. // caller reserved spill space.
spillInt := uintptr(0) spill := uintptr(0)
spillFloat := uintptr(0)
// Compute gc program & stack bitmap for stack arguments // Compute gc program & stack bitmap for stack arguments
stackPtrs := new(bitVector) stackPtrs := new(bitVector)
@ -351,21 +350,19 @@ func newAbiDesc(t *funcType, rcvr *rtype) abiDesc {
stackPtrs.append(0) stackPtrs.append(0)
} }
} else { } else {
spillInt += ptrSize spill += ptrSize
} }
} }
for _, arg := range t.in() { for _, arg := range t.in() {
i, f := in.iregs, in.fregs
stkStep := in.addArg(arg) stkStep := in.addArg(arg)
if stkStep != nil { if stkStep != nil {
addTypeBits(stackPtrs, stkStep.stkOff, arg) addTypeBits(stackPtrs, stkStep.stkOff, arg)
} else { } else {
i, f = in.iregs-i, in.fregs-f spill = align(spill, uintptr(arg.align))
spillInt += uintptr(i) * ptrSize spill += arg.size
spillFloat += uintptr(f) * abi.EffectiveFloatRegSize
} }
} }
spill := align(spillInt+spillFloat, ptrSize) spill = align(spill, ptrSize)
// From the input parameters alone, we now know // From the input parameters alone, we now know
// the stackCallArgsSize and retOffset. // the stackCallArgsSize and retOffset.