]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: convert Type.Trecur to a boolean flag
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 30 Mar 2017 04:00:55 +0000 (21:00 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 30 Mar 2017 17:45:42 +0000 (17:45 +0000)
Change-Id: I162e86e5f92c8b827a74ee860d16abadf83bc43e
Reviewed-on: https://go-review.googlesource.com/38910
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/subr.go
src/cmd/compile/internal/gc/type.go

index f6690e0f1bb7129930cd2a504c4d600787d10825..96f97cec242f28a14783196291b5f35b9ff4bb33 100644 (file)
@@ -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) {
index 7f4796d60ce175b26f1c42bc80acdefbcbd17b2e..74285e5d3bf4f7ade5eac7765240ac1903f10009 100644 (file)
@@ -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 {