]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: minor clarifications of markroot
authorAustin Clements <austin@google.com>
Mon, 14 Sep 2015 18:28:09 +0000 (14:28 -0400)
committerAustin Clements <austin@google.com>
Mon, 14 Sep 2015 19:37:44 +0000 (19:37 +0000)
This puts the _Root* indexes in a more friendly order and tweaks
markrootSpans to use a for-range loop instead of its own indexing.

Change-Id: I2c18d55c9a673ea396b6424d51ef4997a1a74825
Reviewed-on: https://go-review.googlesource.com/14548
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/mgc.go
src/runtime/mgcmark.go

index 7fdd93b60089c5413a14a5eae71b7b9a4b0e870a..848e8f69927b48fc58e945e46f1e424108029e8d 100644 (file)
@@ -126,13 +126,14 @@ const (
        _DebugGC         = 0
        _ConcurrentSweep = true
        _FinBlockSize    = 4 * 1024
+
        _RootData        = 0
        _RootBss         = 1
        _RootFinalizers  = 2
-       _RootSpans0      = 3
+       _RootFlushCaches = 3
+       _RootSpans0      = 4
        _RootSpansShards = 128
-       _RootFlushCaches = _RootSpans0 + _RootSpansShards
-       _RootCount       = _RootFlushCaches + 1
+       _RootCount       = _RootSpans0 + _RootSpansShards
 
        // sweepMinHeapDistance is a lower bound on the heap distance
        // (in bytes) reserved for concurrent sweeping between GC
index 128a163297fe14775dee184bb9097d846651f941..c8f8a66b45866ea0b94bd45c171eb4621f550a00 100644 (file)
@@ -121,8 +121,7 @@ func markrootSpans(gcw *gcWork, shard int) {
        sg := mheap_.sweepgen
        startSpan := shard * len(work.spans) / _RootSpansShards
        endSpan := (shard + 1) * len(work.spans) / _RootSpansShards
-       for spanidx := startSpan; spanidx < endSpan; spanidx++ {
-               s := work.spans[spanidx]
+       for _, s := range work.spans[startSpan:endSpan] {
                if s.state != mSpanInUse {
                        continue
                }