aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc.go
diff options
context:
space:
mode:
authorRick Hudson <rlh@golang.org>2016-03-14 12:17:48 -0400
committerRick Hudson <rlh@golang.org>2016-04-29 00:00:47 +0000
commit2063d5d903718962de58a86a692626fe89919a4d (patch)
tree45f21ec57964d391bd55594377c025e5dae03291 /src/runtime/malloc.go
parent23aeb34df172b17b7bfaa85fb59ca64bef9073bb (diff)
downloadgo-2063d5d903718962de58a86a692626fe89919a4d.tar.xz
[dev.garbage] runtime: restructure alloc and mark bits
Two changes are included here that are dependent on the other. The first is that allocBits and gcamrkBits are changed to a *uint8 which points to the first byte of that span's mark and alloc bits. Several places were altered to perform pointer arithmetic to locate the byte corresponding to an object in the span. The actual bit corresponding to an object is indexed in the byte by using the lower three bits of the objects index. The second change avoids the redundant calculation of an object's index. The index is returned from heapBitsForObject and then used by the functions indexing allocBits and gcmarkBits. Finally we no longer allocate the gc bits in the span structures. Instead we use an arena based allocation scheme that allows for a more compact bit map as well as recycling and bulk clearing of the mark bits. Change-Id: If4d04b2021c092ec39a4caef5937a8182c64dfef Reviewed-on: https://go-review.googlesource.com/20705 Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/malloc.go')
-rw-r--r--src/runtime/malloc.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index 6fe4656603..86fdb3fdbb 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -491,7 +491,7 @@ var zerobase uintptr
// Otherwise it returns 0.
func (c *mcache) nextFreeFast(sizeclass int8) gclinkptr {
s := c.alloc[sizeclass]
- ctzIndex := uint8(s.allocCache & 0xff)
+ ctzIndex := uint8(s.allocCache)
if ctzIndex != 0 {
theBit := uint64(ctzVals[ctzIndex])
freeidx := s.freeindex // help the pre ssa compiler out here with cse.