]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj: drop Addr's Gotype field
authorMatthew Dempsky <mdempsky@google.com>
Mon, 24 Oct 2016 18:46:06 +0000 (11:46 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Mon, 24 Oct 2016 19:29:18 +0000 (19:29 +0000)
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>
src/cmd/compile/internal/gc/pgen.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/plist.go
src/cmd/internal/obj/sizeof_test.go
src/cmd/internal/obj/util.go

index 8c5925ff040f6e1235c7db6a06f8ef128b93d124..1346ca156b5988df1ac8d8b504ed2a929de50120 100644 (file)
@@ -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))
                }
        }
 
index 48137a289bf7c142d17458bfe7cef87fc24a3eb2..fecd71f674fb8723e850a8e5d299d1b51198f8e3 100644 (file)
@@ -160,7 +160,6 @@ type Addr struct {
        Class  int8
        Offset int64
        Sym    *LSym
-       Gotype *LSym
 
        // argument value:
        //      for TYPE_SCONST, a string
index 4890d9c03fecb337ea2453b321fed80c35f96327..926421825943eb453956018cab167ca52d0ca944 100644 (file)
@@ -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
index 6cf8275630bccd758b0af86874a854e7f782a0e2..65028ab4b916d2db012aab92601bf3471dfc9070 100644 (file)
@@ -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 {
index bbff065f737925e47dc061c052ef15af98ef3198..9f1c6f08c79bf091a04c861f3dc101e1f2fc25d4 100644 (file)
@@ -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 {