RFR: 8365814: Consolidate has_been_archived() and has_been_buffered() in ArchiveBuilder
Coleen Phillimore
coleenp at openjdk.org
Thu Aug 21 19:28:53 UTC 2025
On Thu, 21 Aug 2025 00:59:22 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> src/hotspot/share/cds/archiveBuilder.hpp line 448:
>>
>>> 446: bool has_been_archived(address src_addr) const;
>>> 447: template <typename T> bool has_been_archived(T src_addr) const {
>>> 448: return has_been_archived((address)src_addr);
>>
>> What's the point of having a template if you're going to erase the type?
>
> I did it this way so the caller doesn't need to do casting like
>
>
> Method* m = xxx();
> if (has_been_archived((address)m)) {.....}
>
>
> Is there a better way to indicate that `has_been_archived()` takes any pointer?
I think you probably should cast away the type at the call sites. The template's not going to make it any more type-safe. It's sort of deceiving that it kinda looks type safe.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26853#discussion_r2291943273
More information about the hotspot-runtime-dev
mailing list