hotspot/src/share/vm/oops/klass.cpp
changeset 18439 725ce18186b3
parent 18025 b7bcf7497f93
child 18687 5a0543c157c9
equal deleted inserted replaced
18438:9ea6bbfe0b83 18439:725ce18186b3
   375   super->set_subklass(this);
   375   super->set_subklass(this);
   376   debug_only(verify();)
   376   debug_only(verify();)
   377 }
   377 }
   378 
   378 
   379 bool Klass::is_loader_alive(BoolObjectClosure* is_alive) {
   379 bool Klass::is_loader_alive(BoolObjectClosure* is_alive) {
   380   assert(is_metadata(), "p is not meta-data");
       
   381   assert(ClassLoaderDataGraph::contains((address)this), "is in the metaspace");
   380   assert(ClassLoaderDataGraph::contains((address)this), "is in the metaspace");
   382 
   381 
   383 #ifdef ASSERT
   382 #ifdef ASSERT
   384   // The class is alive iff the class loader is alive.
   383   // The class is alive iff the class loader is alive.
   385   oop loader = class_loader();
   384   oop loader = class_loader();
   646 }
   645 }
   647 #endif // INCLUDE_SERVICES
   646 #endif // INCLUDE_SERVICES
   648 
   647 
   649 // Verification
   648 // Verification
   650 
   649 
   651 void Klass::verify_on(outputStream* st) {
   650 void Klass::verify_on(outputStream* st, bool check_dictionary) {
   652   guarantee(!Universe::heap()->is_in_reserved(this), "Shouldn't be");
   651 
   653   guarantee(this->is_metadata(), "should be in metaspace");
   652   // This can be expensive, but it is worth checking that this klass is actually
   654 
   653   // in the CLD graph but not in production.
   655   assert(ClassLoaderDataGraph::contains((address)this), "Should be");
   654   assert(ClassLoaderDataGraph::contains((address)this), "Should be");
   656 
   655 
   657   guarantee(this->is_klass(),"should be klass");
   656   guarantee(this->is_klass(),"should be klass");
   658 
   657 
   659   if (super() != NULL) {
   658   if (super() != NULL) {
   660     guarantee(super()->is_metadata(), "should be in metaspace");
       
   661     guarantee(super()->is_klass(), "should be klass");
   659     guarantee(super()->is_klass(), "should be klass");
   662   }
   660   }
   663   if (secondary_super_cache() != NULL) {
   661   if (secondary_super_cache() != NULL) {
   664     Klass* ko = secondary_super_cache();
   662     Klass* ko = secondary_super_cache();
   665     guarantee(ko->is_metadata(), "should be in metaspace");
       
   666     guarantee(ko->is_klass(), "should be klass");
   663     guarantee(ko->is_klass(), "should be klass");
   667   }
   664   }
   668   for ( uint i = 0; i < primary_super_limit(); i++ ) {
   665   for ( uint i = 0; i < primary_super_limit(); i++ ) {
   669     Klass* ko = _primary_supers[i];
   666     Klass* ko = _primary_supers[i];
   670     if (ko != NULL) {
   667     if (ko != NULL) {
   671       guarantee(ko->is_metadata(), "should be in metaspace");
       
   672       guarantee(ko->is_klass(), "should be klass");
   668       guarantee(ko->is_klass(), "should be klass");
   673     }
   669     }
   674   }
   670   }
   675 
   671 
   676   if (java_mirror() != NULL) {
   672   if (java_mirror() != NULL) {
   678   }
   674   }
   679 }
   675 }
   680 
   676 
   681 void Klass::oop_verify_on(oop obj, outputStream* st) {
   677 void Klass::oop_verify_on(oop obj, outputStream* st) {
   682   guarantee(obj->is_oop(),  "should be oop");
   678   guarantee(obj->is_oop(),  "should be oop");
   683   guarantee(obj->klass()->is_metadata(), "should not be in Java heap");
       
   684   guarantee(obj->klass()->is_klass(), "klass field is not a klass");
   679   guarantee(obj->klass()->is_klass(), "klass field is not a klass");
   685 }
   680 }
   686 
   681 
   687 #ifndef PRODUCT
   682 #ifndef PRODUCT
   688 
   683