aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/likelyadjust.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2016-03-09 19:27:57 -0800
committerKeith Randall <khr@golang.org>2016-03-10 22:33:49 +0000
commitddc6b64444c3914621b3b1ff019e02b5aabdc20c (patch)
treedd192ae64f4abcb0bcc694702f7f5e680578c67e /src/cmd/compile/internal/ssa/likelyadjust.go
parent9c8f549abbc339fce83f96d80500ab9160a4c84d (diff)
downloadgo-ddc6b64444c3914621b3b1ff019e02b5aabdc20c.tar.gz
go-ddc6b64444c3914621b3b1ff019e02b5aabdc20c.zip
cmd/compile: fix defer/deferreturn
Make sure we do any just-before-return cleanup on all paths out of a function, including when recovering. Each exit path should include deferreturn (if there are any defers) and then the exit code (e.g. copying heap-escaping return values back to the stack). Introduce a Defer SSA block type which has two outgoing edges - one the fallthrough edge (the defer was queued successfully) and one which immediately returns (the defer had a successful recover() call and normal execution should resume at the return point). Fixes #14725 Change-Id: Iad035c9fd25ef8b7a74dafbd7461cf04833d981f Reviewed-on: https://go-review.googlesource.com/20486 Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/likelyadjust.go')
-rw-r--r--src/cmd/compile/internal/ssa/likelyadjust.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssa/likelyadjust.go b/src/cmd/compile/internal/ssa/likelyadjust.go
index b01651971f..93f32c72bf 100644
--- a/src/cmd/compile/internal/ssa/likelyadjust.go
+++ b/src/cmd/compile/internal/ssa/likelyadjust.go
@@ -100,7 +100,7 @@ func likelyadjust(f *Func) {
// Calls. TODO not all calls are equal, names give useful clues.
// Any name-based heuristics are only relative to other calls,
// and less influential than inferences from loop structure.
- case BlockCall:
+ case BlockCall, BlockDefer:
local[b.ID] = blCALL
certain[b.ID] = max8(blCALL, certain[b.Succs[0].ID])