-
Bug
-
Resolution: Fixed
-
P2
-
16
-
b27
-
Verified
As I was adding a test and doing some micro-optimizations to RegMask::is_bound, I found a bug I introduced in JDK-8221404 where I mixed up the formula for how much we need to shift the "bit" when overflowing:
// The lower (BitsPerWord - size) bits should be 1 since it is split case.
uintptr_t set = (bit >> (BitsPerWord - bit_index)) - 1;
This is completely wrong and needs to be fixed.
There's also an optimization to be had by reworking the is_bound* methods to "short-circuit" after a bit, pair or set is found rather than keeping a state variable. is_bound1 is in even worse shape since it uses Size() (which does popcount on each word, which are relatively expensive). Getting these to a similar shape allows gcc to optimize is_bound to be roughly twice as fast.
// The lower (BitsPerWord - size) bits should be 1 since it is split case.
uintptr_t set = (bit >> (BitsPerWord - bit_index)) - 1;
This is completely wrong and needs to be fixed.
There's also an optimization to be had by reworking the is_bound* methods to "short-circuit" after a bit, pair or set is found rather than keeping a state variable. is_bound1 is in even worse shape since it uses Size() (which does popcount on each word, which are relatively expensive). Getting these to a similar shape allows gcc to optimize is_bound to be roughly twice as fast.
- relates to
-
JDK-8221404 C2: Convert RegMask and IndexSet to use uintptr_t
- Resolved