diff options
author | Rick Hudson <rlh@golang.org> | 2016-02-16 17:16:43 -0500 |
---|---|---|
committer | Rick Hudson <rlh@golang.org> | 2016-04-27 21:54:49 +0000 |
commit | e4ac2d4acc8cb44df2107e3fa1067755feaaa005 (patch) | |
tree | 7c21e754aa738aa5cc297bdf98b7828498ddb0d3 /src/runtime/mcentral.go | |
parent | 3479b065d43f2990ac12e7b00ddff6f63a876ca9 (diff) | |
download | go-e4ac2d4acc8cb44df2107e3fa1067755feaaa005.tar.gz go-e4ac2d4acc8cb44df2107e3fa1067755feaaa005.zip |
[dev.garbage] runtime: replace ref with allocCount
This is a renaming of the field ref to the
more appropriate allocCount. The field
holds the number of objects in the span
that are currently allocated. Some throws
strings were adjusted to more accurately
convey the meaning of allocCount.
Change-Id: I10daf44e3e9cc24a10912638c7de3c1984ef8efe
Reviewed-on: https://go-review.googlesource.com/19518
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/mcentral.go')
-rw-r--r-- | src/runtime/mcentral.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/runtime/mcentral.go b/src/runtime/mcentral.go index 47d3ae2f81..5dafa28450 100644 --- a/src/runtime/mcentral.go +++ b/src/runtime/mcentral.go @@ -100,11 +100,11 @@ retry: // c is unlocked. havespan: cap := int32((s.npages << _PageShift) / s.elemsize) - n := cap - int32(s.ref) + n := cap - int32(s.allocCount) if n == 0 { - throw("empty span") + throw("span has no free objects") } - usedBytes := uintptr(s.ref) * s.elemsize + usedBytes := uintptr(s.allocCount) * s.elemsize if usedBytes > 0 { reimburseSweepCredit(usedBytes) } @@ -127,12 +127,12 @@ func (c *mcentral) uncacheSpan(s *mspan) { s.incache = false - if s.ref == 0 { - throw("uncaching full span") + if s.allocCount == 0 { + throw("uncaching span but s.allocCount == 0") } cap := int32((s.npages << _PageShift) / s.elemsize) - n := cap - int32(s.ref) + n := cap - int32(s.allocCount) if n > 0 { c.empty.remove(s) c.nonempty.insert(s) @@ -154,7 +154,7 @@ func (c *mcentral) freeSpan(s *mspan, n int32, start gclinkptr, end gclinkptr, p throw("freeSpan given cached span") } - s.ref -= uint16(n) + s.allocCount -= uint16(n) if preserve { // preserve is set only when called from MCentral_CacheSpan above, @@ -180,7 +180,7 @@ func (c *mcentral) freeSpan(s *mspan, n int32, start gclinkptr, end gclinkptr, p // lock of c above.) atomic.Store(&s.sweepgen, mheap_.sweepgen) - if s.ref != 0 { + if s.allocCount != 0 { unlock(&c.lock) return false } |