Commit a20fbe8e authored by Marvin Stenger's avatar Marvin Stenger Committed by Brad Fitzpatrick

cmd/compile/internal/gc: convert fields of Symlink to bool

Convert two fields of struct Symlink in subr.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I913006f41605b17b0d82fe358ee773f6ecaa681c
Reviewed-on: https://go-review.googlesource.com/14378Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent d862753c
......@@ -2163,17 +2163,17 @@ func adddot(n *Node) *Node {
*/
type Symlink struct {
field *Type
good uint8
followptr uint8
link *Symlink
good bool
followptr bool
}
var slist *Symlink
func expand0(t *Type, followptr int) {
func expand0(t *Type, followptr bool) {
u := t
if Isptr[u.Etype] {
followptr = 1
followptr = true
u = u.Type
}
......@@ -2187,7 +2187,7 @@ func expand0(t *Type, followptr int) {
sl = new(Symlink)
sl.field = f
sl.link = slist
sl.followptr = uint8(followptr)
sl.followptr = followptr
slist = sl
}
......@@ -2205,13 +2205,13 @@ func expand0(t *Type, followptr int) {
sl = new(Symlink)
sl.field = f
sl.link = slist
sl.followptr = uint8(followptr)
sl.followptr = followptr
slist = sl
}
}
}
func expand1(t *Type, d int, followptr int) {
func expand1(t *Type, d int, followptr bool) {
if t.Trecur != 0 {
return
}
......@@ -2226,7 +2226,7 @@ func expand1(t *Type, d int, followptr int) {
u := t
if Isptr[u.Etype] {
followptr = 1
followptr = true
u = u.Type
}
......@@ -2263,7 +2263,7 @@ func expandmeth(t *Type) {
// generate all reachable methods
slist = nil
expand1(t, len(dotlist)-1, 0)
expand1(t, len(dotlist)-1, false)
// check each method to be uniquely reachable
var c int
......@@ -2278,7 +2278,7 @@ func expandmeth(t *Type) {
if c == 1 {
// addot1 may have dug out arbitrary fields, we only want methods.
if f.Type.Etype == TFUNC && f.Type.Thistuple > 0 {
sl.good = 1
sl.good = true
sl.field = f
}
}
......@@ -2293,13 +2293,13 @@ func expandmeth(t *Type) {
t.Xmethod = t.Method
for sl := slist; sl != nil; sl = sl.link {
if sl.good != 0 {
if sl.good {
// add it to the base type method list
f = typ(TFIELD)
*f = *sl.field
f.Embedded = 1 // needs a trampoline
if sl.followptr != 0 {
if sl.followptr {
f.Embedded = 2
}
f.Down = t.Xmethod
......@@ -2968,8 +2968,8 @@ func geneq(sym *Sym, t *Type) {
safemode = old_safemode
}
func ifacelookdot(s *Sym, t *Type, followptr *int, ignorecase int) *Type {
*followptr = 0
func ifacelookdot(s *Sym, t *Type, followptr *bool, ignorecase int) *Type {
*followptr = false
if t == nil {
return nil
......@@ -2988,7 +2988,7 @@ func ifacelookdot(s *Sym, t *Type, followptr *int, ignorecase int) *Type {
if c == 1 {
for i = 0; i < d; i++ {
if Isptr[dotlist[i].field.Type.Etype] {
*followptr = 1
*followptr = true
break
}
}
......@@ -3046,7 +3046,7 @@ func implements(t *Type, iface *Type, m **Type, samename **Type, ptr *int) bool
}
var tm *Type
var imtype *Type
var followptr int
var followptr bool
var rcvr *Type
for im := iface.Type; im != nil; im = im.Down {
imtype = methodfunc(im.Type, nil)
......@@ -3065,7 +3065,7 @@ func implements(t *Type, iface *Type, m **Type, samename **Type, ptr *int) bool
// the method does not exist for value types.
rcvr = getthisx(tm.Type).Type.Type
if Isptr[rcvr.Etype] && !Isptr[t0.Etype] && followptr == 0 && !isifacemethod(tm.Type) {
if Isptr[rcvr.Etype] && !Isptr[t0.Etype] && !followptr && !isifacemethod(tm.Type) {
if false && Debug['r'] != 0 {
Yyerror("interface pointer mismatch")
}
......
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