RFR: 8313905: Checked_cast assert in CDS compare_by_loader

Dean Long dlong at openjdk.org
Wed Aug 9 19:51:59 UTC 2023


On Wed, 9 Aug 2023 19:29:35 GMT, Dean Long <dlong at openjdk.org> wrote:

>> Fix a checked_cast<> assert caused by changes to CDS code, but not using address calculations for comparison operators for class loaders or InstanceKlass pointers.
>> Tested with tier1-4 on linux-x64-debug and windows-x64-debug.
>
> src/hotspot/share/utilities/globalDefinitions.hpp line 1341:
> 
>> 1339:        : ((uintptr_t)k0 == (uintptr_t)k1) ? 0 : 1);
>> 1340: }
>> 1341: 
> 
> I was thinking this would hurt performance, but on x86 and aarch64 the compiler generates conditional moves instead of conditional branches.
> I don't like using uintptr_t here.  Can't we compare void* or better yet K*?

To match primitive_equals, we can just use k0 < k1, without the cast to uintptr_t, right?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15208#discussion_r1289108969


More information about the hotspot-dev mailing list