8266822: Rename MetaspaceShared::is_old_class to be more explicit about what "old" means

Reviewed-by: iklam, minqi, coleenp
This commit is contained in:
Calvin Cheung 2021-05-11 23:53:06 +00:00
parent 616244f43a
commit 57c6ba6e6b
7 changed files with 32 additions and 31 deletions

View file

@ -2429,7 +2429,7 @@ void InstanceKlass::metaspace_pointers_do(MetaspaceClosure* it) {
void InstanceKlass::remove_unshareable_info() {
if (MetaspaceShared::is_old_class(this)) {
if (has_old_class_version()) {
// Set the old class bit.
set_is_shared_old_klass();
}
@ -2568,6 +2568,28 @@ void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handl
}
}
// Check if a class or any of its supertypes has a version older than 50.
// CDS will not perform verification of old classes during dump time because
// without changing the old verifier, the verification constraint cannot be
// retrieved during dump time.
// Verification of archived old classes will be performed during run time.
bool InstanceKlass::has_old_class_version() const {
if (major_version() < 50 /*JAVA_6_VERSION*/) {
return true;
}
if (java_super() != NULL && java_super()->has_old_class_version()) {
return true;
}
Array<InstanceKlass*>* interfaces = local_interfaces();
int len = interfaces->length();
for (int i = 0; i < len; i++) {
if (interfaces->at(i)->has_old_class_version()) {
return true;
}
}
return false;
}
void InstanceKlass::set_shared_class_loader_type(s2 loader_type) {
switch (loader_type) {
case ClassLoader::BOOT_LOADER: