From 3eb16c059d301bc7242461ac8480d95e433e0374 Mon Sep 17 00:00:00 2001 From: David Chase Date: Thu, 15 Sep 2016 12:43:29 -0400 Subject: [PATCH] cmd/compile: repair GOSSAFUNC functionality 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 Reviewed-by: Keith Randall TryBot-Result: Gobot Gobot --- src/cmd/compile/internal/gc/ssa.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go index 9a4859670d..9b67fe99ad 100644 --- a/src/cmd/compile/internal/gc/ssa.go +++ b/src/cmd/compile/internal/gc/ssa.go @@ -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 {