The clean up of SourceObjInfo requires iterating over each entry in a hashtable to its _ref member:
https://github.com/openjdk/jdk/blob/6475501a01268f5c35a9bf30f4104ce7a40d8181/src/hotspot/share/cds/archiveBuilder.hpp#L207-L213
class SrcObjTableCleaner {
public:
bool do_entry(address key, const SourceObjInfo& value) {
delete value.ref();
return true;
}
};
void ArchiveBuilder::clean_up_src_obj_table() {
SrcObjTableCleaner cleaner;
_src_obj_table.iterate(&cleaner);
}
This can be simplified by moving the "delete value.ref()" into the destructor of SourceObjInfo.
https://github.com/openjdk/jdk/blob/6475501a01268f5c35a9bf30f4104ce7a40d8181/src/hotspot/share/cds/archiveBuilder.hpp#L207-L213
class SrcObjTableCleaner {
public:
bool do_entry(address key, const SourceObjInfo& value) {
delete value.ref();
return true;
}
};
void ArchiveBuilder::clean_up_src_obj_table() {
SrcObjTableCleaner cleaner;
_src_obj_table.iterate(&cleaner);
}
This can be simplified by moving the "delete value.ref()" into the destructor of SourceObjInfo.