diff options
author | Austin Clements <austin@google.com> | 2018-01-25 17:22:41 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2018-01-25 23:15:55 +0000 |
commit | b5b35be2b8a73b404290f7d0d4c14912a707f9a0 (patch) | |
tree | d7dd33fa2603a17b1d4eb50b2b56b12155a7ef04 | |
parent | 651ddbdb5056ded455f47f9c494c67b389622a47 (diff) | |
download | go-b5b35be2b8a73b404290f7d0d4c14912a707f9a0.tar.gz go-b5b35be2b8a73b404290f7d0d4c14912a707f9a0.zip |
cmd/compile: don't inline functions that call recover
recover determines whether it's being called by a deferred frame by
matching its caller's argument frame pointer with the one recorded in
the panic object. That means its caller needs a valid and unique
argument frame pointer, so it must not be inlined.
With this fix, test/recover.go passes with -l=4.
Fixes #23557.
Change-Id: I1f32a624c49e387cfc67893a0829bb248d69c3d4
Reviewed-on: https://go-review.googlesource.com/90035
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
-rw-r--r-- | src/cmd/compile/internal/gc/inl.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/gc/inl.go b/src/cmd/compile/internal/gc/inl.go index 2f96b46f2b..c8296971cd 100644 --- a/src/cmd/compile/internal/gc/inl.go +++ b/src/cmd/compile/internal/gc/inl.go @@ -314,12 +314,18 @@ func (v *hairyVisitor) visit(n *Node) bool { } // Things that are too hairy, irrespective of the budget - case OCALL, OCALLINTER, OPANIC, ORECOVER: + case OCALL, OCALLINTER, OPANIC: if Debug['l'] < 4 { v.reason = "non-leaf op " + n.Op.String() return true } + case ORECOVER: + // recover matches the argument frame pointer to find + // the right panic value, so it needs an argument frame. + v.reason = "call to recover" + return true + case OCLOSURE, OCALLPART, ORANGE, |