aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/value.go
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2021-02-19 18:00:48 -0500
committerDavid Chase <drchase@google.com>2021-03-04 16:21:10 +0000
commit3778f8e07d06cabfccd1508295ad67270af078cd (patch)
tree81b1273462ea0c5751571072c47fb3303985b4fc /src/cmd/compile/internal/ssa/value.go
parenta2d92b5143ad6ed1b55b71032c5c1f468ba76fd4 (diff)
downloadgo-3778f8e07d06cabfccd1508295ad67270af078cd.tar.gz
go-3778f8e07d06cabfccd1508295ad67270af078cd.zip
cmd/compile: fix pointer maps for morestack
Verified with test and with single step watching changes to register values across morestack calls, after reload. Also added stack-growth test with pointer parameters of varying lifetime. For #40724. Change-Id: Idb5fe27786ac5c6665a734d41e68d3d39de2f4da Reviewed-on: https://go-review.googlesource.com/c/go/+/294429 Trust: David Chase <drchase@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/value.go')
-rw-r--r--src/cmd/compile/internal/ssa/value.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/ssa/value.go b/src/cmd/compile/internal/ssa/value.go
index 127e4ce641..c20fc87e90 100644
--- a/src/cmd/compile/internal/ssa/value.go
+++ b/src/cmd/compile/internal/ssa/value.go
@@ -517,9 +517,13 @@ func (*Value) CanBeAnSSAAux() {}
// AutoVar returns a *Name and int64 representing the auto variable and offset within it
// where v should be spilled.
func AutoVar(v *Value) (*ir.Name, int64) {
- loc := v.Block.Func.RegAlloc[v.ID].(LocalSlot)
- if v.Type.Size() > loc.Type.Size() {
- v.Fatalf("spill/restore type %s doesn't fit in slot type %s", v.Type, loc.Type)
+ if loc, ok := v.Block.Func.RegAlloc[v.ID].(LocalSlot); ok {
+ if v.Type.Size() > loc.Type.Size() {
+ v.Fatalf("spill/restore type %s doesn't fit in slot type %s", v.Type, loc.Type)
+ }
+ return loc.N, loc.Off
}
- return loc.N, loc.Off
+ // Assume it is a register, return its spill slot, which needs to be live
+ nameOff := v.Aux.(*AuxNameOffset)
+ return nameOff.Name, nameOff.Offset
}