Skip to content

Commit

Permalink
reflect: fix register ABI spill space calculation
Browse files Browse the repository at this point in the history
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 <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Cherry Zhang <[email protected]>
Trust: Michael Knyszek <[email protected]>
  • Loading branch information
mknyszek committed Feb 26, 2021
1 parent d8e33d5 commit cda8ee0
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/reflect/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,7 @@ func newAbiDesc(t *funcType, rcvr *rtype) abiDesc {
//
// TODO(mknyszek): Remove this when we no longer have
// caller reserved spill space.
spillInt := uintptr(0)
spillFloat := uintptr(0)
spill := uintptr(0)

// Compute gc program & stack bitmap for stack arguments
stackPtrs := new(bitVector)
Expand All @@ -351,21 +350,19 @@ func newAbiDesc(t *funcType, rcvr *rtype) abiDesc {
stackPtrs.append(0)
}
} else {
spillInt += ptrSize
spill += ptrSize
}
}
for _, arg := range t.in() {
i, f := in.iregs, in.fregs
stkStep := in.addArg(arg)
if stkStep != nil {
addTypeBits(stackPtrs, stkStep.stkOff, arg)
} else {
i, f = in.iregs-i, in.fregs-f
spillInt += uintptr(i) * ptrSize
spillFloat += uintptr(f) * abi.EffectiveFloatRegSize
spill = align(spill, uintptr(arg.align))
spill += arg.size
}
}
spill := align(spillInt+spillFloat, ptrSize)
spill = align(spill, ptrSize)

// From the input parameters alone, we now know
// the stackCallArgsSize and retOffset.
Expand Down

0 comments on commit cda8ee0

Please sign in to comment.