]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: prevent inlining go:yeswritebarrierrec functions
authorMatthew Dempsky <mdempsky@google.com>
Fri, 20 Oct 2017 21:20:48 +0000 (14:20 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 20 Oct 2017 22:03:07 +0000 (22:03 +0000)
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>
src/cmd/compile/internal/gc/inl.go

index f172492128ee9b70e4f518f3c0c43df7e2e9e0ef..5772ebe806fd1c5c55cf8182d1d610228a21967c 100644 (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"