aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mbarrier.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2015-06-07 20:13:21 -0400
committerAustin Clements <austin@google.com>2015-06-08 05:13:15 +0000
commitb0532a96a850c6c93de2c414f5349562938f0f19 (patch)
tree54a9699312bb225e8c664048d343a61e679ac11b /src/runtime/mbarrier.go
parent306f8f11ad18452b61a8ba08aeaa488e48c3b40d (diff)
downloadgo-b0532a96a850c6c93de2c414f5349562938f0f19.tar.gz
go-b0532a96a850c6c93de2c414f5349562938f0f19.zip
runtime: fix write-barrier-enabled phase list in gcmarkwb_m
Commit 1303957 was supposed to enable write barriers during the concurrent scan phase, but it only enabled *calls* to the write barrier during this phase. It failed to update the redundant list of write-barrier-enabled phases in gcmarkwb_m, so it still wasn't greying objects during the scan phase. This commit fixes this by replacing the redundant list of phases in gcmarkwb_m with simply checking writeBarrierEnabled. This is almost certainly redundant with checks already done in callers, but the last time we tried to remove these redundant checks everything got much slower, so I'm leaving it alone for now. Fixes #11105. Change-Id: I00230a3cb80a008e749553a8ae901b409097e4be Reviewed-on: https://go-review.googlesource.com/10801 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Minux Ma <minux@golang.org>
Diffstat (limited to 'src/runtime/mbarrier.go')
-rw-r--r--src/runtime/mbarrier.go9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/runtime/mbarrier.go b/src/runtime/mbarrier.go
index 674160cb3a..95ee2ab672 100644
--- a/src/runtime/mbarrier.go
+++ b/src/runtime/mbarrier.go
@@ -72,14 +72,7 @@ import "unsafe"
// so it depends on write barriers to track changes to pointers in
// stack frames that have not been active. go:nowritebarrier
func gcmarkwb_m(slot *uintptr, ptr uintptr) {
- switch gcphase {
- default:
- throw("gcphasework in bad gcphase")
-
- case _GCoff, _GCstw, _GCsweep, _GCscan:
- // ok
-
- case _GCmark, _GCmarktermination:
+ if writeBarrierEnabled {
if ptr != 0 && inheap(ptr) {
shade(ptr)
}