mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Revert "cmd/compile: spill output parameters passed in registers as autos"
This reverts commit 8ed438c077, CL 300749.
Reason for revert: Looks like it crashes on link-register architectures
Change-Id: I0c261df58900008cada3359889d2a87508158447
Reviewed-on: https://go-review.googlesource.com/c/go/+/302053
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
8ed438c077
commit
e61c9ddb7f
17 changed files with 89 additions and 308 deletions
|
|
@ -69,14 +69,6 @@ func (a *ABIParamResultInfo) SpillAreaSize() int64 {
|
|||
return a.spillAreaSize
|
||||
}
|
||||
|
||||
// ArgWidth returns the amount of stack needed for all the inputs
|
||||
// and outputs of a function or method, including ABI-defined parameter
|
||||
// slots and ABI-defined spill slots for register-resident parameters.
|
||||
// The name is inherited from (*Type).ArgWidth(), which it replaces.
|
||||
func (a *ABIParamResultInfo) ArgWidth() int64 {
|
||||
return a.spillAreaSize + a.offsetToSpillArea
|
||||
}
|
||||
|
||||
// RegIndex stores the index into the set of machine registers used by
|
||||
// the ABI on a specific architecture for parameter passing. RegIndex
|
||||
// values 0 through N-1 (where N is the number of integer registers
|
||||
|
|
@ -422,25 +414,20 @@ func (config *ABIConfig) ABIAnalyzeFuncType(ft *types.Func) *ABIParamResultInfo
|
|||
|
||||
// ABIAnalyze returns the same result as ABIAnalyzeFuncType, but also
|
||||
// updates the offsets of all the receiver, input, and output fields.
|
||||
// If setNname is true, it also sets the FrameOffset of the Nname for
|
||||
// the field(s); this is for use when compiling a function and figuring out
|
||||
// spill locations. Doing this for callers can cause races for register
|
||||
// outputs because their frame location transitions from BOGUS_FUNARG_OFFSET
|
||||
// to zero to an as-if-AUTO offset that has no use for callers.
|
||||
func (config *ABIConfig) ABIAnalyze(t *types.Type, setNname bool) *ABIParamResultInfo {
|
||||
func (config *ABIConfig) ABIAnalyze(t *types.Type) *ABIParamResultInfo {
|
||||
ft := t.FuncType()
|
||||
result := config.ABIAnalyzeFuncType(ft)
|
||||
// Fill in the frame offsets for receiver, inputs, results
|
||||
k := 0
|
||||
if t.NumRecvs() != 0 {
|
||||
config.updateOffset(result, ft.Receiver.FieldSlice()[0], result.inparams[0], false, setNname)
|
||||
config.updateOffset(result, ft.Receiver.FieldSlice()[0], result.inparams[0], false)
|
||||
k++
|
||||
}
|
||||
for i, f := range ft.Params.FieldSlice() {
|
||||
config.updateOffset(result, f, result.inparams[k+i], false, setNname)
|
||||
config.updateOffset(result, f, result.inparams[k+i], false)
|
||||
}
|
||||
for i, f := range ft.Results.FieldSlice() {
|
||||
config.updateOffset(result, f, result.outparams[i], true, setNname)
|
||||
config.updateOffset(result, f, result.outparams[i], true)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
|
@ -455,7 +442,7 @@ func FieldOffsetOf(f *types.Field) int64 {
|
|||
return f.Offset
|
||||
}
|
||||
|
||||
func (config *ABIConfig) updateOffset(result *ABIParamResultInfo, f *types.Field, a ABIParamAssignment, isReturn, setNname bool) {
|
||||
func (config *ABIConfig) updateOffset(result *ABIParamResultInfo, f *types.Field, a ABIParamAssignment, isReturn bool) {
|
||||
// Everything except return values in registers has either a frame home (if not in a register) or a frame spill location.
|
||||
if !isReturn || len(a.Registers) == 0 {
|
||||
// The type frame offset DOES NOT show effects of minimum frame size.
|
||||
|
|
@ -468,19 +455,11 @@ func (config *ABIConfig) updateOffset(result *ABIParamResultInfo, f *types.Field
|
|||
// Set the Offset the first time. After that, we may recompute it, but it should never change.
|
||||
f.Offset = off
|
||||
if f.Nname != nil {
|
||||
// always set it in this case.
|
||||
f.Nname.(*ir.Name).SetFrameOffset(off)
|
||||
f.Nname.(*ir.Name).SetIsOutputParamInRegisters(false)
|
||||
}
|
||||
} else if fOffset != off {
|
||||
panic(fmt.Errorf("Offset changed from %d to %d", fOffset, off))
|
||||
}
|
||||
} else {
|
||||
if setNname && f.Nname != nil {
|
||||
fname := f.Nname.(*ir.Name)
|
||||
fname.SetIsOutputParamInRegisters(true)
|
||||
fname.SetFrameOffset(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue