aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc.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/malloc.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/malloc.go')
-rw-r--r--src/runtime/malloc.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index e41c2736b1..5fe0b160e6 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -817,8 +817,8 @@ func persistentalloc(size, align uintptr, stat *uint64) unsafe.Pointer {
mp := acquirem()
var persistent *persistentAlloc
- if mp != nil && mp.p != nil {
- persistent = &mp.p.palloc
+ if mp != nil && mp.p != 0 {
+ persistent = &mp.p.ptr().palloc
} else {
lock(&globalAlloc.mutex)
persistent = &globalAlloc.persistentAlloc