1
0
mirror of https://github.com/golang/go synced 2024-11-23 00:10:07 -07:00

runtime: remove useless nFlushCacheRoots

Change-Id: I70cb8f8e9a0eec68ea11f22ca8699aa7e0c91ede
Reviewed-on: https://go-review.googlesource.com/c/go/+/310710
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
This commit is contained in:
Leonard Wang 2021-04-16 23:30:59 +08:00 committed by Emmanuel Odeke
parent b05903a9f6
commit 94817890c2
2 changed files with 2 additions and 10 deletions

View File

@ -325,11 +325,9 @@ var work struct {
nwait uint32
// Number of roots of various root types. Set by gcMarkRootPrepare.
nFlushCacheRoots int
nDataRoots, nBSSRoots, nSpanRoots, nStackRoots int
// Base indexes of each root type. Set by gcMarkRootPrepare.
baseFlushCache uint32
baseData, baseBSS, baseSpans, baseStacks, baseEnd uint32
// Each type of GC state transition is protected by a lock.

View File

@ -56,8 +56,6 @@ const (
func gcMarkRootPrepare() {
assertWorldStopped()
work.nFlushCacheRoots = 0
// Compute how many data and BSS root blocks there are.
nBlocks := func(bytes uintptr) int {
return int(divRoundUp(bytes, rootBlockBytes))
@ -105,11 +103,10 @@ func gcMarkRootPrepare() {
work.nStackRoots = int(atomic.Loaduintptr(&allglen))
work.markrootNext = 0
work.markrootJobs = uint32(fixedRootCount + work.nFlushCacheRoots + work.nDataRoots + work.nBSSRoots + work.nSpanRoots + work.nStackRoots)
work.markrootJobs = uint32(fixedRootCount + work.nDataRoots + work.nBSSRoots + work.nSpanRoots + work.nStackRoots)
// Calculate base indexes of each root type
work.baseFlushCache = uint32(fixedRootCount)
work.baseData = work.baseFlushCache + uint32(work.nFlushCacheRoots)
work.baseData = uint32(fixedRootCount)
work.baseBSS = work.baseData + uint32(work.nDataRoots)
work.baseSpans = work.baseBSS + uint32(work.nBSSRoots)
work.baseStacks = work.baseSpans + uint32(work.nSpanRoots)
@ -159,9 +156,6 @@ var oneptrmask = [...]uint8{1}
func markroot(gcw *gcWork, i uint32) {
// Note: if you add a case here, please also update heapdump.go:dumproots.
switch {
case work.baseFlushCache <= i && i < work.baseData:
flushmcache(int(i - work.baseFlushCache))
case work.baseData <= i && i < work.baseBSS:
for _, datap := range activeModules() {
markrootBlock(datap.data, datap.edata-datap.data, datap.gcdatamask.bytedata, gcw, int(i-work.baseData))