aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDave Cheney <dave@cheney.net>2015-04-08 02:01:55 +1000
committerDave Cheney <dave@cheney.net>2015-04-07 16:38:57 +0000
commitd3252a2db9b8e1b6cff26dd4d2721cedc91378dc (patch)
tree2de06561c5e5d780610981c0f69c0e79b6748b19 /src
parentd6b40698528c94f3d0d3e263d5713994cebfb3a6 (diff)
downloadgo-d3252a2db9b8e1b6cff26dd4d2721cedc91378dc.tar.xz
cmd/internal/gc: fix race build (again)
Add OGETG to the list of ignored operations. We don't instrument the runtime package, but calls to runtime.getg can appear in other packages, for example, after inlining runtime.LockOSThread. Change-Id: I8d6e91f1f3c8fd1302b596bdead42d588c059911 Reviewed-on: https://go-review.googlesource.com/8553 Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/internal/gc/racewalk.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cmd/internal/gc/racewalk.go b/src/cmd/internal/gc/racewalk.go
index 7ae1c55192..ec55501714 100644
--- a/src/cmd/internal/gc/racewalk.go
+++ b/src/cmd/internal/gc/racewalk.go
@@ -410,9 +410,6 @@ func racewalknode(np **Node, init **NodeList, wr int, skip int) {
OLABEL:
goto ret
- case OGETG:
- Yyerror("racewalk: OGETG can happen only in runtime which we don't instrument")
-
// does not require instrumentation
case OPRINT, // don't bother instrumenting it
OPRINTN, // don't bother instrumenting it
@@ -428,6 +425,11 @@ func racewalknode(np **Node, init **NodeList, wr int, skip int) {
ONONAME,
OLITERAL,
OSLICESTR,
+ // g is goroutine local so cannot race. Although we don't instrument
+ // the runtime package, through inlining the call to runtime.getg can
+ // appear in non runtime packages, for example, after inlining
+ // runtime.LockOSThread.
+ OGETG,
// always preceded by bounds checking, avoid double instrumentation.
OTYPESW: // ignored by code generation, do not instrument.
goto ret