]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: convert Dodata to a bool, rename to IsStatic
authorJosh Bleecher Snyder <josharian@gmail.com>
Mon, 16 May 2016 21:23:12 +0000 (14:23 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Wed, 24 Aug 2016 00:56:54 +0000 (00:56 +0000)
Passes toolstash -cmp.

Change-Id: I2c204ec14b0a72b592fb336acdd4dff55650f7f6
Reviewed-on: https://go-review.googlesource.com/26751
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/fmt.go
src/cmd/compile/internal/gc/sinit.go
src/cmd/compile/internal/gc/syntax.go
src/cmd/compile/internal/gc/walk.go

index bad8867be443963ec667604f0c850be196be97da..937f71469d99a503d31a87b14fdbe82ddb3decb5 100644 (file)
@@ -299,8 +299,8 @@ func jconv(n *Node, flag FmtFlag) string {
                fmt.Fprintf(&buf, " tc(%d)", n.Typecheck)
        }
 
-       if c == 0 && n.Dodata != 0 {
-               fmt.Fprintf(&buf, " dd(%d)", n.Dodata)
+       if c == 0 && n.IsStatic {
+               buf.WriteString(" static")
        }
 
        if n.Isddd {
index 7c47d0c00f6652531e994e09951e48f52d8c500a..0adcb373882417ccc7398787983b982aaccd3276 100644 (file)
@@ -641,7 +641,7 @@ func structlit(ctxt int, pass int, n *Node, var_ *Node, init *Nodes) {
                        if a.Op != OAS {
                                Fatalf("structlit: not as")
                        }
-                       a.Dodata = 2
+                       a.IsStatic = true
                } else {
                        a = orderstmtinplace(a)
                        a = walkstmt(a)
@@ -703,7 +703,7 @@ func arraylit(ctxt int, pass int, n *Node, var_ *Node, init *Nodes) {
                        if a.Op != OAS {
                                Fatalf("arraylit: not as")
                        }
-                       a.Dodata = 2
+                       a.IsStatic = true
                } else {
                        a = orderstmtinplace(a)
                        a = walkstmt(a)
@@ -730,7 +730,7 @@ func slicelit(ctxt int, n *Node, var_ *Node, init *Nodes) {
 
                a = Nod(OAS, var_, a)
                a = typecheck(a, Etop)
-               a.Dodata = 2
+               a.IsStatic = true
                init.Append(a)
                return
        }
@@ -910,7 +910,7 @@ func maplit(ctxt int, n *Node, m *Node, init *Nodes) {
                                as := Nod(OAS, lhs, index)
                                as = typecheck(as, Etop)
                                as = walkexpr(as, init)
-                               as.Dodata = 2
+                               as.IsStatic = true
                                init.Append(as)
 
                                // build vstatv[b] = value
@@ -919,7 +919,7 @@ func maplit(ctxt int, n *Node, m *Node, init *Nodes) {
                                as = Nod(OAS, lhs, value)
                                as = typecheck(as, Etop)
                                as = walkexpr(as, init)
-                               as.Dodata = 2
+                               as.IsStatic = true
                                init.Append(as)
 
                                b++
@@ -1326,15 +1326,15 @@ func isvaluelit(n *Node) bool {
 // If reportOnly is true, it does not emit static data and does not modify the AST.
 func gen_as_init(n *Node, reportOnly bool) bool {
        success := genAsInitNoCheck(n, reportOnly)
-       if !success && n.Dodata == 2 {
+       if !success && n.IsStatic {
                Dump("\ngen_as_init", n)
-               Fatalf("gen_as_init couldn't make data statement")
+               Fatalf("gen_as_init couldn't generate static data")
        }
        return success
 }
 
 func genAsInitNoCheck(n *Node, reportOnly bool) bool {
-       if n.Dodata == 0 {
+       if !n.IsStatic {
                return false
        }
 
index 1081ad10cde30c43e3519f8d4ffdf45e427931e7..79d9d8ce200e75d9ff27694cb248af48596556bf 100644 (file)
@@ -63,7 +63,7 @@ type Node struct {
        Walkdef   uint8
        Typecheck uint8
        Local     bool
-       Dodata    uint8
+       IsStatic  bool // whether this Node will be converted to purely static data
        Initorder uint8
        Used      bool
        Isddd     bool // is the argument variadic
index 9d1c39c85edc5080400c4bf1cbb2c84aa5bd81e3..114f1b096272a1764d27ce00265106816d70a89a 100644 (file)
@@ -145,7 +145,7 @@ func walkstmt(n *Node) *Node {
        if n == nil {
                return n
        }
-       if n.Dodata == 2 { // don't walk, generated by anylit.
+       if n.IsStatic { // don't walk, generated by anylit.
                return n
        }
 
@@ -794,9 +794,9 @@ opswitch:
                }
 
                if n.Left != nil && n.Right != nil {
-                       dd := n.Dodata
+                       static := n.IsStatic
                        n = convas(n, init)
-                       n.Dodata = dd
+                       n.IsStatic = static
                        n = applywritebarrier(n)
                }