From: Josh Bleecher Snyder Date: Mon, 16 May 2016 21:14:16 +0000 (-0700) Subject: cmd/compile: simplify isglobal X-Git-Tag: go1.8beta1~1666 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a301b329e5c99693cf5a35ad93e9db5198f0b284;p=gostls13.git cmd/compile: simplify isglobal Passes toolstash -cmp. Change-Id: I16ec0c11096bf4c020cf41392effeb67436f32ba Reviewed-on: https://go-review.googlesource.com/26750 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index 55a29e5bad..9d1c39c85e 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -2127,18 +2127,9 @@ func isstack(n *Node) bool { return false } -func isglobal(n *Node) bool { +func (n *Node) isGlobal() bool { n = outervalue(n) - - switch n.Op { - case ONAME: - switch n.Class { - case PEXTERN: - return true - } - } - - return false + return n.Op == ONAME && n.Class == PEXTERN } // Do we need a write barrier for the assignment l = r? @@ -2193,7 +2184,7 @@ func needwritebarrier(l *Node, r *Node) bool { // No write barrier for storing address of global, which // is live no matter what. - if r.Op == OADDR && isglobal(r.Left) { + if r.Op == OADDR && r.Left.isGlobal() { return false }