]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use only per-P gcWork
authorAustin Clements <austin@google.com>
Mon, 23 Nov 2015 23:45:18 +0000 (18:45 -0500)
committerAustin Clements <austin@google.com>
Thu, 25 Feb 2016 23:37:27 +0000 (23:37 +0000)
Currently most uses of gcWork use the per-P gcWork, but there are two
places that still use a stack-based gcWork. Simplify things by making
these instead use the per-P gcWork.

Change-Id: I712d012cce9dd5757c8541824e9641ac1c2a329c
Reviewed-on: https://go-review.googlesource.com/19636
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/mgc.go
src/runtime/mgcwork.go

index 94301c6dc7f0deb7aa91095dbeb367e9c432a55c..df8b4536faf961ce87e4f67f03bbd0c83ba04cc8 100644 (file)
@@ -1555,8 +1555,8 @@ func gcMark(start_time int64) {
 
        gchelperstart()
 
-       var gcw gcWork
-       gcDrain(&gcw, gcDrainBlock)
+       gcw := &getg().m.p.ptr().gcw
+       gcDrain(gcw, gcDrainBlock)
        gcw.dispose()
 
        gcMarkRootCheck()
@@ -1798,8 +1798,8 @@ func gchelper() {
 
        // Parallel mark over GC roots and heap
        if gcphase == _GCmarktermination {
-               var gcw gcWork
-               gcDrain(&gcw, gcDrainBlock) // blocks in getfull
+               gcw := &_g_.m.p.ptr().gcw
+               gcDrain(gcw, gcDrainBlock) // blocks in getfull
                gcw.dispose()
        }
 
index e97039bed6745c630e602483e7671d65e6bcb113..35bc12db229f4259a9a98db13412a42cd4555d03 100644 (file)
@@ -44,14 +44,6 @@ func (wp wbufptr) ptr() *workbuf {
 //
 // A gcWork can be used on the stack as follows:
 //
-//     var gcw gcWork
-//     disable preemption
-//     .. call gcw.put() to produce and gcw.get() to consume ..
-//     gcw.dispose()
-//     enable preemption
-//
-// Or from the per-P gcWork cache:
-//
 //     (preemption must be disabled)
 //     gcw := &getg().m.p.ptr().gcw
 //     .. call gcw.put() to produce and gcw.get() to consume ..