]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: make "write barriers are not allowed" comments more precise
authorAustin Clements <austin@google.com>
Sun, 29 Mar 2015 14:20:54 +0000 (10:20 -0400)
committerAustin Clements <austin@google.com>
Mon, 30 Mar 2015 15:13:53 +0000 (15:13 +0000)
Currently, various functions are marked with the comment

  // May run without a P, so write barriers are not allowed.

However, "running without a P" is ambiguous. We intended these to mean
that m.p may be nil (which is the condition checked by the write
barrier). The comment could also be taken to mean that a
stop-the-world may happen, which is not the case for these functions
because they run in situations where there is in fact a function on
the stack holding a P locally, it just isn't in m.p.

Change these comments to state precisely what we mean, that m.p may be
nil.

Change-Id: I4a4a1d26aebd455e5067540e13b9f96a7482146c
Reviewed-on: https://go-review.googlesource.com/8209
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/os1_darwin.go
src/runtime/os1_dragonfly.go
src/runtime/os1_freebsd.go
src/runtime/os1_linux.go
src/runtime/os1_nacl.go
src/runtime/os1_netbsd.go
src/runtime/os1_openbsd.go
src/runtime/os1_plan9.go
src/runtime/os1_windows.go
src/runtime/os3_solaris.go
src/runtime/proc1.go

index f6eb557b81ae0738ae2e2374a01c6cfd4578b3c5..6c79bbb204c267e50d1cf2aa4ea56564cc26faeb 100644 (file)
@@ -71,7 +71,7 @@ func goenvs() {
        }
 }
 
-// May run without a P, so write barriers are not allowed.
+// May run with m.p==nil, so write barriers are not allowed.
 //go:nowritebarrier
 func newosproc(mp *m, stk unsafe.Pointer) {
        mp.tls[0] = uintptr(mp.id) // so 386 asm can find it
index 33d87ebdd984dd2b625a72b66ef8f40fc5555910..54f19eff9f2ac0d1ec665eee64f0b32d3222c650 100644 (file)
@@ -71,7 +71,7 @@ func futexwakeup(addr *uint32, cnt uint32) {
 
 func lwp_start(uintptr)
 
-// May run without a P, so write barriers are not allowed.
+// May run with m.p==nil, so write barriers are not allowed.
 //go:nowritebarrier
 func newosproc(mp *m, stk unsafe.Pointer) {
        if false {
index 10c72d1d7ee831307f5888cb6daf3b6fb41512c4..ceaa9162c077ff1d3a6d51c020d541a62fd99a31 100644 (file)
@@ -67,7 +67,7 @@ func futexwakeup(addr *uint32, cnt uint32) {
 
 func thr_start()
 
-// May run without a P, so write barriers are not allowed.
+// May run with m.p==nil, so write barriers are not allowed.
 //go:nowritebarrier
 func newosproc(mp *m, stk unsafe.Pointer) {
        if false {
index 190206dcb6499e99f5e0874289127f2f97c49a58..735f595ae34ade9e6eaa973f67fa29f69a97e575 100644 (file)
@@ -113,7 +113,7 @@ const (
        _CLONE_NEWIPC         = 0x8000000
 )
 
-// May run without a P, so write barriers are not allowed.
+// May run with m.p==nil, so write barriers are not allowed.
 //go:nowritebarrier
 func newosproc(mp *m, stk unsafe.Pointer) {
        /*
index 238de5b441da18ef696167f3eeee562102a81c82..dbb5dec2fdc8a675f1ae7df9322f765bf1fdb7fb 100644 (file)
@@ -67,7 +67,7 @@ func usleep(us uint32) {
 
 func mstart_nacl()
 
-// May run without a P, so write barriers are not allowed.
+// May run with m.p==nil, so write barriers are not allowed.
 //go:nowritebarrier
 func newosproc(mp *m, stk unsafe.Pointer) {
        mp.tls[0] = uintptr(unsafe.Pointer(mp.g0))
index 9a401550baba0756eecd3b42bb949992ce15f336..85b3df33970143f7abba4302ff81f56fca50c82e 100644 (file)
@@ -89,7 +89,7 @@ func semawakeup(mp *m) {
        }
 }
 
-// May run without a P, so write barriers are not allowed.
+// May run with m.p==nil, so write barriers are not allowed.
 //go:nowritebarrier
 func newosproc(mp *m, stk unsafe.Pointer) {
        if false {
index 1f5ac4aa31a1f670577cac52661286d7b278eddc..4f41864684b9497053058323722f25289395f4be 100644 (file)
@@ -98,7 +98,7 @@ func semawakeup(mp *m) {
        }
 }
 
-// May run without a P, so write barriers are not allowed.
+// May run with m.p==nil, so write barriers are not allowed.
 //go:nowritebarrier
 func newosproc(mp *m, stk unsafe.Pointer) {
        if false {
index 30621ad56128c62e3aec2790653d1b484be2eca6..284f3381d788977232d316a576cff28443e255dd 100644 (file)
@@ -183,7 +183,7 @@ func exit(e int) {
        exits(&status[0])
 }
 
-// May run without a P, so write barriers are not allowed.
+// May run with m.p==nil, so write barriers are not allowed.
 //go:nowritebarrier
 func newosproc(mp *m, stk unsafe.Pointer) {
        if false {
index 0907ca231973aca636d67e1f5002192cddfd4a3f..9a077af88e5cf6642848412f376cd30641b3f731 100644 (file)
@@ -295,7 +295,7 @@ func semacreate() uintptr {
        return stdcall4(_CreateEventA, 0, 0, 0, 0)
 }
 
-// May run without a P, so write barriers are not allowed.
+// May run with m.p==nil, so write barriers are not allowed.
 //go:nowritebarrier
 func newosproc(mp *m, stk unsafe.Pointer) {
        const _STACK_SIZE_PARAM_IS_A_RESERVATION = 0x00010000
index ddec87e7e2a2a5e059ca8d6d41f024a8a8755df5..7a4d27e20e015a4d4a033c1d8fc184eda4bfab07 100644 (file)
@@ -131,7 +131,7 @@ func osinit() {
 
 func tstart_sysvicall()
 
-// May run without a P, so write barriers are not allowed.
+// May run with m.p==nil, so write barriers are not allowed.
 //go:nowritebarrier
 func newosproc(mp *m, _ unsafe.Pointer) {
        var (
index 690a97891930fa849c41e1bd1c00d27d82004f2c..30d6c7b9c65191dcaf8de915294d862c9f279c89 100644 (file)
@@ -973,7 +973,7 @@ func unlockextra(mp *m) {
 
 // Create a new m.  It will start off with a call to fn, or else the scheduler.
 // fn needs to be static and not a heap allocated closure.
-// May run without a P, so write barriers are not allowed.
+// May run with m.p==nil, so write barriers are not allowed.
 //go:nowritebarrier
 func newm(fn func(), _p_ *p) {
        mp := allocm(_p_)
@@ -1035,7 +1035,7 @@ func mspinning() {
 
 // Schedules some M to run the p (creates an M if necessary).
 // If p==nil, tries to get an idle P, if no idle P's does nothing.
-// May run without a P, so write barriers are not allowed.
+// May run with m.p==nil, so write barriers are not allowed.
 //go:nowritebarrier
 func startm(_p_ *p, spinning bool) {
        lock(&sched.lock)