diff options
author | Austin Clements <austin@google.com> | 2018-02-16 17:53:16 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2018-02-21 20:32:34 +0000 |
commit | e9db7b9dd147d787883813a772b7cd5700b87114 (patch) | |
tree | 7f260567971de0d40c8f78f4050bf456fa2831a3 /src/runtime/mbitmap.go | |
parent | 3e214e5693ff8df58011db8250cdd8874a63ea17 (diff) | |
download | go-e9db7b9dd147d787883813a772b7cd5700b87114.tar.gz go-e9db7b9dd147d787883813a772b7cd5700b87114.zip |
runtime: abstract indexing of arena index
Accessing the arena index is about to get slightly more complicated.
Abstract this away into a set of functions for going back and forth
between addresses and arena slice indexes.
For #23862.
Change-Id: I0b20e74ef47a07b78ed0cf0a6128afe6f6e40f4b
Reviewed-on: https://go-review.googlesource.com/95496
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/mbitmap.go')
-rw-r--r-- | src/runtime/mbitmap.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go index 3dc22e8458..baae3d911b 100644 --- a/src/runtime/mbitmap.go +++ b/src/runtime/mbitmap.go @@ -335,7 +335,7 @@ func (m *markBits) advance() { func heapBitsForAddr(addr uintptr) heapBits { // 2 bits per word, 4 pairs per byte, and a mask is hard coded. off := addr / sys.PtrSize - arena := addr / heapArenaBytes + arena := arenaIndex(addr) ha := mheap_.arenas[arena] // The compiler uses a load for nil checking ha, but in this // case we'll almost never hit that cache line again, so it @@ -971,7 +971,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) { // machine instructions. outOfPlace := false - if (x+size-1)/heapArenaBytes != uintptr(h.arena) { + if arenaIndex(x+size-1) != uint(h.arena) { // This object spans heap arenas, so the bitmap may be // discontiguous. Unroll it into the object instead // and then copy it out. |