mirror of
https://github.com/golang/go
synced 2024-11-18 09:54:57 -07:00
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/4784 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
parent
15c9a2ef4e
commit
60a16ea367
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user