RFR: 8347555: [REDO] C2: implement optimization for series of Add of unique value [v2]

Kangcheng Xu kxu at openjdk.org
Mon Feb 24 15:50:55 UTC 2025


On Fri, 7 Feb 2025 00:17:16 GMT, Dean Long <dlong at openjdk.org> wrote:

>> Kangcheng Xu has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - use explicit argument types for overloaded java_shift_left()
>>  - use java_shift_left()
>
> It's not clear what result you are expecting from the new shift code when it overflows.  It looks like signed overflow undefined behavior (UB) to me, which would ideally be caught by UBSAN, so you probably want to make sure your changes are ubsan-clean.  If the desired result for overflow is 0, then I think java_shift_left() should be used.

> @dean-long: It looks like signed overflow undefined behavior

Yes, you are right. I shouldn't rely on this UB. Per your suggestion, I switched to `java_shift_left()` and `jlong()`. Hopefully, this makes my intention clearer. 

This PR is ready for review. Thanks!

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

PR Comment: https://git.openjdk.org/jdk/pull/23506#issuecomment-2678877597


More information about the hotspot-compiler-dev mailing list