Commit 371aa23d authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: convert Type.Trecur to a boolean flag

Change-Id: I162e86e5f92c8b827a74ee860d16abadf83bc43e
Reviewed-on: https://go-review.googlesource.com/38910
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent efc47819
......@@ -1426,10 +1426,10 @@ func lookdot0(s *Sym, t *Type, save **Field, ignorecase bool) int {
// embedded fields at depth d, so callers can decide whether to retry at
// a greater depth.
func adddot1(s *Sym, t *Type, d int, save **Field, ignorecase bool) (c int, more bool) {
if t.Trecur != 0 {
if t.Recur() {
return
}
t.Trecur = 1
t.SetRecur(true)
var u *Type
d--
......@@ -1471,7 +1471,7 @@ func adddot1(s *Sym, t *Type, d int, save **Field, ignorecase bool) (c int, more
}
out:
t.Trecur = 0
t.SetRecur(false)
return c, more
}
......@@ -1585,10 +1585,10 @@ func expand0(t *Type, followptr bool) {
}
func expand1(t *Type, top, followptr bool) {
if t.Trecur != 0 {
if t.Recur() {
return
}
t.Trecur = 1
t.SetRecur(true)
if !top {
expand0(t, followptr)
......@@ -1615,7 +1615,7 @@ func expand1(t *Type, top, followptr bool) {
}
out:
t.Trecur = 0
t.SetRecur(false)
}
func expandmeth(t *Type) {
......
......@@ -153,9 +153,8 @@ type Type struct {
Sym *Sym // symbol containing name, for named types
Vargen int32 // unique name for OTYPE/ONAME
Etype EType // kind of type
Trecur uint8 // to detect loops
Align uint8 // the required alignment of this type, in bytes
Etype EType // kind of type
Align uint8 // the required alignment of this type, in bytes
flags bitset8
}
......@@ -166,6 +165,7 @@ const (
typeBroke // broken type definition
typeNoalg // suppress hash and eq algorithm generation
typeDeferwidth
typeRecur
)
func (t *Type) Local() bool { return t.flags&typeLocal != 0 }
......@@ -173,12 +173,14 @@ func (t *Type) NotInHeap() bool { return t.flags&typeNotInHeap != 0 }
func (t *Type) Broke() bool { return t.flags&typeBroke != 0 }
func (t *Type) Noalg() bool { return t.flags&typeNoalg != 0 }
func (t *Type) Deferwidth() bool { return t.flags&typeDeferwidth != 0 }
func (t *Type) Recur() bool { return t.flags&typeRecur != 0 }
func (t *Type) SetLocal(b bool) { t.flags.set(typeLocal, b) }
func (t *Type) SetNotInHeap(b bool) { t.flags.set(typeNotInHeap, b) }
func (t *Type) SetBroke(b bool) { t.flags.set(typeBroke, b) }
func (t *Type) SetNoalg(b bool) { t.flags.set(typeNoalg, b) }
func (t *Type) SetDeferwidth(b bool) { t.flags.set(typeDeferwidth, b) }
func (t *Type) SetRecur(b bool) { t.flags.set(typeRecur, b) }
// MapType contains Type fields specific to maps.
type MapType struct {
......
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