hotspot/src/share/vm/classfile/systemDictionary.cpp
changeset 46742 24ec8a039c90
parent 46729 c62d2e8b2728
child 46746 ea379ebb9447
equal deleted inserted replaced
46741:d5a7407108b4 46742:24ec8a039c90
    72 #include "runtime/javaCalls.hpp"
    72 #include "runtime/javaCalls.hpp"
    73 #include "runtime/mutexLocker.hpp"
    73 #include "runtime/mutexLocker.hpp"
    74 #include "runtime/orderAccess.inline.hpp"
    74 #include "runtime/orderAccess.inline.hpp"
    75 #include "runtime/signature.hpp"
    75 #include "runtime/signature.hpp"
    76 #include "services/classLoadingService.hpp"
    76 #include "services/classLoadingService.hpp"
       
    77 #include "services/diagnosticCommand.hpp"
    77 #include "services/threadService.hpp"
    78 #include "services/threadService.hpp"
    78 #include "trace/traceMacros.hpp"
    79 #include "trace/traceMacros.hpp"
    79 #include "utilities/macros.hpp"
    80 #include "utilities/macros.hpp"
    80 #include "utilities/ticks.hpp"
    81 #include "utilities/ticks.hpp"
    81 #if INCLUDE_CDS
    82 #if INCLUDE_CDS
  2806 void SystemDictionary::copy_table(char** top, char* end) {
  2807 void SystemDictionary::copy_table(char** top, char* end) {
  2807   ClassLoaderData::the_null_class_loader_data()->dictionary()->copy_table(top, end);
  2808   ClassLoaderData::the_null_class_loader_data()->dictionary()->copy_table(top, end);
  2808 }
  2809 }
  2809 
  2810 
  2810 // ----------------------------------------------------------------------------
  2811 // ----------------------------------------------------------------------------
  2811 void SystemDictionary::print_shared(bool details) {
  2812 void SystemDictionary::print_shared(outputStream *st) {
  2812   shared_dictionary()->print(details);
  2813   shared_dictionary()->print_on(st);
  2813 }
  2814 }
  2814 
  2815 
  2815 void SystemDictionary::print(bool details) {
  2816 void SystemDictionary::print_on(outputStream *st) {
  2816   if (shared_dictionary() != NULL) {
  2817   if (shared_dictionary() != NULL) {
  2817     tty->print_cr("Shared Dictionary");
  2818     tty->print_cr("Shared Dictionary");
  2818     shared_dictionary()->print(details);
  2819     shared_dictionary()->print_on(st);
  2819   }
  2820   }
  2820 
  2821 
  2821   GCMutexLocker mu(SystemDictionary_lock);
  2822   GCMutexLocker mu(SystemDictionary_lock);
  2822 
  2823 
  2823   ClassLoaderDataGraph::print_dictionary(details);
  2824   ClassLoaderDataGraph::print_dictionary(st);
  2824 
  2825 
  2825   // Placeholders
  2826   // Placeholders
  2826   placeholders()->print();
  2827   placeholders()->print_on(st);
  2827   tty->cr();
  2828   st->cr();
  2828 
  2829 
  2829   // loader constraints - print under SD_lock
  2830   // loader constraints - print under SD_lock
  2830   constraints()->print();
  2831   constraints()->print_on(st);
  2831   tty->cr();
  2832   st->cr();
  2832 
  2833 
  2833   _pd_cache_table->print();
  2834   _pd_cache_table->print_on(st);
  2834   tty->cr();
  2835   st->cr();
  2835 }
  2836 }
  2836 
       
  2837 
  2837 
  2838 void SystemDictionary::verify() {
  2838 void SystemDictionary::verify() {
  2839   guarantee(constraints() != NULL,
  2839   guarantee(constraints() != NULL,
  2840             "Verify of loader constraints failed");
  2840             "Verify of loader constraints failed");
  2841   guarantee(placeholders()->number_of_entries() >= 0,
  2841   guarantee(placeholders()->number_of_entries() >= 0,
  2853   constraints()->verify(placeholders());
  2853   constraints()->verify(placeholders());
  2854 
  2854 
  2855   _pd_cache_table->verify();
  2855   _pd_cache_table->verify();
  2856 }
  2856 }
  2857 
  2857 
       
  2858 void SystemDictionary::dump(outputStream *st, bool verbose) {
       
  2859   assert_locked_or_safepoint(SystemDictionary_lock);
       
  2860   if (verbose) {
       
  2861     print_on(st);
       
  2862   } else {
       
  2863     ClassLoaderDataGraph::print_dictionary_statistics(st);
       
  2864     placeholders()->print_table_statistics(st, "Placeholder Table");
       
  2865     constraints()->print_table_statistics(st, "LoaderConstraints Table");
       
  2866     _pd_cache_table->print_table_statistics(st, "ProtectionDomainCache Table");
       
  2867   }
       
  2868 }
       
  2869 
       
  2870 // Utility for dumping dictionaries.
       
  2871 SystemDictionaryDCmd::SystemDictionaryDCmd(outputStream* output, bool heap) :
       
  2872                                  DCmdWithParser(output, heap),
       
  2873   _verbose("-verbose", "Dump the content of each dictionary entry for all class loaders",
       
  2874            "BOOLEAN", false, "false") {
       
  2875   _dcmdparser.add_dcmd_option(&_verbose);
       
  2876 }
       
  2877 
       
  2878 void SystemDictionaryDCmd::execute(DCmdSource source, TRAPS) {
       
  2879   VM_DumpHashtable dumper(output(), VM_DumpHashtable::DumpSysDict,
       
  2880                          _verbose.value());
       
  2881   VMThread::execute(&dumper);
       
  2882 }
       
  2883 
       
  2884 int SystemDictionaryDCmd::num_arguments() {
       
  2885   ResourceMark rm;
       
  2886   SystemDictionaryDCmd* dcmd = new SystemDictionaryDCmd(NULL, false);
       
  2887   if (dcmd != NULL) {
       
  2888     DCmdMark mark(dcmd);
       
  2889     return dcmd->_dcmdparser.num_arguments();
       
  2890   } else {
       
  2891     return 0;
       
  2892   }
       
  2893 }
       
  2894 
       
  2895 
  2858 // caller needs ResourceMark
  2896 // caller needs ResourceMark
  2859 const char* SystemDictionary::loader_name(const oop loader) {
  2897 const char* SystemDictionary::loader_name(const oop loader) {
  2860   return ((loader) == NULL ? "<bootloader>" :
  2898   return ((loader) == NULL ? "<bootloader>" :
  2861           InstanceKlass::cast((loader)->klass())->name()->as_C_string());
  2899           InstanceKlass::cast((loader)->klass())->name()->as_C_string());
  2862 }
  2900 }