hotspot/src/share/vm/classfile/dictionary.cpp
changeset 26135 82b516c550f7
parent 25492 d27050bdfb04
child 26181 b8d61f186627
equal deleted inserted replaced
25956:99be217ac88d 26135:82b516c550f7
   218     }
   218     }
   219   }
   219   }
   220   _pd_cache_table->roots_oops_do(strong, weak);
   220   _pd_cache_table->roots_oops_do(strong, weak);
   221 }
   221 }
   222 
   222 
       
   223 void Dictionary::remove_classes_in_error_state() {
       
   224   assert(DumpSharedSpaces, "supported only when dumping");
       
   225   DictionaryEntry* probe = NULL;
       
   226   for (int index = 0; index < table_size(); index++) {
       
   227     for (DictionaryEntry** p = bucket_addr(index); *p != NULL; ) {
       
   228       probe = *p;
       
   229       InstanceKlass* ik = InstanceKlass::cast(probe->klass());
       
   230       if (ik->is_in_error_state()) { // purge this entry
       
   231         *p = probe->next();
       
   232         if (probe == _current_class_entry) {
       
   233           _current_class_entry = NULL;
       
   234         }
       
   235         free_entry(probe);
       
   236         ResourceMark rm;
       
   237         tty->print_cr("Removed error class: %s", ik->external_name());
       
   238         continue;
       
   239       }
       
   240 
       
   241       p = probe->next_addr();
       
   242     }
       
   243   }
       
   244 }
       
   245 
   223 void Dictionary::always_strong_oops_do(OopClosure* blk) {
   246 void Dictionary::always_strong_oops_do(OopClosure* blk) {
   224   // Follow all system classes and temporary placeholders in dictionary; only
   247   // Follow all system classes and temporary placeholders in dictionary; only
   225   // protection domain oops contain references into the heap. In a first
   248   // protection domain oops contain references into the heap. In a first
   226   // pass over the system dictionary determine which need to be treated as
   249   // pass over the system dictionary determine which need to be treated as
   227   // strongly reachable and mark them as such.
   250   // strongly reachable and mark them as such.
   691   }
   714   }
   692 }
   715 }
   693 
   716 
   694 
   717 
   695 // ----------------------------------------------------------------------------
   718 // ----------------------------------------------------------------------------
   696 #ifndef PRODUCT
   719 
   697 
   720 void Dictionary::print(bool details) {
   698 void Dictionary::print() {
       
   699   ResourceMark rm;
   721   ResourceMark rm;
   700   HandleMark   hm;
   722   HandleMark   hm;
   701 
   723 
   702   tty->print_cr("Java system dictionary (table_size=%d, classes=%d)",
   724   if (details) {
   703                  table_size(), number_of_entries());
   725     tty->print_cr("Java system dictionary (table_size=%d, classes=%d)",
   704   tty->print_cr("^ indicates that initiating loader is different from "
   726                    table_size(), number_of_entries());
   705                 "defining loader");
   727     tty->print_cr("^ indicates that initiating loader is different from "
       
   728                   "defining loader");
       
   729   }
   706 
   730 
   707   for (int index = 0; index < table_size(); index++) {
   731   for (int index = 0; index < table_size(); index++) {
   708     for (DictionaryEntry* probe = bucket(index);
   732     for (DictionaryEntry* probe = bucket(index);
   709                           probe != NULL;
   733                           probe != NULL;
   710                           probe = probe->next()) {
   734                           probe = probe->next()) {
   711       if (Verbose) tty->print("%4d: ", index);
   735       if (Verbose) tty->print("%4d: ", index);
   712       Klass* e = probe->klass();
   736       Klass* e = probe->klass();
   713       ClassLoaderData* loader_data =  probe->loader_data();
   737       ClassLoaderData* loader_data =  probe->loader_data();
   714       bool is_defining_class =
   738       bool is_defining_class =
   715          (loader_data == InstanceKlass::cast(e)->class_loader_data());
   739          (loader_data == InstanceKlass::cast(e)->class_loader_data());
   716       tty->print("%s%s", is_defining_class ? " " : "^",
   740       tty->print("%s%s", ((!details) || is_defining_class) ? " " : "^",
   717                    e->external_name());
   741                    e->external_name());
   718 
   742 
       
   743       if (details) {
   719         tty->print(", loader ");
   744         tty->print(", loader ");
   720       loader_data->print_value();
   745         if (loader_data != NULL) {
       
   746           loader_data->print_value();
       
   747         } else {
       
   748           tty->print("NULL");
       
   749         }
       
   750       }
   721       tty->cr();
   751       tty->cr();
   722     }
   752     }
   723   }
   753   }
       
   754 
       
   755   if (details) {
       
   756     tty->cr();
       
   757     _pd_cache_table->print();
       
   758   }
   724   tty->cr();
   759   tty->cr();
   725   _pd_cache_table->print();
   760 }
   726   tty->cr();
       
   727 }
       
   728 
       
   729 #endif
       
   730 
   761 
   731 void Dictionary::verify() {
   762 void Dictionary::verify() {
   732   guarantee(number_of_entries() >= 0, "Verify of system dictionary failed");
   763   guarantee(number_of_entries() >= 0, "Verify of system dictionary failed");
   733 
   764 
   734   int element_count = 0;
   765   int element_count = 0;