1
0
mirror of https://github.com/golang/go synced 2024-11-24 02:20:18 -07:00

cmd/compile: prevent inlining go:yeswritebarrierrec functions

Fixes #22342.

Change-Id: Ic942162e98dce5749e381a31d58b0bf16c7d6f98
Reviewed-on: https://go-review.googlesource.com/72132
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Matthew Dempsky 2017-10-20 14:20:48 -07:00
parent 5c18a3ca70
commit 4e64ee423c

View File

@ -117,6 +117,15 @@ func caninl(fn *Node) {
return
}
// The nowritebarrierrec checker currently works at function
// granularity, so inlining yeswritebarrierrec functions can
// confuse it (#22342). As a workaround, disallow inlining
// them for now.
if fn.Func.Pragma&Yeswritebarrierrec != 0 {
reason = "marked go:yeswritebarrierrec"
return
}
// If fn has no body (is defined outside of Go), cannot inline it.
if fn.Nbody.Len() == 0 {
reason = "no function body"