RFR: 8234331: Add robust and optimized utility for rounding up to next power of two+
Ivan Gerasimov
ivan.gerasimov at oracle.com
Tue Nov 26 10:14:11 UTC 2019
Hi Claes!
In the code in align.hpp it is assumed that (1U << 32) == 0, which is
not guaranteed.
In fact, if the right argument of the shift operator is >= 32 (for
32-bit left argument) then the behavior is undefined, and thus is
compiler specific.
With kind regards,
Ivan
On 11/26/19 1:44 AM, Claes Redestad wrote:
> 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
--
With kind regards,
Ivan Gerasimov
More information about the hotspot-compiler-dev
mailing list