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>
diff --git a/src/runtime/netpoll_solaris.go b/src/runtime/netpoll_solaris.go
index d8f050e..abfe56d 100644
--- a/src/runtime/netpoll_solaris.go
+++ b/src/runtime/netpoll_solaris.go
@@ -179,9 +179,9 @@
// polls for ready network connections
// returns list of goroutines that become runnable
-func netpoll(block bool) (gp *g) {
+func netpoll(block bool) *g {
if portfd == -1 {
- return
+ return nil
}
var wait *timespec
@@ -201,7 +201,7 @@
goto retry
}
- gp = nil
+ var gp guintptr
for i := 0; i < int(n); i++ {
ev := &events[i]
@@ -232,12 +232,12 @@
}
if mode != 0 {
- netpollready((**g)(noescape(unsafe.Pointer(&gp))), pd, mode)
+ netpollready(&gp, pd, mode)
}
}
- if block && gp == nil {
+ if block && gp == 0 {
goto retry
}
- return gp
+ return gp.ptr()
}