From 0d7a2241cb684236f2728bb08514e7f256ac4a43 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Tue, 30 Aug 2016 09:29:16 -0700 Subject: [PATCH] runtime: update a few comments noescape is now 0 instructions with the SSA backend. fast atomics are no longer a TODO (at least for amd64). Change-Id: Ib6e06f7471bef282a47ba236d8ce95404bb60a42 Reviewed-on: https://go-review.googlesource.com/28087 Run-TryBot: Keith Randall Reviewed-by: Brad Fitzpatrick Reviewed-by: Cherry Zhang TryBot-Result: Gobot Gobot --- src/runtime/proc.go | 10 +++++----- src/runtime/stubs.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/runtime/proc.go b/src/runtime/proc.go index e693f7e05f..75e09b3ab7 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -543,7 +543,7 @@ func ready(gp *g, traceskip int, next bool) { // status is Gwaiting or Gscanwaiting, make Grunnable and put on runq casgstatus(gp, _Gwaiting, _Grunnable) runqput(_g_.m.p.ptr(), gp, next) - if atomic.Load(&sched.npidle) != 0 && atomic.Load(&sched.nmspinning) == 0 { // TODO: fast atomic + if atomic.Load(&sched.npidle) != 0 && atomic.Load(&sched.nmspinning) == 0 { wakep() } _g_.m.locks-- @@ -1901,7 +1901,7 @@ top: // If number of spinning M's >= number of busy P's, block. // This is necessary to prevent excessive CPU consumption // when GOMAXPROCS>>1 but the program parallelism is low. - if !_g_.m.spinning && 2*atomic.Load(&sched.nmspinning) >= procs-atomic.Load(&sched.npidle) { // TODO: fast atomic + if !_g_.m.spinning && 2*atomic.Load(&sched.nmspinning) >= procs-atomic.Load(&sched.npidle) { goto stop } if !_g_.m.spinning { @@ -2341,7 +2341,7 @@ func reentersyscall(pc, sp uintptr) { save(pc, sp) } - if atomic.Load(&sched.sysmonwait) != 0 { // TODO: fast atomic + if atomic.Load(&sched.sysmonwait) != 0 { systemstack(entersyscall_sysmon) save(pc, sp) } @@ -2806,7 +2806,7 @@ func newproc1(fn *funcval, argp *uint8, narg int32, nret int32, callerpc uintptr } runqput(_p_, newg, true) - if atomic.Load(&sched.npidle) != 0 && atomic.Load(&sched.nmspinning) == 0 && unsafe.Pointer(fn.fn) != unsafe.Pointer(funcPC(main)) { // TODO: fast atomic + if atomic.Load(&sched.npidle) != 0 && atomic.Load(&sched.nmspinning) == 0 && unsafe.Pointer(fn.fn) != unsafe.Pointer(funcPC(main)) { wakep() } _g_.m.locks-- @@ -3604,7 +3604,7 @@ func sysmon() { delay = 10 * 1000 } usleep(delay) - if debug.schedtrace <= 0 && (sched.gcwaiting != 0 || atomic.Load(&sched.npidle) == uint32(gomaxprocs)) { // TODO: fast atomic + if debug.schedtrace <= 0 && (sched.gcwaiting != 0 || atomic.Load(&sched.npidle) == uint32(gomaxprocs)) { lock(&sched.lock) if atomic.Load(&sched.gcwaiting) != 0 || atomic.Load(&sched.npidle) == uint32(gomaxprocs) { atomic.Store(&sched.sysmonwait, 1) diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go index 72951ae0b2..0f75663b9a 100644 --- a/src/runtime/stubs.go +++ b/src/runtime/stubs.go @@ -90,7 +90,7 @@ func memequal(a, b unsafe.Pointer, size uintptr) bool // noescape hides a pointer from escape analysis. noescape is // the identity function but escape analysis doesn't think the // output depends on the input. noescape is inlined and currently -// compiles down to a single xor instruction. +// compiles down to zero instructions. // USE CAREFULLY! //go:nosplit func noescape(p unsafe.Pointer) unsafe.Pointer { -- 2.48.1