RFR: 8234331: Add robust and optimized utility for rounding up to next power of two+

Claes Redestad claes.redestad at oracle.com
Tue Nov 26 09:44:36 UTC 2019


Hi,

in various places in the hotspot we have custom code to calculate the
next power of two, some of which have potential to go into an infinite 
loop in case of an overflow.

This patch proposes adding next_power_of_two utility methods which
avoid infinite loops on overflow, while providing slightly more
efficient code in most cases.

Bug:    https://bugs.openjdk.java.net/browse/JDK-8234331
Webrev: http://cr.openjdk.java.net/~redestad/8234331/open.01/

Testing: tier1-3

Thanks!

/Claes


More information about the hotspot-compiler-dev mailing list