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

Kim Barrett kim.barrett at oracle.com
Sat Nov 2 00:07:11 UTC 2019


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