1
0
mirror of https://github.com/golang/go synced 2024-11-24 10:30:10 -07:00

cmd/link: replace LSym.Queue with a slice

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>
This commit is contained in:
David Crawshaw 2016-03-02 22:28:05 -05:00
parent 596df2424d
commit 1661493c73
2 changed files with 9 additions and 19 deletions

View 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)

View File

@ -63,7 +63,6 @@ type LSym struct {
Outer *LSym
Gotype *LSym
Reachparent *LSym
Queue *LSym
File string
Dynimplib string
Dynimpvers string