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