]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: rename drainworkbuf and drainobjects
authorAustin Clements <austin@google.com>
Thu, 12 Feb 2015 20:39:29 +0000 (15:39 -0500)
committerAustin Clements <austin@google.com>
Fri, 13 Feb 2015 15:34:55 +0000 (15:34 +0000)
drainworkbuf is now gcDrain, since it drains until there's
nothing left to drain.  drainobjects is now gcDrainN because it's
the bounded equivalent to gcDrain.

The new names use the Go camel case convention because we have to
start somewhere.  The "gc" prefix is because we don't have runtime
packages yet and just "drain" is too ambiguous.

Change-Id: I88dbdf32e8ce4ce6c3b7e1f234664be9b76cb8fd
Reviewed-on: https://go-review.googlesource.com/4785
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/mgc.go

index 30607dce5a2523f1d6fef209f8b85d52f812be2f..1a3e70fcdd4be38f02a56c9075bed3186db20d7f 100644 (file)
@@ -446,10 +446,10 @@ func scanblock(b0, n0 uintptr, ptrmask *uint8, wbuf *workbuf) *workbuf {
        return wbuf
 }
 
-// Scan objects in work buffers (starting with wbuf), blackening grey
+// gcDrain scans objects in work buffers (starting with wbuf), blackening grey
 // objects until all work buffers have been drained.
 //go:nowritebarrier
-func drainworkbuf(wbuf *workbuf) {
+func gcDrain(wbuf *workbuf) {
        if wbuf == nil {
                wbuf = getpartialorempty(472)
        }
@@ -491,11 +491,12 @@ func drainworkbuf(wbuf *workbuf) {
        checknocurrentwbuf()
 }
 
-// Scan count objects starting with those in wbuf.
+// gcDrainN scans n objects starting with those in wbuf, blackening
+// grey objects.
 //go:nowritebarrier
-func drainobjects(wbuf *workbuf, count uintptr) *workbuf {
+func gcDrainN(wbuf *workbuf, n uintptr) *workbuf {
        checknocurrentwbuf()
-       for i := uintptr(0); i < count; i++ {
+       for i := uintptr(0); i < n; i++ {
                if wbuf.nobj == 0 {
                        putempty(wbuf, 544)
                        wbuf = trygetfull(545)
@@ -816,7 +817,7 @@ func gchelpwork() {
                        wbuf = trygetfull(1228)
                }
                if wbuf != nil {
-                       wbuf = drainobjects(wbuf, uintptr(len(wbuf.obj))) // drain upto one buffer's worth of objects
+                       wbuf = gcDrainN(wbuf, uintptr(len(wbuf.obj))) // drain upto one buffer's worth of objects
                        if wbuf != nil {
                                if wbuf.nobj != 0 {
                                        putfull(wbuf, 1175)
@@ -1138,7 +1139,7 @@ func gchelper() {
        // parallel mark for over GC roots
        parfordo(work.markfor)
        if gcphase != _GCscan {
-               drainworkbuf(nil) // blocks in getfull
+               gcDrain(nil) // blocks in getfull
        }
 
        if trace.enabled {
@@ -1400,9 +1401,9 @@ func gcscan_m() {
 // This is the concurrent mark phase.
 //go:nowritebarrier
 func gcmark_m() {
-       drainworkbuf(nil)
+       gcDrain(nil)
        // 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 gcDrain.
 }
 
 // For now this must be bracketed with a stoptheworld and a starttheworld to ensure
@@ -1487,7 +1488,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)
+       gcDrain(nil)
 
        if work.full != 0 {
                throw("work.full != 0")