]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: repair GOSSAFUNC functionality
authorDavid Chase <drchase@google.com>
Thu, 15 Sep 2016 16:43:29 +0000 (12:43 -0400)
committerDavid Chase <drchase@google.com>
Thu, 15 Sep 2016 17:25:18 +0000 (17:25 +0000)
GOSSAFUNC=foo had previously only done printing for the
single function foo, and didn't quite clean up after itself
properly. Changes ensures that Config.HTML != nil iff
GOSSAFUNC==name-of-current-function.

Change-Id: I255e2902dfc64f715d93225f0d29d9525c06f764
Reviewed-on: https://go-review.googlesource.com/29250
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/ssa.go

index 9a4859670d95b2a4bbbb73fe85773796bdaeef42..9b67fe99ad5502d80a15b42c3a768ea0fced230c 100644 (file)
@@ -26,6 +26,7 @@ func initssa() *ssa.Config {
                        ssaConfig.Set387(Thearch.Use387)
                }
        }
+       ssaConfig.HTML = nil
        return ssaConfig
 }
 
@@ -71,11 +72,6 @@ func buildssa(fn *Node) *ssa.Func {
                s.config.HTML = ssa.NewHTMLWriter("ssa.html", s.config, name)
                // TODO: generate and print a mapping from nodes to values and blocks
        }
-       defer func() {
-               if !printssa {
-                       s.config.HTML.Close()
-               }
-       }()
 
        // Allocate starting block
        s.f.Entry = s.f.NewBlock(ssa.BlockPlain)
@@ -4298,6 +4294,7 @@ func genssa(f *ssa.Func, ptxt *obj.Prog, gcargs, gclocals *Sym) {
        removevardef(ptxt)
 
        f.Config.HTML.Close()
+       f.Config.HTML = nil
 }
 
 type FloatingEQNEJump struct {