aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2016-10-24 11:46:06 -0700
committerMatthew Dempsky <mdempsky@google.com>2016-10-24 19:29:18 +0000
commit7124056f7e6f44faba822e4d96c18fde002b4566 (patch)
treeb1d50aa87bc0f6a5c1e7a6e3d8a63c32a2a8b305 /src
parent07a22dbd34d439182bea6a966b80baa2df7c72f4 (diff)
downloadgo-7124056f7e6f44faba822e4d96c18fde002b4566.tar.xz
cmd/internal/obj: drop Addr's Gotype field
The Gotype field is only used for ATYPE instructions. Instead of specially storing the Go type symbol in From.Gotype, just store it in To.Sym like any other 2-argument instruction would. Modest reduction in allocations: name old alloc/op new alloc/op delta Template 42.0MB ± 0% 41.8MB ± 0% -0.40% (p=0.000 n=9+10) Unicode 34.3MB ± 0% 34.1MB ± 0% -0.48% (p=0.000 n=9+10) GoTypes 122MB ± 0% 122MB ± 0% -0.14% (p=0.000 n=9+10) Compiler 518MB ± 0% 518MB ± 0% -0.04% (p=0.000 n=9+10) Passes toolstash -cmp. Change-Id: I0e603266b5d7d4e405106a26369e22773a0d3a91 Reviewed-on: https://go-review.googlesource.com/31850 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/gc/pgen.go4
-rw-r--r--src/cmd/internal/obj/link.go1
-rw-r--r--src/cmd/internal/obj/plist.go2
-rw-r--r--src/cmd/internal/obj/sizeof_test.go4
-rw-r--r--src/cmd/internal/obj/util.go3
5 files changed, 6 insertions, 8 deletions
diff --git a/src/cmd/compile/internal/gc/pgen.go b/src/cmd/compile/internal/gc/pgen.go
index 8c5925ff04..1346ca156b 100644
--- a/src/cmd/compile/internal/gc/pgen.go
+++ b/src/cmd/compile/internal/gc/pgen.go
@@ -425,7 +425,9 @@ func compile(fn *Node) {
fallthrough
case PPARAM, PPARAMOUT:
p := Gins(obj.ATYPE, n, nil)
- p.From.Gotype = Linksym(ngotype(n))
+ p.To.Type = obj.TYPE_MEM
+ p.To.Name = obj.NAME_EXTERN
+ p.To.Sym = Linksym(ngotype(n))
}
}
diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go
index 48137a289b..fecd71f674 100644
--- a/src/cmd/internal/obj/link.go
+++ b/src/cmd/internal/obj/link.go
@@ -160,7 +160,6 @@ type Addr struct {
Class int8
Offset int64
Sym *LSym
- Gotype *LSym
// argument value:
// for TYPE_SCONST, a string
diff --git a/src/cmd/internal/obj/plist.go b/src/cmd/internal/obj/plist.go
index 4890d9c03f..9264218259 100644
--- a/src/cmd/internal/obj/plist.go
+++ b/src/cmd/internal/obj/plist.go
@@ -69,7 +69,7 @@ func flushplist(ctxt *Link, freeProgs bool) {
a.Asym = p.From.Sym
a.Aoffset = int32(p.From.Offset)
a.Name = int16(p.From.Name)
- a.Gotype = p.From.Gotype
+ a.Gotype = p.To.Sym
a.Link = curtext.Autom
curtext.Autom = a
continue
diff --git a/src/cmd/internal/obj/sizeof_test.go b/src/cmd/internal/obj/sizeof_test.go
index 6cf8275630..65028ab4b9 100644
--- a/src/cmd/internal/obj/sizeof_test.go
+++ b/src/cmd/internal/obj/sizeof_test.go
@@ -22,9 +22,9 @@ func TestSizeof(t *testing.T) {
_32bit uintptr // size on 32bit platforms
_64bit uintptr // size on 64bit platforms
}{
- {Addr{}, 44, 72},
+ {Addr{}, 40, 64},
{LSym{}, 80, 136},
- {Prog{}, 152, 240},
+ {Prog{}, 144, 224},
}
for _, tt := range tests {
diff --git a/src/cmd/internal/obj/util.go b/src/cmd/internal/obj/util.go
index bbff065f73..9f1c6f08c7 100644
--- a/src/cmd/internal/obj/util.go
+++ b/src/cmd/internal/obj/util.go
@@ -240,9 +240,6 @@ func Dconv(p *Prog, a *Addr) string {
if a.Index != REG_NONE {
str += fmt.Sprintf("(%v*%d)", Rconv(int(a.Index)), int(a.Scale))
}
- if p != nil && p.As == ATYPE && a.Gotype != nil {
- str += fmt.Sprintf("%s", a.Gotype.Name)
- }
case TYPE_CONST:
if a.Reg != 0 {