]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove drainallwbufs argument to drainworkbuf
authorAustin Clements <austin@google.com>
Thu, 12 Feb 2015 20:30:08 +0000 (15:30 -0500)
committerAustin Clements <austin@google.com>
Fri, 13 Feb 2015 15:34:49 +0000 (15:34 +0000)
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/4784
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/mgc.go

index 4a9dcf1f50a4f741df000b22d6ecf78b43f563b8..30607dce5a2523f1d6fef209f8b85d52f812be2f 100644 (file)
@@ -446,12 +446,10 @@ func scanblock(b0, n0 uintptr, ptrmask *uint8, wbuf *workbuf) *workbuf {
        return wbuf
 }
 
-// Scan objects in wbuf until wbuf is empty (and on empty queue) or
-// lets scanobject put partially emptied wbuf on partial queue.
-// In any case there is no workbuf to return.
-// If drainallwbufs is true find all other available workbufs and repeat the process.
+// Scan objects in work buffers (starting with wbuf), blackening grey
+// objects until all work buffers have been drained.
 //go:nowritebarrier
-func drainworkbuf(wbuf *workbuf, drainallwbufs bool) {
+func drainworkbuf(wbuf *workbuf) {
        if wbuf == nil {
                wbuf = getpartialorempty(472)
        }
@@ -463,9 +461,6 @@ func drainworkbuf(wbuf *workbuf, drainallwbufs bool) {
        for {
                if wbuf.nobj == 0 {
                        putempty(wbuf, 496)
-                       if !drainallwbufs {
-                               break
-                       }
                        // Refill workbuf from global queue.
                        wbuf = getfull(504)
                        if wbuf == nil { // nil means out of work barrier reached
@@ -1143,7 +1138,7 @@ func gchelper() {
        // parallel mark for over GC roots
        parfordo(work.markfor)
        if gcphase != _GCscan {
-               drainworkbuf(nil, true) // blocks in getfull
+               drainworkbuf(nil) // blocks in getfull
        }
 
        if trace.enabled {
@@ -1405,7 +1400,7 @@ func gcscan_m() {
 // This is the concurrent mark phase.
 //go:nowritebarrier
 func gcmark_m() {
-       drainworkbuf(nil, true)
+       drainworkbuf(nil)
        // TODO add another harvestwbuf and reset work.nwait=0, work.ndone=0, and work.nproc=1
        // and repeat the above drainworkbuf.
 }
@@ -1492,7 +1487,7 @@ func gc(start_time int64, eagersweep bool) {
        harvestwbufs() // move local workbufs onto global queues where the GC can find them
        gchelperstart()
        parfordo(work.markfor)
-       drainworkbuf(nil, true)
+       drainworkbuf(nil)
 
        if work.full != 0 {
                throw("work.full != 0")