Commit 4eb33f6b authored by Austin Clements's avatar Austin Clements

runtime: eliminate a conditional branch from heapBits.bits

Change-Id: I1fa5e629b2890a8509559ce4ea17b74f47d71925
Reviewed-on: https://go-review.googlesource.com/19637Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 0168c267
...@@ -290,7 +290,9 @@ func (h heapBits) forward(n uintptr) heapBits { ...@@ -290,7 +290,9 @@ func (h heapBits) forward(n uintptr) heapBits {
// The result includes in its higher bits the bits for subsequent words // The result includes in its higher bits the bits for subsequent words
// described by the same bitmap byte. // described by the same bitmap byte.
func (h heapBits) bits() uint32 { func (h heapBits) bits() uint32 {
return uint32(*h.bitp) >> h.shift // The (shift & 31) eliminates a test and conditional branch
// from the generated code.
return uint32(*h.bitp) >> (h.shift & 31)
} }
// isMarked reports whether the heap bits have the marked bit set. // isMarked reports whether the heap bits have the marked bit set.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment