]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: replace Autom linked list with slice
authorDavid Crawshaw <crawshaw@golang.org>
Thu, 3 Mar 2016 03:38:42 +0000 (22:38 -0500)
committerDavid Crawshaw <crawshaw@golang.org>
Thu, 3 Mar 2016 17:21:06 +0000 (17:21 +0000)
Change-Id: I939129da0e71a7ccc61bec79515a34f0b1e59502
Reviewed-on: https://go-review.googlesource.com/20162
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/link/internal/ld/dwarf.go
src/cmd/link/internal/ld/go.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/link.go
src/cmd/link/internal/ld/objfile.go

index 3378456ae73afb820233df200d2d2021f4775d1f..829d8dabf266cc40b0d167848dcf6ab4649ee213 100644 (file)
@@ -1589,7 +1589,7 @@ func writelines() {
                        dt, da int
                        offs   int64
                )
-               for a := s.Autom; a != nil; a = a.Link {
+               for _, a := range s.Autom {
                        switch a.Name {
                        case obj.A_AUTO:
                                dt = DW_ABRV_AUTO
index cba803c8bbcec56cd60e539fb9a1a6c18d610168..3ee7b292e387765970c68cd7bd6af1e6b12b6337 100644 (file)
@@ -394,7 +394,7 @@ func markflood() {
                        if Debug['v'] > 1 {
                                fmt.Fprintf(&Bso, "marktext %s\n", s.Name)
                        }
-                       for a := s.Autom; a != nil; a = a.Link {
+                       for _, a := range s.Autom {
                                mark1(a.Gotype, s)
                        }
                }
index c5d736aaed6ab911674a38a7d23c8d49cda2e21f..9bc51f241c4e46d98165b4988f22f881329bfaa9 100644 (file)
@@ -1964,7 +1964,6 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) {
                }
        }
 
-       var a *Auto
        var off int32
        for s := Ctxt.Textp; s != nil; s = s.Next {
                put(s, s.Name, 'T', s.Value, s.Size, int(s.Version), s.Gotype)
@@ -1972,7 +1971,7 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) {
                // NOTE(ality): acid can't produce a stack trace without .frame symbols
                put(nil, ".frame", 'm', int64(s.Locals)+int64(Thearch.Ptrsize), 0, 0, nil)
 
-               for a = s.Autom; a != nil; a = a.Link {
+               for _, a := range s.Autom {
                        // Emit a or p according to actual offset, even if label is wrong.
                        // This avoids negative offsets, which cannot be encoded.
                        if a.Name != obj.A_AUTO && a.Name != obj.A_PARAM {
index e07b71d780bf77eca4c127312490013d68d6e4b4..3173d8744607021308bc3057422f4e5b639506a4 100644 (file)
@@ -67,7 +67,7 @@ type LSym struct {
        Dynimplib   string
        Dynimpvers  string
        Sect        *Section
-       Autom       *Auto
+       Autom       []Auto
        Pcln        *Pcln
        P           []byte
        R           []Reloc
@@ -145,10 +145,9 @@ type Reloc struct {
 
 type Auto struct {
        Asym    *LSym
-       Link    *Auto
+       Gotype  *LSym
        Aoffset int32
        Name    int16
-       Gotype  *LSym
 }
 
 type Shlib struct {
index d53cb3416261b1b3f23d7b54b75795d68adbb2a1..29f629efdc232c34cda9c3429227f36fa0b34271 100644 (file)
@@ -266,15 +266,14 @@ overwrite:
                }
                rdint(f) // v&1 is Leaf, currently unused
                n := rdint(f)
-               var a *Auto
+               s.Autom = make([]Auto, n)
                for i := 0; i < n; i++ {
-                       a = new(Auto)
-                       a.Asym = rdsym(ctxt, f, pkg)
-                       a.Aoffset = rdint32(f)
-                       a.Name = rdint16(f)
-                       a.Gotype = rdsym(ctxt, f, pkg)
-                       a.Link = s.Autom
-                       s.Autom = a
+                       s.Autom[i] = Auto{
+                               Asym:    rdsym(ctxt, f, pkg),
+                               Aoffset: rdint32(f),
+                               Name:    rdint16(f),
+                               Gotype:  rdsym(ctxt, f, pkg),
+                       }
                }
 
                s.Pcln = new(Pcln)