RFR: 8240615: is_power_of_2() has Undefined Behaviour and is inconsistent
Andrew Haley
aph at redhat.com
Tue Mar 10 18:25:10 UTC 2020
On 3/10/20 6:06 PM, Vladimir Kozlov wrote:
> Why you did not cast constant to (julong) in btrL_mem_imm() x86_64.ad?
I don't think that it's necessary. (~$con$$constant) returns a jlong
which gets passed to log2_long(julong x), so it gets converted to
from julong to julong at the point of the call.
> I looked through C1 and C2 code usage of is_power_of_2(). And it is not clear to me if we handle MAX and MIN values
> correctly in some cases (mulnode.cpp, divnode.cpp). But it is a different issue.
>
> I think your is_power_of_2() change should be fine for C2 and C1 code.
OK, thanks.
--
Andrew Haley (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
More information about the hotspot-dev
mailing list