From: Matthew Dempsky Date: Thu, 8 Mar 2018 10:20:26 +0000 (-0800) Subject: cmd/compile: remove state.exitCode X-Git-Tag: go1.11beta1~1287 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8b766e5d09bc4bf2e4fc365111b60a400b144f83;p=gostls13.git cmd/compile: remove state.exitCode We're holding onto the function's complete AST anyway, so might as well grab the exit code from there. Passes toolstash-check. Change-Id: I851b5dfdb53f991e9cd9488d25d0d2abc2a8379f Reviewed-on: https://go-review.googlesource.com/99417 Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go index 192e13eeb5..c6ecc263d8 100644 --- a/src/cmd/compile/internal/gc/ssa.go +++ b/src/cmd/compile/internal/gc/ssa.go @@ -118,7 +118,6 @@ func buildssa(fn *Node, worker int) *ssa.Func { if fn.Func.Pragma&Nosplit != 0 { s.f.NoSplit = true } - s.exitCode = fn.Func.Exit s.panics = map[funcLine]*ssa.Block{} s.softFloat = s.config.SoftFloat @@ -191,9 +190,6 @@ func buildssa(fn *Node, worker int) *ssa.Func { s.insertPhis() - // Don't carry reference this around longer than necessary - s.exitCode = Nodes{} - // Main call to ssa package to compile function ssa.Compile(s.f) return s.f @@ -246,10 +242,6 @@ type state struct { labels map[string]*ssaLabel labeledNodes map[*Node]*ssaLabel - // Code that must precede any return - // (e.g., copying value of heap-escaped paramout back to true paramout) - exitCode Nodes - // unlabeled break and continue statement tracking breakTo *ssa.Block // current target for plain break statement continueTo *ssa.Block // current target for plain continue statement @@ -1018,7 +1010,7 @@ func (s *state) exit() *ssa.Block { // Run exit code. Typically, this code copies heap-allocated PPARAMOUT // variables back to the stack. - s.stmtList(s.exitCode) + s.stmtList(s.curfn.Func.Exit) // Store SSAable PPARAMOUT variables back to stack locations. for _, n := range s.returns {