]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: clean up one Node.Etype usage
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 6 May 2016 16:24:16 +0000 (09:24 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 23 Aug 2016 20:01:22 +0000 (20:01 +0000)
Whoever Marvin is, we're one step closer to realizing his dream.

Change-Id: I8dece4417d0f9ec234be158d0ee7bc6735342d93
Reviewed-on: https://go-review.googlesource.com/27465
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/inl.go
src/cmd/compile/internal/gc/syntax.go

index d45186aa516a43264405142a3210ea864fcce538..0bdabb8c911cd4cbd1c9430d91140208b0a47077 100644 (file)
@@ -365,8 +365,7 @@ func inlnode(n *Node) *Node {
        case ODEFER, OPROC:
                switch n.Left.Op {
                case OCALLFUNC, OCALLMETH:
-                       // TODO(marvin): Fix Node.EType type union.
-                       n.Left.Etype = EType(n.Op)
+                       n.Left.setNoInline(true)
                }
                fallthrough
 
@@ -468,8 +467,7 @@ func inlnode(n *Node) *Node {
        // switch at the top of this function.
        switch n.Op {
        case OCALLFUNC, OCALLMETH:
-               // TODO(marvin): Fix Node.EType type union.
-               if n.Etype == EType(OPROC) || n.Etype == EType(ODEFER) {
+               if n.noInline() {
                        return n
                }
        }
index 3608d17c34d768a68bbb9a2455303a52922b03fd..1081ad10cde30c43e3519f8d4ffdf45e427931e7 100644 (file)
@@ -80,6 +80,7 @@ const (
        notLiveAtEnd
        isClosureVar
        isOutputParamHeapAddr
+       noInline // used internally by inliner to indicate that a function call should not be inlined; set for OCALLFUNC and OCALLMETH only
 )
 
 func (n *Node) HasBreak() bool {
@@ -112,6 +113,16 @@ func (n *Node) setIsClosureVar(b bool) {
                n.flags &^= isClosureVar
        }
 }
+func (n *Node) noInline() bool {
+       return n.flags&noInline != 0
+}
+func (n *Node) setNoInline(b bool) {
+       if b {
+               n.flags |= noInline
+       } else {
+               n.flags &^= noInline
+       }
+}
 
 func (n *Node) IsOutputParamHeapAddr() bool {
        return n.flags&isOutputParamHeapAddr != 0