]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: don't inline from norace packages in race mode
authorCherry Mui <cherryyz@google.com>
Tue, 16 May 2023 23:52:41 +0000 (19:52 -0400)
committerCherry Mui <cherryyz@google.com>
Wed, 17 May 2023 14:48:16 +0000 (14:48 +0000)
commit87e69c1812c2197688e0d14720760ea87b3b26af
tree0b14ad0f5345e13cefed1708095bfb212223b502
parentbf8571c5d6ce823e3ad7491429cf26d3a74461aa
cmd/compile: don't inline from norace packages in race mode

In race mode (or other instrumentation mode), if the caller is in
a regular package and the callee is in a norace (or noinstrument)
package, don't inline. Otherwise, when the caller is instumented
it will also affect the inlined callee.

An example is sync.(*Mutex).Unlock, which is typically not inlined
but with PGO it can be inlined into a regular function, which is
then get instrumented. But the rest of the sync package, in
particular, the Lock function is not instrumented, causing the
race detector to signal false race.

Change-Id: Ia78bb602c6da63a34ec2909b9a82646bf20873f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/495595
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/inline/inl.go
src/cmd/compile/internal/types/type.go