RFR: 8365814: Consolidate has_been_archived() and has_been_buffered() in ArchiveBuilder

Ioi Lam iklam at openjdk.org
Thu Aug 21 01:01:54 UTC 2025


On Wed, 20 Aug 2025 13:22:32 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Merged the two methods into one: `ArchiveBuilder::has_been_archived()`. Added comments and asserts to explain what the expected result is.
>
> 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?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26853#discussion_r2289619230


More information about the hotspot-runtime-dev mailing list