comparison src/share/vm/oops/klass.cpp @ 17891:b6a2ba7d3ea7 hs25.20-b11

Merge
author amurillo
date Thu, 17 Apr 2014 16:09:07 -0700
parents 386dd1c71858
children 34862ced4a87
comparison
equal deleted inserted replaced
17862:70dc2c030c69 17891:b6a2ba7d3ea7
127 assert(k->is_klass(), "argument must be a class"); 127 assert(k->is_klass(), "argument must be a class");
128 return is_subclass_of(k); 128 return is_subclass_of(k);
129 } 129 }
130 130
131 131
132 Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature) const { 132 Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const {
133 #ifdef ASSERT 133 #ifdef ASSERT
134 tty->print_cr("Error: uncached_lookup_method called on a klass oop." 134 tty->print_cr("Error: uncached_lookup_method called on a klass oop."
135 " Likely error: reflection method does not correctly" 135 " Likely error: reflection method does not correctly"
136 " wrap return value in a mirror object."); 136 " wrap return value in a mirror object.");
137 #endif 137 #endif
481 void Klass::oops_do(OopClosure* cl) { 481 void Klass::oops_do(OopClosure* cl) {
482 cl->do_oop(&_java_mirror); 482 cl->do_oop(&_java_mirror);
483 } 483 }
484 484
485 void Klass::remove_unshareable_info() { 485 void Klass::remove_unshareable_info() {
486 if (!DumpSharedSpaces) { 486 assert (DumpSharedSpaces, "only called for DumpSharedSpaces");
487 // Clean up after OOM during class loading 487
488 if (class_loader_data() != NULL) {
489 class_loader_data()->remove_class(this);
490 }
491 }
492 set_subklass(NULL); 488 set_subklass(NULL);
493 set_next_sibling(NULL); 489 set_next_sibling(NULL);
494 // Clear the java mirror 490 // Clear the java mirror
495 set_java_mirror(NULL); 491 set_java_mirror(NULL);
496 set_next_link(NULL); 492 set_next_link(NULL);
498 // Null out class_loader_data because we don't share that yet. 494 // Null out class_loader_data because we don't share that yet.
499 set_class_loader_data(NULL); 495 set_class_loader_data(NULL);
500 } 496 }
501 497
502 void Klass::restore_unshareable_info(TRAPS) { 498 void Klass::restore_unshareable_info(TRAPS) {
503 ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data(); 499 // If an exception happened during CDS restore, some of these fields may already be
504 // Restore class_loader_data to the null class loader data 500 // set. We leave the class on the CLD list, even if incomplete so that we don't
505 set_class_loader_data(loader_data); 501 // modify the CLD list outside a safepoint.
506 502 if (class_loader_data() == NULL) {
507 // Add to null class loader list first before creating the mirror 503 ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
508 // (same order as class file parsing) 504 // Restore class_loader_data to the null class loader data
509 loader_data->add_class(this); 505 set_class_loader_data(loader_data);
506
507 // Add to null class loader list first before creating the mirror
508 // (same order as class file parsing)
509 loader_data->add_class(this);
510 }
510 511
511 // Recreate the class mirror. The protection_domain is always null for 512 // Recreate the class mirror. The protection_domain is always null for
512 // boot loader, for now. 513 // boot loader, for now.
513 java_lang_Class::create_mirror(this, Handle(NULL), CHECK); 514 // Only recreate it if not present. A previous attempt to restore may have
515 // gotten an OOM later but keep the mirror if it was created.
516 if (java_mirror() == NULL) {
517 java_lang_Class::create_mirror(this, Handle(NULL), CHECK);
518 }
514 } 519 }
515 520
516 Klass* Klass::array_klass_or_null(int rank) { 521 Klass* Klass::array_klass_or_null(int rank) {
517 EXCEPTION_MARK; 522 EXCEPTION_MARK;
518 // No exception can be thrown by array_klass_impl when called with or_null == true. 523 // No exception can be thrown by array_klass_impl when called with or_null == true.