mirror of
https://github.com/golang/go
synced 2024-11-19 12:34:47 -07:00
cmd/compile: replace TypeList with []*Type
Good riddance to another one-off linked list type. Change-Id: Idf9926a701ab4da8a022be1d61f1257020d58fc5 Reviewed-on: https://go-review.googlesource.com/20212 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net> Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
060a2bacb7
commit
1765863e57
@ -341,14 +341,8 @@ func dowidth(t *Type) {
|
||||
// dowidth should only be called when the type's size
|
||||
// is needed immediately. checkwidth makes sure the
|
||||
// size is evaluated eventually.
|
||||
type TypeList struct {
|
||||
t *Type
|
||||
next *TypeList
|
||||
}
|
||||
|
||||
var tlfree *TypeList
|
||||
|
||||
var tlq *TypeList
|
||||
var deferredTypeStack []*Type
|
||||
|
||||
func checkwidth(t *Type) {
|
||||
if t == nil {
|
||||
@ -371,16 +365,7 @@ func checkwidth(t *Type) {
|
||||
}
|
||||
t.Deferwidth = true
|
||||
|
||||
l := tlfree
|
||||
if l != nil {
|
||||
tlfree = l.next
|
||||
} else {
|
||||
l = new(TypeList)
|
||||
}
|
||||
|
||||
l.t = t
|
||||
l.next = tlq
|
||||
tlq = l
|
||||
deferredTypeStack = append(deferredTypeStack, t)
|
||||
}
|
||||
|
||||
func defercheckwidth() {
|
||||
@ -395,12 +380,11 @@ func resumecheckwidth() {
|
||||
if defercalc == 0 {
|
||||
Fatalf("resumecheckwidth")
|
||||
}
|
||||
for l := tlq; l != nil; l = tlq {
|
||||
l.t.Deferwidth = false
|
||||
tlq = l.next
|
||||
dowidth(l.t)
|
||||
l.next = tlfree
|
||||
tlfree = l
|
||||
for len(deferredTypeStack) > 0 {
|
||||
t := deferredTypeStack[len(deferredTypeStack)-1]
|
||||
deferredTypeStack = deferredTypeStack[:len(deferredTypeStack)-1]
|
||||
t.Deferwidth = false
|
||||
dowidth(t)
|
||||
}
|
||||
|
||||
defercalc = 0
|
||||
|
Loading…
Reference in New Issue
Block a user