Commit 60a16ea3 authored by Austin Clements's avatar Austin Clements

runtime: remove drainallwbufs argument to drainworkbuf

All calls to drainworkbuf now pass true for this argument, so remove
the argument and update the documentation to reflect the simplified
interface.

At a higher level, there are no longer any situations where we drain
"one wbuf" (though drainworkbuf didn't guarantee this anyway).  We
either drain everything, or we drain a specific number of objects.

Change-Id: Ib7ee0fde56577eff64232ee1e711ec57c4361335
Reviewed-on: https://go-review.googlesource.com/4784Reviewed-by: default avatarRuss Cox <rsc@golang.org>
Reviewed-by: default avatarRick Hudson <rlh@golang.org>
parent 15c9a2ef
...@@ -446,12 +446,10 @@ func scanblock(b0, n0 uintptr, ptrmask *uint8, wbuf *workbuf) *workbuf { ...@@ -446,12 +446,10 @@ func scanblock(b0, n0 uintptr, ptrmask *uint8, wbuf *workbuf) *workbuf {
return wbuf return wbuf
} }
// Scan objects in wbuf until wbuf is empty (and on empty queue) or // Scan objects in work buffers (starting with wbuf), blackening grey
// lets scanobject put partially emptied wbuf on partial queue. // objects until all work buffers have been drained.
// In any case there is no workbuf to return.
// If drainallwbufs is true find all other available workbufs and repeat the process.
//go:nowritebarrier //go:nowritebarrier
func drainworkbuf(wbuf *workbuf, drainallwbufs bool) { func drainworkbuf(wbuf *workbuf) {
if wbuf == nil { if wbuf == nil {
wbuf = getpartialorempty(472) wbuf = getpartialorempty(472)
} }
...@@ -463,9 +461,6 @@ func drainworkbuf(wbuf *workbuf, drainallwbufs bool) { ...@@ -463,9 +461,6 @@ func drainworkbuf(wbuf *workbuf, drainallwbufs bool) {
for { for {
if wbuf.nobj == 0 { if wbuf.nobj == 0 {
putempty(wbuf, 496) putempty(wbuf, 496)
if !drainallwbufs {
break
}
// Refill workbuf from global queue. // Refill workbuf from global queue.
wbuf = getfull(504) wbuf = getfull(504)
if wbuf == nil { // nil means out of work barrier reached if wbuf == nil { // nil means out of work barrier reached
...@@ -1143,7 +1138,7 @@ func gchelper() { ...@@ -1143,7 +1138,7 @@ func gchelper() {
// parallel mark for over GC roots // parallel mark for over GC roots
parfordo(work.markfor) parfordo(work.markfor)
if gcphase != _GCscan { if gcphase != _GCscan {
drainworkbuf(nil, true) // blocks in getfull drainworkbuf(nil) // blocks in getfull
} }
if trace.enabled { if trace.enabled {
...@@ -1405,7 +1400,7 @@ func gcscan_m() { ...@@ -1405,7 +1400,7 @@ func gcscan_m() {
// This is the concurrent mark phase. // This is the concurrent mark phase.
//go:nowritebarrier //go:nowritebarrier
func gcmark_m() { func gcmark_m() {
drainworkbuf(nil, true) drainworkbuf(nil)
// TODO add another harvestwbuf and reset work.nwait=0, work.ndone=0, and work.nproc=1 // TODO add another harvestwbuf and reset work.nwait=0, work.ndone=0, and work.nproc=1
// and repeat the above drainworkbuf. // and repeat the above drainworkbuf.
} }
...@@ -1492,7 +1487,7 @@ func gc(start_time int64, eagersweep bool) { ...@@ -1492,7 +1487,7 @@ func gc(start_time int64, eagersweep bool) {
harvestwbufs() // move local workbufs onto global queues where the GC can find them harvestwbufs() // move local workbufs onto global queues where the GC can find them
gchelperstart() gchelperstart()
parfordo(work.markfor) parfordo(work.markfor)
drainworkbuf(nil, true) drainworkbuf(nil)
if work.full != 0 { if work.full != 0 {
throw("work.full != 0") throw("work.full != 0")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment