Commit 1765863e authored by Matthew Dempsky's avatar Matthew Dempsky

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: 's avatarDave Cheney <dave@cheney.net>
Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
parent 060a2bac
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment