8320382: Remove CompressedKlassPointers::is_valid_base()

Reviewed-by: rkennke, aph
This commit is contained in:
Thomas Stuefe 2023-11-22 09:20:19 +00:00
parent 2c31ca525b
commit 98edb03abe
3 changed files with 10 additions and 35 deletions

View File

@ -141,11 +141,16 @@ size_t MetaspaceShared::core_region_alignment() {
}
static bool shared_base_valid(char* shared_base) {
#ifdef _LP64
return CompressedKlassPointers::is_valid_base((address)shared_base);
#else
return true;
#endif
// We check user input for SharedBaseAddress at dump time. We must weed out values
// we already know to be invalid later.
// At CDS runtime, "shared_base" will be the (attempted) mapping start. It will also
// be the encoding base, since the the headers of archived base objects (and with Lilliput,
// the prototype mark words) carry pre-computed narrow Klass IDs that refer to the mapping
// start as base.
//
// Therefore, "shared_base" must be later usable as encoding base.
return AARCH64_ONLY(is_aligned(shared_base, 4 * G)) NOT_AARCH64(true);
}
class DumpClassListCLDClosure : public CLDClosure {
@ -1257,12 +1262,6 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma
if (base_address != nullptr) {
assert(is_aligned(base_address, archive_space_alignment),
"Archive base address invalid: " PTR_FORMAT ".", p2i(base_address));
#ifdef _LP64
if (Metaspace::using_class_space()) {
assert(CompressedKlassPointers::is_valid_base(base_address),
"Archive base address invalid: " PTR_FORMAT ".", p2i(base_address));
}
#endif
}
if (!Metaspace::using_class_space()) {
@ -1348,7 +1347,6 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma
"Sanity (" PTR_FORMAT " vs " PTR_FORMAT ")", p2i(base_address), p2i(total_space_rs.base()));
assert(is_aligned(total_space_rs.base(), archive_space_alignment), "Sanity");
assert(total_space_rs.size() == total_range_size, "Sanity");
assert(CompressedKlassPointers::is_valid_base((address)total_space_rs.base()), "Sanity");
// Now split up the space into ccs and cds archive. For simplicity, just leave
// the gap reserved at the end of the archive space. Do not do real splitting.

View File

@ -39,7 +39,6 @@ size_t CompressedKlassPointers::_range = 0;
// set this encoding scheme. Used by CDS at runtime to re-instate the scheme used to pre-compute klass ids for
// archived heap objects.
void CompressedKlassPointers::initialize_for_given_encoding(address addr, size_t len, address requested_base, int requested_shift) {
assert(is_valid_base(requested_base), "Address must be a valid encoding base");
address const end = addr + len;
const int narrow_klasspointer_bits = sizeof(narrowKlass) * 8;
@ -89,23 +88,6 @@ void CompressedKlassPointers::initialize(address addr, size_t len) {
set_base(base);
set_shift(shift);
set_range(range);
assert(is_valid_base(_base), "Address must be a valid encoding base");
}
// Given an address p, return true if p can be used as an encoding base.
// (Some platforms have restrictions of what constitutes a valid base address).
bool CompressedKlassPointers::is_valid_base(address p) {
#ifdef AARCH64
// Below 32G, base must be aligned to 4G.
// Above that point, base must be aligned to 32G
if (p < (address)(32 * G)) {
return is_aligned(p, 4 * G);
}
return is_aligned(p, (4 << LogKlassAlignmentInBytes) * G);
#else
return true;
#endif
}
void CompressedKlassPointers::print_mode(outputStream* st) {

View File

@ -62,11 +62,6 @@ class CompressedKlassPointers : public AllStatic {
public:
// Given an address p, return true if p can be used as an encoding base.
// (Some platforms have restrictions of what constitutes a valid base
// address).
static bool is_valid_base(address p);
// Given a klass range [addr, addr+len) and a given encoding scheme, assert that this scheme covers the range, then
// set this encoding scheme. Used by CDS at runtime to re-instate the scheme used to pre-compute klass ids for
// archived heap objects.