aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2021-03-15 21:12:08 +0000
committerDavid Chase <drchase@google.com>2021-03-15 21:28:45 +0000
commite61c9ddb7f1a790f6a52f563dccb4ac264f2e704 (patch)
treecf3c49cf8575bfe24eb7fae5b66220f274e6ba95 /src/cmd/compile/internal/types
parent8ed438c077d82c4b4662c327dbbdb3c64e7547ca (diff)
downloadgo-e61c9ddb7f1a790f6a52f563dccb4ac264f2e704.tar.gz
go-e61c9ddb7f1a790f6a52f563dccb4ac264f2e704.zip
Revert "cmd/compile: spill output parameters passed in registers as autos"
This reverts commit 8ed438c077d82c4b4662c327dbbdb3c64e7547ca, 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>
Diffstat (limited to 'src/cmd/compile/internal/types')
-rw-r--r--src/cmd/compile/internal/types/size.go12
-rw-r--r--src/cmd/compile/internal/types/type.go4
2 files changed, 13 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/types/size.go b/src/cmd/compile/internal/types/size.go
index a75429f0ab..ef23cdf5fe 100644
--- a/src/cmd/compile/internal/types/size.go
+++ b/src/cmd/compile/internal/types/size.go
@@ -163,9 +163,19 @@ func calcStructOffset(errtype *Type, t *Type, o int64, flag int) int64 {
if f.Type.Align > 0 {
o = Rnd(o, int64(f.Type.Align))
}
- if isStruct { // For receiver/args/results, do not set, it depends on ABI
+ if isStruct { // For receiver/args/results, depends on ABI
f.Offset = o
}
+ if f.Nname != nil {
+ // addrescapes has similar code to update these offsets.
+ // Usually addrescapes runs after calcStructOffset,
+ // in which case we could drop this,
+ // but function closure functions are the exception.
+ // NOTE(rsc): This comment may be stale.
+ // It's possible the ordering has changed and this is
+ // now the common case. I'm not sure.
+ f.Nname.(VarObject).RecordFrameOffset(o)
+ }
w := f.Type.Width
if w < 0 {
diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go
index 7bf63764b8..ffaf755345 100644
--- a/src/cmd/compile/internal/types/type.go
+++ b/src/cmd/compile/internal/types/type.go
@@ -1750,7 +1750,7 @@ func NewTypeParam(pkg *Pkg) *Type {
return t
}
-const BOGUS_FUNARG_OFFSET = -1000000000
+const BOGUS_FUNARG_OFFSET = 1000000000
func unzeroFieldOffsets(f []*Field) {
for i := range f {
@@ -1759,7 +1759,7 @@ func unzeroFieldOffsets(f []*Field) {
}
// NewSignature returns a new function type for the given receiver,
-// parameters, results, and type parameters, any of which may be nil.
+// parametes, results, and type parameters, any of which may be nil.
func NewSignature(pkg *Pkg, recv *Field, tparams, params, results []*Field) *Type {
var recvs []*Field
if recv != nil {