]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove state.exitCode
authorMatthew Dempsky <mdempsky@google.com>
Thu, 8 Mar 2018 10:20:26 +0000 (02:20 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 8 Mar 2018 18:22:04 +0000 (18:22 +0000)
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 <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/ssa.go

index 192e13eeb56d36b69c21fe324416c2014ce7c312..c6ecc263d83df23d0fcf5e63282a7203078e3be7 100644 (file)
@@ -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 {