RFR: 8313905: Checked_cast assert in CDS compare_by_loader [v2]

Coleen Phillimore coleenp at openjdk.org
Wed Aug 9 20:55:34 UTC 2023


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

>> 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?

It compiles and passes the appcds tests so I'm surprised it doesn't need the casts.  I didn't think InstanceKlass pointers could be compared like that directly.

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

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


More information about the hotspot-dev mailing list