Skip to content

Commit c088d09

Browse files
committed
8268522: InstanceKlass::can_be_verified_at_dumptime() returns opposite value
Reviewed-by: dholmes, minqi, iklam
1 parent abe20c1 commit c088d09

8 files changed

Lines changed: 25 additions & 25 deletions

File tree

src/hotspot/share/cds/metaspaceShared.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ static void rewrite_nofast_bytecode(const methodHandle& method) {
390390
void MetaspaceShared::rewrite_nofast_bytecodes_and_calculate_fingerprints(Thread* thread, InstanceKlass* ik) {
391391
for (int i = 0; i < ik->methods()->length(); i++) {
392392
methodHandle m(thread, ik->methods()->at(i));
393-
if (!ik->can_be_verified_at_dumptime()) {
393+
if (ik->can_be_verified_at_dumptime()) {
394394
rewrite_nofast_bytecode(m);
395395
}
396396
Fingerprinter fp(m);
@@ -574,7 +574,7 @@ class CollectCLDClosure : public CLDClosure {
574574
bool MetaspaceShared::linking_required(InstanceKlass* ik) {
575575
// For static CDS dump, do not link old classes.
576576
// For dynamic CDS dump, only link classes loaded by the builtin class loaders.
577-
return DumpSharedSpaces ? !ik->can_be_verified_at_dumptime() : !ik->is_shared_unregistered_class();
577+
return DumpSharedSpaces ? ik->can_be_verified_at_dumptime() : !ik->is_shared_unregistered_class();
578578
}
579579

580580
bool MetaspaceShared::link_class_for_cds(InstanceKlass* ik, TRAPS) {
@@ -750,7 +750,7 @@ bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) {
750750
ExceptionMark em(current);
751751
JavaThread* THREAD = current; // For exception macros.
752752
Arguments::assert_is_dumping_archive();
753-
if (ik->is_loaded() && !ik->is_linked() && !ik->can_be_verified_at_dumptime() &&
753+
if (ik->is_loaded() && !ik->is_linked() && ik->can_be_verified_at_dumptime() &&
754754
!SystemDictionaryShared::has_class_failed_verification(ik)) {
755755
bool saved = BytecodeVerificationLocal;
756756
if (ik->is_shared_unregistered_class() && ik->class_loader() == NULL) {

src/hotspot/share/classfile/systemDictionaryShared.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) {
14111411
if (has_class_failed_verification(k)) {
14121412
return warn_excluded(k, "Failed verification");
14131413
} else {
1414-
if (!k->can_be_verified_at_dumptime()) {
1414+
if (k->can_be_verified_at_dumptime()) {
14151415
return warn_excluded(k, "Not linked");
14161416
}
14171417
}
@@ -1425,7 +1425,7 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) {
14251425
return true;
14261426
}
14271427

1428-
if (k->can_be_verified_at_dumptime() && k->is_linked()) {
1428+
if (!k->can_be_verified_at_dumptime() && k->is_linked()) {
14291429
return warn_excluded(k, "Old class has been linked");
14301430
}
14311431

src/hotspot/share/interpreter/rewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ void Rewriter::rewrite(InstanceKlass* klass, TRAPS) {
571571
#if INCLUDE_CDS
572572
if (klass->is_shared()) {
573573
assert(!klass->is_rewritten(), "rewritten shared classes cannot be rewritten again");
574-
assert(klass->can_be_verified_at_dumptime(), "only shared old classes aren't rewritten");
574+
assert(!klass->can_be_verified_at_dumptime(), "only shared old classes aren't rewritten");
575575
}
576576
#endif // INCLUDE_CDS
577577
ResourceMark rm(THREAD);

src/hotspot/share/oops/constantPool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ void ConstantPool::restore_unshareable_info(TRAPS) {
370370
}
371371

372372
void ConstantPool::remove_unshareable_info() {
373-
if (!_pool_holder->is_linked() && _pool_holder->is_shared_old_klass()) {
373+
if (!_pool_holder->is_linked() && !_pool_holder->verified_at_dump_time()) {
374374
return;
375375
}
376376
// Resolved references are not in the shared archive.

src/hotspot/share/oops/instanceKlass.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,8 +2403,8 @@ void InstanceKlass::metaspace_pointers_do(MetaspaceClosure* it) {
24032403
void InstanceKlass::remove_unshareable_info() {
24042404

24052405
if (can_be_verified_at_dumptime()) {
2406-
// Set the old class bit.
2407-
set_is_shared_old_klass();
2406+
// Remember this so we can avoid walking the hierarchy at runtime.
2407+
set_verified_at_dump_time();
24082408
}
24092409

24102410
Klass::remove_unshareable_info();
@@ -2549,19 +2549,19 @@ void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handl
25492549
// Verification of archived old classes will be performed during run time.
25502550
bool InstanceKlass::can_be_verified_at_dumptime() const {
25512551
if (major_version() < 50 /*JAVA_6_VERSION*/) {
2552-
return true;
2552+
return false;
25532553
}
2554-
if (java_super() != NULL && java_super()->can_be_verified_at_dumptime()) {
2555-
return true;
2554+
if (java_super() != NULL && !java_super()->can_be_verified_at_dumptime()) {
2555+
return false;
25562556
}
25572557
Array<InstanceKlass*>* interfaces = local_interfaces();
25582558
int len = interfaces->length();
25592559
for (int i = 0; i < len; i++) {
2560-
if (interfaces->at(i)->can_be_verified_at_dumptime()) {
2561-
return true;
2560+
if (!interfaces->at(i)->can_be_verified_at_dumptime()) {
2561+
return false;
25622562
}
25632563
}
2564-
return false;
2564+
return true;
25652565
}
25662566

25672567
void InstanceKlass::set_shared_class_loader_type(s2 loader_type) {

src/hotspot/share/oops/klass.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class Klass : public Metadata {
178178
enum {
179179
_archived_lambda_proxy_is_available = 2,
180180
_has_value_based_class_annotation = 4,
181-
_is_shared_old_klass = 8
181+
_verified_at_dump_time = 8
182182
};
183183
#endif
184184

@@ -334,11 +334,11 @@ class Klass : public Metadata {
334334
NOT_CDS(return false;)
335335
}
336336

337-
void set_is_shared_old_klass() {
338-
CDS_ONLY(_shared_class_flags |= _is_shared_old_klass;)
337+
void set_verified_at_dump_time() {
338+
CDS_ONLY(_shared_class_flags |= _verified_at_dump_time;)
339339
}
340-
bool is_shared_old_klass() const {
341-
CDS_ONLY(return (_shared_class_flags & _is_shared_old_klass) != 0;)
340+
bool verified_at_dump_time() const {
341+
CDS_ONLY(return (_shared_class_flags & _verified_at_dump_time) != 0;)
342342
NOT_CDS(return false;)
343343
}
344344

src/hotspot/share/oops/klassVtable.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ inline InstanceKlass* klassVtable::ik() const {
5151
}
5252

5353
bool klassVtable::is_preinitialized_vtable() {
54-
return _klass->is_shared() && !MetaspaceShared::remapped_readwrite() && !_klass->is_shared_old_klass();
54+
return _klass->is_shared() && !MetaspaceShared::remapped_readwrite() && _klass->verified_at_dump_time();
5555
}
5656

5757

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

src/hotspot/share/oops/method.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ void Method::remove_unshareable_info() {
409409
}
410410

411411
void Method::set_vtable_index(int index) {
412-
if (is_shared() && !MetaspaceShared::remapped_readwrite() && !method_holder()->is_shared_old_klass()) {
412+
if (is_shared() && !MetaspaceShared::remapped_readwrite() && method_holder()->verified_at_dump_time()) {
413413
// At runtime initialize_vtable is rerun as part of link_class_impl()
414414
// for a shared class loaded by the non-boot loader to obtain the loader
415415
// constraints based on the runtime classloaders' context.
@@ -420,7 +420,7 @@ void Method::set_vtable_index(int index) {
420420
}
421421

422422
void Method::set_itable_index(int index) {
423-
if (is_shared() && !MetaspaceShared::remapped_readwrite() && !method_holder()->is_shared_old_klass()) {
423+
if (is_shared() && !MetaspaceShared::remapped_readwrite() && method_holder()->verified_at_dump_time()) {
424424
// At runtime initialize_itable is rerun as part of link_class_impl()
425425
// for a shared class loaded by the non-boot loader to obtain the loader
426426
// constraints based on the runtime classloaders' context. The dumptime

0 commit comments

Comments
 (0)