]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: replace LSym.Queue with a slice
authorDavid Crawshaw <crawshaw@golang.org>
Thu, 3 Mar 2016 03:28:05 +0000 (22:28 -0500)
committerDavid Crawshaw <crawshaw@golang.org>
Thu, 3 Mar 2016 17:20:33 +0000 (17:20 +0000)
Change-Id: Idc95452088d23be8e18522209d98f789dfca070b
Reviewed-on: https://go-review.googlesource.com/20161
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/go.go
src/cmd/link/internal/ld/link.go

index e6c541a3ab8af13605d2c2b2f0e989fd55bfbfdb..cba803c8bbcec56cd60e539fb9a1a6c18d610168 100644 (file)
@@ -367,9 +367,7 @@ func Adddynsym(ctxt *Link, s *LSym) {
        }
 }
 
-var markq *LSym
-
-var emarkq *LSym
+var markQueue []*LSym
 
 func mark1(s *LSym, parent *LSym) {
        if s == nil || s.Attr.Reachable() {
@@ -380,41 +378,34 @@ func mark1(s *LSym, parent *LSym) {
        }
        s.Attr |= AttrReachable
        s.Reachparent = parent
-       if markq == nil {
-               markq = s
-       } else {
-               emarkq.Queue = s
-       }
-       emarkq = s
+       markQueue = append(markQueue, s)
 }
 
 func mark(s *LSym) {
        mark1(s, nil)
 }
 
+// markflood makes the dependencies of any reachable symable also reachable.
 func markflood() {
-       var a *Auto
-       var i int
-
-       for s := markq; s != nil; s = s.Queue {
+       for len(markQueue) > 0 {
+               s := markQueue[0]
+               markQueue = markQueue[1:]
                if s.Type == obj.STEXT {
                        if Debug['v'] > 1 {
                                fmt.Fprintf(&Bso, "marktext %s\n", s.Name)
                        }
-                       for a = s.Autom; a != nil; a = a.Link {
+                       for a := s.Autom; a != nil; a = a.Link {
                                mark1(a.Gotype, s)
                        }
                }
-
-               for i = 0; i < len(s.R); i++ {
+               for i := 0; i < len(s.R); i++ {
                        mark1(s.R[i].Sym, s)
                }
                if s.Pcln != nil {
-                       for i = 0; i < s.Pcln.Nfuncdata; i++ {
+                       for i := 0; i < s.Pcln.Nfuncdata; i++ {
                                mark1(s.Pcln.Funcdata[i], s)
                        }
                }
-
                mark1(s.Gotype, s)
                mark1(s.Sub, s)
                mark1(s.Outer, s)
index d2a18af75e552a1300c28e907c5fde359c20aeed..e07b71d780bf77eca4c127312490013d68d6e4b4 100644 (file)
@@ -63,7 +63,6 @@ type LSym struct {
        Outer       *LSym
        Gotype      *LSym
        Reachparent *LSym
-       Queue       *LSym
        File        string
        Dynimplib   string
        Dynimpvers  string