RFR: 8257182: JCK test failures in integer / long rotation tests
Vladimir Kozlov
kvn at openjdk.java.net
Wed Dec 2 16:15:57 UTC 2020
On Wed, 2 Dec 2020 15:44:31 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:
>> The `RotateLeftNode::Value()` and `RotateRightNode::Value()` methods use an arithmetic instead of a logical shift due to applying the shift operator `>>` to a signed instead of an unsigned number. When, for example, rotating a negative even integer (least significant bit is 0) to the right, we should always get a positive number (most significant bit becoming 0). However, the arithmetic shift keeps the integer being negative. This lets some JCK rotation tests fail with -Xcomp.
>>
>> The previously failing JCK tests work again with -Xcomp by applying this fix.
>>
>> Thanks,
>> Christian
>
> src/hotspot/share/opto/mulnode.cpp line 1510:
>
>> 1508: if (r1->is_con() && r2->is_con()) {
>> 1509: unsigned int r1_con = (unsigned int)r1->get_con();
>> 1510: unsigned int shift = (unsigned int)(r2->get_con()) & (unsigned int)(BitsPerJavaInteger - 1); // semantics of Java shifts
>
> I'd prefer to use juint which actually is the same, but would be more consistent IMHO.
+1
-------------
PR: https://git.openjdk.java.net/jdk/pull/1562
More information about the hotspot-compiler-dev
mailing list