RFR: 8233364: Fix undefined behavior in Canonicalizer::do_ShiftOp

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Nov 7 19:59:14 UTC 2019

Looks good.


On 11/7/19 11:49 AM, Kim Barrett wrote:
> Ping.  Looking for a second review.
>> On Nov 1, 2019, at 8:07 PM, Kim Barrett <kim.barrett at oracle.com> wrote:
>> Please review this change to Canonicalizer::do_ShiftOp to eliminate
>> several actual or potential invocations of undefined behavior
>> involving shift operations.  (See CR for details.)
>> To support this fix, a set of java_shift_xxx functions are added to
>> globalDefinitions.hpp.  These use the same implementation techniques
>> used by java_add and friends to perform the corresponding operation
>> with Java semantics for handling overflows and such.
>> With these new java_shift_xxx functions available, the constant
>> folding by do_ShiftOp is now trivially implemented by calls to those
>> functions.
>> Added gtest-based unit tests covering the new shift functions.  Also
>> added unit tests for java_add and friends, which should have been part
>> of their addition by JDK-8145096.  (Oops!)
>> CR:
>> https://bugs.openjdk.java.net/browse/JDK-8233364
>> Webrev:
>> https://cr.openjdk.java.net/~kbarrett/8233364/open.00/
>> Testing:
>> mach5 tier1-3.

More information about the hotspot-dev mailing list