Skip to content
Permalink
Browse files
8267431: Rename InstanceKlass::has_old_class_version to can_be_verifi…
…ed_at_dumptime

Reviewed-by: iklam
  • Loading branch information
calvinccheung committed May 25, 2021
1 parent c519ba2 commit de27da7dedb217481b5e1582c38313232828a18c
@@ -390,7 +390,7 @@ static void rewrite_nofast_bytecode(const methodHandle& method) {
void MetaspaceShared::rewrite_nofast_bytecodes_and_calculate_fingerprints(Thread* thread, InstanceKlass* ik) {
for (int i = 0; i < ik->methods()->length(); i++) {
methodHandle m(thread, ik->methods()->at(i));
if (!ik->has_old_class_version()) {
if (!ik->can_be_verified_at_dumptime()) {
rewrite_nofast_bytecode(m);
}
Fingerprinter fp(m);
@@ -580,7 +580,7 @@ class CollectCLDClosure : public CLDClosure {
bool MetaspaceShared::linking_required(InstanceKlass* ik) {
// For static CDS dump, do not link old classes.
// For dynamic CDS dump, only link classes loaded by the builtin class loaders.
return DumpSharedSpaces ? !ik->has_old_class_version() : !ik->is_shared_unregistered_class();
return DumpSharedSpaces ? !ik->can_be_verified_at_dumptime() : !ik->is_shared_unregistered_class();
}

bool MetaspaceShared::link_class_for_cds(InstanceKlass* ik, TRAPS) {
@@ -756,7 +756,7 @@ bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) {
ExceptionMark em(current);
JavaThread* THREAD = current; // For exception macros.
Arguments::assert_is_dumping_archive();
if (ik->is_loaded() && !ik->is_linked() && !ik->has_old_class_version() &&
if (ik->is_loaded() && !ik->is_linked() && !ik->can_be_verified_at_dumptime() &&
!SystemDictionaryShared::has_class_failed_verification(ik)) {
bool saved = BytecodeVerificationLocal;
if (ik->is_shared_unregistered_class() && ik->class_loader() == NULL) {
@@ -1386,7 +1386,7 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) {
if (has_class_failed_verification(k)) {
return warn_excluded(k, "Failed verification");
} else {
if (!k->has_old_class_version()) {
if (!k->can_be_verified_at_dumptime()) {
return warn_excluded(k, "Not linked");
}
}
@@ -1400,7 +1400,7 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) {
return true;
}

if (k->has_old_class_version() && k->is_linked()) {
if (k->can_be_verified_at_dumptime() && k->is_linked()) {
return warn_excluded(k, "Old class has been linked");
}

@@ -571,7 +571,7 @@ void Rewriter::rewrite(InstanceKlass* klass, TRAPS) {
#if INCLUDE_CDS
if (klass->is_shared()) {
assert(!klass->is_rewritten(), "rewritten shared classes cannot be rewritten again");
assert(klass->has_old_class_version(), "only shared old classes aren't rewritten");
assert(klass->can_be_verified_at_dumptime(), "only shared old classes aren't rewritten");
}
#endif // INCLUDE_CDS
ResourceMark rm(THREAD);
@@ -2402,7 +2402,7 @@ void InstanceKlass::metaspace_pointers_do(MetaspaceClosure* it) {

void InstanceKlass::remove_unshareable_info() {

if (has_old_class_version()) {
if (can_be_verified_at_dumptime()) {
// Set the old class bit.
set_is_shared_old_klass();
}
@@ -2546,17 +2546,17 @@ void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handl
// 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 {
bool InstanceKlass::can_be_verified_at_dumptime() const {
if (major_version() < 50 /*JAVA_6_VERSION*/) {
return true;
}
if (java_super() != NULL && java_super()->has_old_class_version()) {
if (java_super() != NULL && java_super()->can_be_verified_at_dumptime()) {
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()) {
if (interfaces->at(i)->can_be_verified_at_dumptime()) {
return true;
}
}
@@ -1228,7 +1228,7 @@ class InstanceKlass: public Klass {
virtual void remove_java_mirror();
void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS);
void init_shared_package_entry();
bool has_old_class_version() const;
bool can_be_verified_at_dumptime() const;

jint compute_modifier_flags() const;

@@ -1094,8 +1094,8 @@ void itableMethodEntry::initialize(InstanceKlass* klass, Method* m) {
#ifdef ASSERT
if (MetaspaceShared::is_in_shared_metaspace((void*)&_method) &&
!MetaspaceShared::remapped_readwrite() &&
!m->method_holder()->has_old_class_version() &&
!klass->has_old_class_version()) {
!m->method_holder()->can_be_verified_at_dumptime() &&
!klass->can_be_verified_at_dumptime()) {
// At runtime initialize_itable is rerun as part of link_class_impl()
// for a shared class loaded by the non-boot loader.
// The dumptime itable method entry should be the same as the runtime entry.

1 comment on commit de27da7

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on de27da7 May 25, 2021

Please sign in to comment.