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:00:33 UTC 2023
On Mon, 13 Feb 2023 16:40:03 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Christian Hagedorn has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>>
>> - Change algorithm to handle overflows/underflows if the cross products have the same number of overflows/underflows as suggested by Quan
>> - Merge branch 'master' into JDK-8299546
>> - review
>> - 8299546: C2: MulLNode::mul_ring() wrongly returns bottom type due to casting errors with large numbers
>
> 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.
-------------
PR: https://git.openjdk.org/jdk/pull/11907
More information about the hotspot-compiler-dev
mailing list