aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mcentral.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/mcentral.go')
-rw-r--r--src/runtime/mcentral.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/runtime/mcentral.go b/src/runtime/mcentral.go
index 08ff0a5c5d..21731f3fec 100644
--- a/src/runtime/mcentral.go
+++ b/src/runtime/mcentral.go
@@ -14,6 +14,7 @@ package runtime
import (
"internal/runtime/atomic"
+ "internal/runtime/gc"
"internal/runtime/sys"
)
@@ -80,7 +81,7 @@ func (c *mcentral) fullSwept(sweepgen uint32) *spanSet {
// Allocate a span to use in an mcache.
func (c *mcentral) cacheSpan() *mspan {
// Deduct credit for this span allocation and sweep if necessary.
- spanBytes := uintptr(class_to_allocnpages[c.spanclass.sizeclass()]) * _PageSize
+ spanBytes := uintptr(gc.SizeClassToNPages[c.spanclass.sizeclass()]) * pageSize
deductSweepCredit(spanBytes, 0)
traceDone := false
@@ -248,8 +249,8 @@ func (c *mcentral) uncacheSpan(s *mspan) {
// grow allocates a new empty span from the heap and initializes it for c's size class.
func (c *mcentral) grow() *mspan {
- npages := uintptr(class_to_allocnpages[c.spanclass.sizeclass()])
- size := uintptr(class_to_size[c.spanclass.sizeclass()])
+ npages := uintptr(gc.SizeClassToNPages[c.spanclass.sizeclass()])
+ size := uintptr(gc.SizeClassToSize[c.spanclass.sizeclass()])
s := mheap_.alloc(npages, c.spanclass)
if s == nil {
@@ -257,8 +258,8 @@ func (c *mcentral) grow() *mspan {
}
// Use division by multiplication and shifts to quickly compute:
- // n := (npages << _PageShift) / size
- n := s.divideByElemSize(npages << _PageShift)
+ // n := (npages << gc.PageShift) / size
+ n := s.divideByElemSize(npages << gc.PageShift)
s.limit = s.base() + size*n
s.initHeapBits()
return s