RFR: 8324833: Signed integer overflows in ABS [v3]

Dean Long dlong at openjdk.org
Fri Feb 2 23:50:02 UTC 2024


On Fri, 2 Feb 2024 09:47:28 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> See the details in the bug. I think current `ABS` implementation is beyond repair, and we should just switch to `uabs`.
>> 
>> Additional testing:
>>  - [x] Linux x86_64 fastdebug, `all` with `-ftrapv` (now fully passes!)
>>  - [x] Linux x86_64 fastdebug, `all`
>
> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Touchups

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp line 1062:

> 1060:   if (target_addr != 0x0) {
> 1061:     jlong off_low = (jlong)target_addr - ((jlong)CodeCache::low_bound() + sizeof(int));
> 1062:     jlong off_high = (jlong)target_addr - ((jlong)CodeCache::high_bound() + sizeof(int));

Suggestion:

    jlong off_low = (jlong)(target_addr - (CodeCache::low_bound() + sizeof(int)));
    jlong off_high = (jlong)(target_addr - (CodeCache::high_bound() + sizeof(int)));

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17617#discussion_r1476877531


More information about the hotspot-dev mailing list