RFR: 8313905: Checked_cast assert in CDS compare_by_loader [v2]
    Dean Long 
    dlong at openjdk.org
       
    Wed Aug  9 20:55:31 UTC 2023
    
    
  
On Wed, 9 Aug 2023 20:33:55 GMT, Dean Long <dlong at openjdk.org> wrote:
>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Ha, didn't need the casts after all.
>
> src/hotspot/share/utilities/globalDefinitions.hpp line 1339:
> 
>> 1337: template<typename K> int primitive_compare(const K& k0, const K& k1) {
>> 1338:   return (((uintptr_t)k0 < (uintptr_t)k1) ? -1
>> 1339:        : ((uintptr_t)k0 == (uintptr_t)k1) ? 0 : 1);
> 
> Suggestion:
> 
>   return k0 < k1 ? -1 : k0 == k1 ? 0 : 1;
Also, if this is used for signed types, we need to preserve the sign for the comparison.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15208#discussion_r1289166541
    
    
More information about the hotspot-dev
mailing list