hotspot/src/share/vm/memory/universe.cpp
changeset 18492 ab4fbcf75767
parent 18491 dd63ba6b0ee4
parent 18453 4056af328b00
child 18687 5a0543c157c9
equal deleted inserted replaced
18491:dd63ba6b0ee4 18492:ab4fbcf75767
   106 Array<Klass*>* Universe::_the_array_interfaces_array = NULL;
   106 Array<Klass*>* Universe::_the_array_interfaces_array = NULL;
   107 oop Universe::_the_null_string                        = NULL;
   107 oop Universe::_the_null_string                        = NULL;
   108 oop Universe::_the_min_jint_string                   = NULL;
   108 oop Universe::_the_min_jint_string                   = NULL;
   109 LatestMethodOopCache* Universe::_finalizer_register_cache = NULL;
   109 LatestMethodOopCache* Universe::_finalizer_register_cache = NULL;
   110 LatestMethodOopCache* Universe::_loader_addClass_cache    = NULL;
   110 LatestMethodOopCache* Universe::_loader_addClass_cache    = NULL;
       
   111 LatestMethodOopCache* Universe::_pd_implies_cache         = NULL;
   111 ActiveMethodOopsCache* Universe::_reflect_invoke_cache    = NULL;
   112 ActiveMethodOopsCache* Universe::_reflect_invoke_cache    = NULL;
   112 oop Universe::_out_of_memory_error_java_heap          = NULL;
   113 oop Universe::_out_of_memory_error_java_heap          = NULL;
   113 oop Universe::_out_of_memory_error_metaspace          = NULL;
   114 oop Universe::_out_of_memory_error_metaspace          = NULL;
   114 oop Universe::_out_of_memory_error_class_metaspace    = NULL;
   115 oop Universe::_out_of_memory_error_class_metaspace    = NULL;
   115 oop Universe::_out_of_memory_error_array_size         = NULL;
   116 oop Universe::_out_of_memory_error_array_size         = NULL;
   224   f->do_ptr((void**)&_the_empty_method_array);
   225   f->do_ptr((void**)&_the_empty_method_array);
   225   f->do_ptr((void**)&_the_empty_klass_array);
   226   f->do_ptr((void**)&_the_empty_klass_array);
   226   _finalizer_register_cache->serialize(f);
   227   _finalizer_register_cache->serialize(f);
   227   _loader_addClass_cache->serialize(f);
   228   _loader_addClass_cache->serialize(f);
   228   _reflect_invoke_cache->serialize(f);
   229   _reflect_invoke_cache->serialize(f);
       
   230   _pd_implies_cache->serialize(f);
   229 }
   231 }
   230 
   232 
   231 void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
   233 void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
   232   if (size < alignment || size % alignment != 0) {
   234   if (size < alignment || size % alignment != 0) {
   233     vm_exit_during_initialization(
   235     vm_exit_during_initialization(
   648 
   650 
   649   // We have a heap so create the Method* caches before
   651   // We have a heap so create the Method* caches before
   650   // Metaspace::initialize_shared_spaces() tries to populate them.
   652   // Metaspace::initialize_shared_spaces() tries to populate them.
   651   Universe::_finalizer_register_cache = new LatestMethodOopCache();
   653   Universe::_finalizer_register_cache = new LatestMethodOopCache();
   652   Universe::_loader_addClass_cache    = new LatestMethodOopCache();
   654   Universe::_loader_addClass_cache    = new LatestMethodOopCache();
       
   655   Universe::_pd_implies_cache         = new LatestMethodOopCache();
   653   Universe::_reflect_invoke_cache     = new ActiveMethodOopsCache();
   656   Universe::_reflect_invoke_cache     = new ActiveMethodOopsCache();
   654 
   657 
   655   if (UseSharedSpaces) {
   658   if (UseSharedSpaces) {
   656     // Read the data structures supporting the shared spaces (shared
   659     // Read the data structures supporting the shared spaces (shared
   657     // system dictionary, symbol table, etc.).  After that, access to
   660     // system dictionary, symbol table, etc.).  After that, access to
  1114       "java.lang.ClassLoader.addClass", false);
  1117       "java.lang.ClassLoader.addClass", false);
  1115   }
  1118   }
  1116   Universe::_loader_addClass_cache->init(
  1119   Universe::_loader_addClass_cache->init(
  1117     SystemDictionary::ClassLoader_klass(), m, CHECK_false);
  1120     SystemDictionary::ClassLoader_klass(), m, CHECK_false);
  1118 
  1121 
       
  1122   // Setup method for checking protection domain
       
  1123   InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->link_class(CHECK_false);
       
  1124   m = InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->
       
  1125             find_method(vmSymbols::impliesCreateAccessControlContext_name(),
       
  1126                         vmSymbols::void_boolean_signature());
       
  1127   // Allow NULL which should only happen with bootstrapping.
       
  1128   if (m != NULL) {
       
  1129     if (m->is_static()) {
       
  1130       // NoSuchMethodException doesn't actually work because it tries to run the
       
  1131       // <init> function before java_lang_Class is linked. Print error and exit.
       
  1132       tty->print_cr("ProtectionDomain.impliesCreateAccessControlContext() has the wrong linkage");
       
  1133       return false; // initialization failed
       
  1134     }
       
  1135     Universe::_pd_implies_cache->init(
       
  1136       SystemDictionary::ProtectionDomain_klass(), m, CHECK_false);;
       
  1137   }
       
  1138 
  1119   // The folowing is initializing converter functions for serialization in
  1139   // The folowing is initializing converter functions for serialization in
  1120   // JVM.cpp. If we clean up the StrictMath code above we may want to find
  1140   // JVM.cpp. If we clean up the StrictMath code above we may want to find
  1121   // a better solution for this as well.
  1141   // a better solution for this as well.
  1122   initialize_converter_functions();
  1142   initialize_converter_functions();
  1123 
  1143 
  1131   // ("weak") refs processing infrastructure initialization
  1151   // ("weak") refs processing infrastructure initialization
  1132   Universe::heap()->post_initialize();
  1152   Universe::heap()->post_initialize();
  1133 
  1153 
  1134   // Initialize performance counters for metaspaces
  1154   // Initialize performance counters for metaspaces
  1135   MetaspaceCounters::initialize_performance_counters();
  1155   MetaspaceCounters::initialize_performance_counters();
       
  1156   MemoryService::add_metaspace_memory_pools();
  1136 
  1157 
  1137   GC_locker::unlock();  // allow gc after bootstrapping
  1158   GC_locker::unlock();  // allow gc after bootstrapping
  1138 
  1159 
  1139   MemoryService::set_universe_heap(Universe::_collectedHeap);
  1160   MemoryService::set_universe_heap(Universe::_collectedHeap);
  1140   return true;
  1161   return true;
  1531   return false;
  1552   return false;
  1532 }
  1553 }
  1533 
  1554 
  1534 
  1555 
  1535 Method* LatestMethodOopCache::get_Method() {
  1556 Method* LatestMethodOopCache::get_Method() {
       
  1557   if (klass() == NULL) return NULL;
  1536   InstanceKlass* ik = InstanceKlass::cast(klass());
  1558   InstanceKlass* ik = InstanceKlass::cast(klass());
  1537   Method* m = ik->method_with_idnum(method_idnum());
  1559   Method* m = ik->method_with_idnum(method_idnum());
  1538   assert(m != NULL, "sanity check");
  1560   assert(m != NULL, "sanity check");
  1539   return m;
  1561   return m;
  1540 }
  1562 }