From a5d3f7ece9033393166d0c74cd1121c15032ba4d Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Fri, 29 Apr 2016 15:17:34 -0400 Subject: [PATCH] runtime: avoid conditional execution in morePointers and isPointer heapBits.bits is carefully written to produce good machine code. Use it in heapBits.morePointers and heapBits.isPointer to get good machine code there, too. Change-Id: I208c7d0d38697e7a22cad67f692162589b75f1e2 Reviewed-on: https://go-review.googlesource.com/22630 Reviewed-by: Rick Hudson Run-TryBot: Austin Clements TryBot-Result: Gobot Gobot --- src/runtime/mbitmap.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go index 9df64cb168..0bfb184945 100644 --- a/src/runtime/mbitmap.go +++ b/src/runtime/mbitmap.go @@ -492,7 +492,7 @@ func (h heapBits) bits() uint32 { // are scalars. // h must not describe the first or second word of the object. func (h heapBits) morePointers() bool { - return *h.bitp&(bitMarked<>h.shift)&bitPointer != 0 + return h.bits()&bitPointer != 0 } // hasPointers reports whether the given object has any pointers. -- 2.48.1