From 181e26b9fa3c85ca5a512a51278b3f22f6e64dc9 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 17 Apr 2015 00:21:30 -0400 Subject: 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 Run-TryBot: Russ Cox TryBot-Result: Gobot Gobot --- src/runtime/panic.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/runtime/panic.go') diff --git a/src/runtime/panic.go b/src/runtime/panic.go index 9b937f5ad7..0e4086c7ef 100644 --- a/src/runtime/panic.go +++ b/src/runtime/panic.go @@ -165,7 +165,7 @@ func newdefer(siz int32) *_defer { sc := deferclass(uintptr(siz)) mp := acquirem() if sc < uintptr(len(p{}.deferpool)) { - pp := mp.p + pp := mp.p.ptr() if len(pp.deferpool[sc]) == 0 && sched.deferpool[sc] != nil { lock(&sched.deferlock) for len(pp.deferpool[sc]) < cap(pp.deferpool[sc])/2 && sched.deferpool[sc] != nil { @@ -223,7 +223,7 @@ func freedefer(d *_defer) { sc := deferclass(uintptr(d.siz)) if sc < uintptr(len(p{}.deferpool)) { mp := acquirem() - pp := mp.p + pp := mp.p.ptr() if len(pp.deferpool[sc]) == cap(pp.deferpool[sc]) { // Transfer half of local cache to the central cache. var first, last *_defer -- cgit v1.3-5-g9baa