]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: change Func.FCurfn to IsHiddenClosure
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 27 Oct 2016 05:23:32 +0000 (22:23 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 27 Oct 2016 16:37:33 +0000 (16:37 +0000)
IsHiddenClosure is more descriptive.

Change-Id: I06651072925a958b148b64ab0db3a9bfc839af9b
Reviewed-on: https://go-review.googlesource.com/32224
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/esc.go
src/cmd/compile/internal/gc/sizeof_test.go
src/cmd/compile/internal/gc/subr.go
src/cmd/compile/internal/gc/syntax.go

index afe044acd6500e07c052cd49d8c8f033aa1264f5..c4b9ad0d927e163d13995d4857f77043eadcd72d 100644 (file)
@@ -347,7 +347,7 @@ func newname(s *Sym) *Node {
 func newfuncname(s *Sym) *Node {
        n := newname(s)
        n.Func = new(Func)
-       n.Func.FCurfn = Curfn
+       n.Func.IsHiddenClosure = Curfn != nil
        return n
 }
 
index 45c0d789d1e686365a4dda0d667d1d7a00192b1d..5e1c06cbe7245d3fb2164eb735300bf1de812993 100644 (file)
@@ -18,7 +18,7 @@ import (
 // The algorithm (known as Tarjan's algorithm) for doing that is taken from
 // Sedgewick, Algorithms, Second Edition, p. 482, with two adaptations.
 //
-// First, a hidden closure function (n.Func.FCurfn != nil) cannot be the
+// First, a hidden closure function (n.Func.IsHiddenClosure) cannot be the
 // root of a connected component. Refusing to use it as a root
 // forces it into the component of the function in which it appears.
 // This is more convenient for escape analysis.
@@ -58,7 +58,7 @@ func visitBottomUp(list []*Node, analyze func(list []*Node, recursive bool)) {
        v.analyze = analyze
        v.nodeID = make(map[*Node]uint32)
        for _, n := range list {
-               if n.Op == ODCLFUNC && n.Func.FCurfn == nil {
+               if n.Op == ODCLFUNC && !n.Func.IsHiddenClosure {
                        v.visit(n)
                }
        }
@@ -78,7 +78,7 @@ func (v *bottomUpVisitor) visit(n *Node) uint32 {
 
        v.stack = append(v.stack, n)
        min = v.visitcodelist(n.Nbody, min)
-       if (min == id || min == id+1) && n.Func.FCurfn == nil {
+       if (min == id || min == id+1) && !n.Func.IsHiddenClosure {
                // This node is the root of a strongly connected component.
 
                // The original min passed to visitcodelist was v.nodeID[n]+1.
index 185b19135aa2a152c65d64848168149f54db9e24..2488ec9157e23239a76f4a7578b67ee4bfa4af35 100644 (file)
@@ -22,7 +22,7 @@ func TestSizeof(t *testing.T) {
                _32bit uintptr     // size on 32bit platforms
                _64bit uintptr     // size on 64bit platforms
        }{
-               {Func{}, 96, 168},
+               {Func{}, 92, 160},
                {Name{}, 52, 80},
                {Node{}, 92, 144},
                {Sym{}, 60, 112},
index 4e908b23671878585dd8f0a4affd059f0cc30bc4..fafb8ffc1e5ada71060c8bff49e1b31afa3ee022 100644 (file)
@@ -361,7 +361,7 @@ func nod(op Op, nleft *Node, nright *Node) *Node {
        switch op {
        case OCLOSURE, ODCLFUNC:
                n.Func = new(Func)
-               n.Func.FCurfn = Curfn
+               n.Func.IsHiddenClosure = Curfn != nil
        case ONAME:
                n.Name = new(Name)
                n.Name.Param = new(Param)
index 74492fd853ea6be23e4f5dafca81ab4c05a5ffcd..4d4ec4f24dd128ed73ca47e96b75768ad899220c 100644 (file)
@@ -284,7 +284,6 @@ type Func struct {
        Ntype      *Node // signature
        Top        int   // top context (Ecall, Eproc, etc)
        Closure    *Node // OCLOSURE <-> ODCLFUNC
-       FCurfn     *Node
        Nname      *Node
 
        Inl     Nodes // copy of the body for use in inlining
@@ -296,11 +295,12 @@ type Func struct {
        Endlineno int32
        WBLineno  int32 // line number of first write barrier
 
-       Pragma        Pragma // go:xxx function annotations
-       Dupok         bool   // duplicate definitions ok
-       Wrapper       bool   // is method wrapper
-       Needctxt      bool   // function uses context register (has closure variables)
-       ReflectMethod bool   // function calls reflect.Type.Method or MethodByName
+       Pragma          Pragma // go:xxx function annotations
+       Dupok           bool   // duplicate definitions ok
+       Wrapper         bool   // is method wrapper
+       Needctxt        bool   // function uses context register (has closure variables)
+       ReflectMethod   bool   // function calls reflect.Type.Method or MethodByName
+       IsHiddenClosure bool
 }
 
 type Op uint8