// Read and updated atomically.
scannableStackSize uint64
+ // globalsScan is the total amount of global variable space
+ // that is scannable.
+ //
+ // Read and updated atomically.
+ globalsScan uint64
+
// heapMarked is the number of bytes marked by the previous
// GC. After mark termination, heapLive == heapMarked, but
// unlike heapLive, heapMarked does not change until the
}
}
+func (c *gcControllerState) addGlobals(amount int64) {
+ atomic.Xadd64(&c.globalsScan, amount)
+}
+
// commit sets the trigger ratio and updates everything
// derived from it: the absolute trigger, the heap goal, mark pacing,
// and sweep pacing.
}
*modules = append(*modules, md)
if md.gcdatamask == (bitvector{}) {
- md.gcdatamask = progToPointerMask((*byte)(unsafe.Pointer(md.gcdata)), md.edata-md.data)
- md.gcbssmask = progToPointerMask((*byte)(unsafe.Pointer(md.gcbss)), md.ebss-md.bss)
+ scanDataSize := md.edata - md.data
+ md.gcdatamask = progToPointerMask((*byte)(unsafe.Pointer(md.gcdata)), scanDataSize)
+ scanBSSSize := md.ebss - md.bss
+ md.gcbssmask = progToPointerMask((*byte)(unsafe.Pointer(md.gcbss)), scanBSSSize)
+ gcController.addGlobals(int64(scanDataSize + scanBSSSize))
}
}