hotspot/src/share/vm/memory/universe.cpp
changeset 28734 a7ef74a8eca2
parent 28374 0558e321c027
child 29081 c61eb4914428
equal deleted inserted replaced
28733:0fc2c4609840 28734:a7ef74a8eca2
   113 oop Universe::_the_null_string                        = NULL;
   113 oop Universe::_the_null_string                        = NULL;
   114 oop Universe::_the_min_jint_string                   = NULL;
   114 oop Universe::_the_min_jint_string                   = NULL;
   115 LatestMethodCache* Universe::_finalizer_register_cache = NULL;
   115 LatestMethodCache* Universe::_finalizer_register_cache = NULL;
   116 LatestMethodCache* Universe::_loader_addClass_cache    = NULL;
   116 LatestMethodCache* Universe::_loader_addClass_cache    = NULL;
   117 LatestMethodCache* Universe::_pd_implies_cache         = NULL;
   117 LatestMethodCache* Universe::_pd_implies_cache         = NULL;
       
   118 LatestMethodCache* Universe::_throw_illegal_access_error_cache = NULL;
   118 oop Universe::_out_of_memory_error_java_heap          = NULL;
   119 oop Universe::_out_of_memory_error_java_heap          = NULL;
   119 oop Universe::_out_of_memory_error_metaspace          = NULL;
   120 oop Universe::_out_of_memory_error_metaspace          = NULL;
   120 oop Universe::_out_of_memory_error_class_metaspace    = NULL;
   121 oop Universe::_out_of_memory_error_class_metaspace    = NULL;
   121 oop Universe::_out_of_memory_error_array_size         = NULL;
   122 oop Universe::_out_of_memory_error_array_size         = NULL;
   122 oop Universe::_out_of_memory_error_gc_overhead_limit  = NULL;
   123 oop Universe::_out_of_memory_error_gc_overhead_limit  = NULL;
   128 oop Universe::_arithmetic_exception_instance          = NULL;
   129 oop Universe::_arithmetic_exception_instance          = NULL;
   129 oop Universe::_virtual_machine_error_instance         = NULL;
   130 oop Universe::_virtual_machine_error_instance         = NULL;
   130 oop Universe::_vm_exception                           = NULL;
   131 oop Universe::_vm_exception                           = NULL;
   131 oop Universe::_allocation_context_notification_obj    = NULL;
   132 oop Universe::_allocation_context_notification_obj    = NULL;
   132 
   133 
   133 Method* Universe::_throw_illegal_access_error         = NULL;
       
   134 Array<int>* Universe::_the_empty_int_array            = NULL;
   134 Array<int>* Universe::_the_empty_int_array            = NULL;
   135 Array<u2>* Universe::_the_empty_short_array           = NULL;
   135 Array<u2>* Universe::_the_empty_short_array           = NULL;
   136 Array<Klass*>* Universe::_the_empty_klass_array     = NULL;
   136 Array<Klass*>* Universe::_the_empty_klass_array     = NULL;
   137 Array<Method*>* Universe::_the_empty_method_array   = NULL;
   137 Array<Method*>* Universe::_the_empty_method_array   = NULL;
   138 
   138 
   234   f->do_ptr((void**)&_the_empty_method_array);
   234   f->do_ptr((void**)&_the_empty_method_array);
   235   f->do_ptr((void**)&_the_empty_klass_array);
   235   f->do_ptr((void**)&_the_empty_klass_array);
   236   _finalizer_register_cache->serialize(f);
   236   _finalizer_register_cache->serialize(f);
   237   _loader_addClass_cache->serialize(f);
   237   _loader_addClass_cache->serialize(f);
   238   _pd_implies_cache->serialize(f);
   238   _pd_implies_cache->serialize(f);
       
   239   _throw_illegal_access_error_cache->serialize(f);
   239 }
   240 }
   240 
   241 
   241 void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
   242 void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
   242   if (size < alignment || size % alignment != 0) {
   243   if (size < alignment || size % alignment != 0) {
   243     vm_exit_during_initialization(
   244     vm_exit_during_initialization(
   662   // We have a heap so create the Method* caches before
   663   // We have a heap so create the Method* caches before
   663   // Metaspace::initialize_shared_spaces() tries to populate them.
   664   // Metaspace::initialize_shared_spaces() tries to populate them.
   664   Universe::_finalizer_register_cache = new LatestMethodCache();
   665   Universe::_finalizer_register_cache = new LatestMethodCache();
   665   Universe::_loader_addClass_cache    = new LatestMethodCache();
   666   Universe::_loader_addClass_cache    = new LatestMethodCache();
   666   Universe::_pd_implies_cache         = new LatestMethodCache();
   667   Universe::_pd_implies_cache         = new LatestMethodCache();
       
   668   Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
   667 
   669 
   668   if (UseSharedSpaces) {
   670   if (UseSharedSpaces) {
   669     // Read the data structures supporting the shared spaces (shared
   671     // Read the data structures supporting the shared spaces (shared
   670     // system dictionary, symbol table, etc.).  After that, access to
   672     // system dictionary, symbol table, etc.).  After that, access to
   671     // the file (other than the mapped regions) is no longer needed, and
   673     // the file (other than the mapped regions) is no longer needed, and
  1014     // Note null is okay; this method is used in itables, and if it is null,
  1016     // Note null is okay; this method is used in itables, and if it is null,
  1015     // then AbstractMethodError is thrown instead.
  1017     // then AbstractMethodError is thrown instead.
  1016     tty->print_cr("Unable to link/verify Unsafe.throwIllegalAccessError method");
  1018     tty->print_cr("Unable to link/verify Unsafe.throwIllegalAccessError method");
  1017     return false; // initialization failed (cannot throw exception yet)
  1019     return false; // initialization failed (cannot throw exception yet)
  1018   }
  1020   }
  1019   Universe::_throw_illegal_access_error = m;
  1021   Universe::_throw_illegal_access_error_cache->init(
       
  1022     SystemDictionary::misc_Unsafe_klass(), m);
  1020 
  1023 
  1021   // Setup method for registering loaded classes in class loader vector
  1024   // Setup method for registering loaded classes in class loader vector
  1022   InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->link_class(CHECK_false);
  1025   InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->link_class(CHECK_false);
  1023   m = InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->find_method(vmSymbols::addClass_name(), vmSymbols::class_void_signature());
  1026   m = InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->find_method(vmSymbols::addClass_name(), vmSymbols::class_void_signature());
  1024   if (m == NULL || m->is_static()) {
  1027   if (m == NULL || m->is_static()) {
  1040       // <init> function before java_lang_Class is linked. Print error and exit.
  1043       // <init> function before java_lang_Class is linked. Print error and exit.
  1041       tty->print_cr("ProtectionDomain.impliesCreateAccessControlContext() has the wrong linkage");
  1044       tty->print_cr("ProtectionDomain.impliesCreateAccessControlContext() has the wrong linkage");
  1042       return false; // initialization failed
  1045       return false; // initialization failed
  1043     }
  1046     }
  1044     Universe::_pd_implies_cache->init(
  1047     Universe::_pd_implies_cache->init(
  1045       SystemDictionary::ProtectionDomain_klass(), m);;
  1048       SystemDictionary::ProtectionDomain_klass(), m);
  1046   }
  1049   }
  1047 
  1050 
  1048   // This needs to be done before the first scavenge/gc, since
  1051   // This needs to be done before the first scavenge/gc, since
  1049   // it's an input to soft ref clearing policy.
  1052   // it's an input to soft ref clearing policy.
  1050   {
  1053   {