RFR: 8299546: C2: MulLNode::mul_ring() wrongly returns bottom type due to casting errors with large numbers [v3]

Christian Hagedorn chagedorn at openjdk.org
Mon Feb 13 19:19:30 UTC 2023


On Mon, 13 Feb 2023 18:57:10 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> src/hotspot/share/utilities/globalDefinitions.hpp line 1161:
>> 
>>> 1159: // Use a portable version instead.
>>> 1160: inline int64_t shift_right_arithmetic(int64_t value, uint8_t shift_amount) {
>>> 1161:   return value < 0 ? (int64_t)(~(~(uint64_t)value >> shift_amount)) : (int64_t)((uint64_t)value >> shift_amount);
>> 
>> I believe we have `java_shift_right` already, it assumes signed extension, however.
>> 
>> https://github.com/openjdk/jdk/blob/master/src/hotspot/share/utilities/globalDefinitions.hpp#L1240
>
> Yes, I've seen that - was just not too sure about using it as the C++ standard leaves it up to the compiler to decide (most compilers will probably just sign extend). However, I see that we have already been using `java_shift_right`. So it might be fine to just use that as well.

What are your thoughts about that @vnkozlov?

-------------

PR: https://git.openjdk.org/jdk/pull/11907


More information about the hotspot-compiler-dev mailing list