src/share/vm/utilities/bitMap.inline.hpp

Print this page
rev 2896 : 7121547: G1: High number mispredicted branches while iterating over the marking bitmap
Summary: There is a high number of mispredicted branches associated with calling BitMap::iteratate() from within CMBitMapRO::iterate(). Implement a version of CMBitMapRO::iterate() directly using inline-able routines.
Reviewed-by:

*** 176,187 **** if (res != (uintptr_t)NoBits) { // find the position of the 1-bit for (; !(res & 1); res_offset++) { res = res >> 1; } ! assert(res_offset >= l_offset && ! res_offset < r_offset, "just checking"); return MIN2(res_offset, r_offset); } // skip over all word length 0-bit runs for (index++; index < r_index; index++) { res = map(index); --- 176,195 ---- if (res != (uintptr_t)NoBits) { // find the position of the 1-bit for (; !(res & 1); res_offset++) { res = res >> 1; } ! ! // In the following assert, checking that res_offset is strictly ! // less than r_offset is too strong. Consider the case where ! // l_offset is bit 15 and r_offset is bit 17 of the same map word, ! // and where bits [18:17:16:15] == [01:00:00:00]. The calculation ! // above would yield the offset of bit 18. All we can assert is that ! // res_offset is strictly less than size() since we know that there ! // are set bits at offsets above, but in the same map word as, r_offset ! // The bits in the range (r_offset:l_offset] are all 0. ! assert(res_offset >= l_offset && res_offset < size(), "just checking"); return MIN2(res_offset, r_offset); } // skip over all word length 0-bit runs for (index++; index < r_index; index++) { res = map(index);