8297313: Refactor APIs for calculating address of CDS archive heap regions

Reviewed-by: matsaave, ccheung
This commit is contained in:
Ioi Lam 2022-12-01 19:59:14 +00:00
parent 09629570f5
commit 391599bc9d
11 changed files with 228 additions and 153 deletions

View file

@ -72,16 +72,18 @@ const double CLEAN_DEAD_HIGH_WATER_MARK = 0.5;
#if INCLUDE_CDS_JAVA_HEAP
inline oop read_string_from_compact_hashtable(address base_address, u4 offset) {
assert(ArchiveHeapLoader::are_archived_strings_available(), "sanity");
if (UseCompressedOops) {
assert(sizeof(narrowOop) == sizeof(offset), "must be");
narrowOop v = CompressedOops::narrow_oop_cast(offset);
return ArchiveHeapLoader::decode_from_archive(v);
} else {
assert(!ArchiveHeapLoader::is_loaded(), "Pointer relocation for uncompressed oops is unimplemented");
intptr_t dumptime_oop = (uintptr_t)offset;
assert(dumptime_oop != 0, "null strings cannot be interned");
intptr_t runtime_oop = dumptime_oop +
(intptr_t)FileMapInfo::current_info()->header()->heap_begin() +
(intptr_t)ArchiveHeapLoader::runtime_delta();
(intptr_t)ArchiveHeapLoader::mapped_heap_delta();
return (oop)cast_to_oop(runtime_oop);
}
}