aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/trace.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-04-17 00:21:30 -0400
committerRuss Cox <rsc@golang.org>2015-04-20 20:20:09 +0000
commit181e26b9fa3c85ca5a512a51278b3f22f6e64dc9 (patch)
tree441826cbaff52d78373d650977d3c0cfd619054a /src/runtime/trace.go
parentc776592a4ff17b2153492bf5b17ae3151a42abf0 (diff)
downloadgo-181e26b9fa3c85ca5a512a51278b3f22f6e64dc9.tar.xz
runtime: replace func-based write barrier skipping with type-based
This CL revises CL 7504 to use explicitly uintptr types for the struct fields that are going to be updated sometimes without write barriers. The result is that the fields are now updated *always* without write barriers. This approach has two important properties: 1) Now the GC never looks at the field, so if the missing reference could cause a problem, it will do so all the time, not just when the write barrier is missed at just the right moment. 2) Now a write barrier never happens for the field, avoiding the (correct) detection of inconsistent write barriers when GODEBUG=wbshadow=1. Change-Id: Iebd3962c727c0046495cc08914a8dc0808460e0e Reviewed-on: https://go-review.googlesource.com/9019 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/trace.go')
-rw-r--r--src/runtime/trace.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/trace.go b/src/runtime/trace.go
index a149799527..e0eb7d82ce 100644
--- a/src/runtime/trace.go
+++ b/src/runtime/trace.go
@@ -506,7 +506,7 @@ func traceEvent(ev byte, skip int, args ...uint64) {
// traceAcquireBuffer returns trace buffer to use and, if necessary, locks it.
func traceAcquireBuffer() (mp *m, pid int32, bufp **traceBuf) {
mp = acquirem()
- if p := mp.p; p != nil {
+ if p := mp.p.ptr(); p != nil {
return mp, p.id, &p.tracebuf
}
lock(&trace.bufLock)
@@ -732,7 +732,7 @@ func traceProcStop(pp *p) {
// to handle this we temporary employ the P.
mp := acquirem()
oldp := mp.p
- mp.p = pp
+ mp.p.set(pp)
traceEvent(traceEvProcStop, -1)
mp.p = oldp
releasem(mp)
@@ -806,7 +806,7 @@ func traceGoSysBlock(pp *p) {
// to handle this we temporary employ the P.
mp := acquirem()
oldp := mp.p
- mp.p = pp
+ mp.p.set(pp)
traceEvent(traceEvGoSysBlock, -1)
mp.p = oldp
releasem(mp)