hotspot/src/share/vm/memory/universe.cpp
changeset 40892 330a02d935ad
parent 40667 f9cf2db7f59f
child 42650 1f304d0c888b
equal deleted inserted replaced
40891:8010999ff6d0 40892:330a02d935ad
   133 oop Universe::_null_ptr_exception_instance            = NULL;
   133 oop Universe::_null_ptr_exception_instance            = NULL;
   134 oop Universe::_arithmetic_exception_instance          = NULL;
   134 oop Universe::_arithmetic_exception_instance          = NULL;
   135 oop Universe::_virtual_machine_error_instance         = NULL;
   135 oop Universe::_virtual_machine_error_instance         = NULL;
   136 oop Universe::_vm_exception                           = NULL;
   136 oop Universe::_vm_exception                           = NULL;
   137 oop Universe::_allocation_context_notification_obj    = NULL;
   137 oop Universe::_allocation_context_notification_obj    = NULL;
       
   138 oop Universe::_reference_pending_list                 = NULL;
   138 
   139 
   139 Array<int>* Universe::_the_empty_int_array            = NULL;
   140 Array<int>* Universe::_the_empty_int_array            = NULL;
   140 Array<u2>* Universe::_the_empty_short_array           = NULL;
   141 Array<u2>* Universe::_the_empty_short_array           = NULL;
   141 Array<Klass*>* Universe::_the_empty_klass_array     = NULL;
   142 Array<Klass*>* Universe::_the_empty_klass_array     = NULL;
   142 Array<Method*>* Universe::_the_empty_method_array   = NULL;
   143 Array<Method*>* Universe::_the_empty_method_array   = NULL;
   210   f->do_oop((oop*)&_virtual_machine_error_instance);
   211   f->do_oop((oop*)&_virtual_machine_error_instance);
   211   f->do_oop((oop*)&_main_thread_group);
   212   f->do_oop((oop*)&_main_thread_group);
   212   f->do_oop((oop*)&_system_thread_group);
   213   f->do_oop((oop*)&_system_thread_group);
   213   f->do_oop((oop*)&_vm_exception);
   214   f->do_oop((oop*)&_vm_exception);
   214   f->do_oop((oop*)&_allocation_context_notification_obj);
   215   f->do_oop((oop*)&_allocation_context_notification_obj);
       
   216   f->do_oop((oop*)&_reference_pending_list);
   215   debug_only(f->do_oop((oop*)&_fullgc_alot_dummy_array);)
   217   debug_only(f->do_oop((oop*)&_fullgc_alot_dummy_array);)
   216 }
   218 }
   217 
   219 
   218 // Serialize metadata in and out of CDS archive, not oops.
   220 // Serialize metadata in and out of CDS archive, not oops.
   219 void Universe::serialize(SerializeClosure* f, bool do_all) {
   221 void Universe::serialize(SerializeClosure* f, bool do_all) {
   486 }
   488 }
   487   delete java_lang_Class::fixup_mirror_list();
   489   delete java_lang_Class::fixup_mirror_list();
   488   java_lang_Class::set_fixup_mirror_list(NULL);
   490   java_lang_Class::set_fixup_mirror_list(NULL);
   489 }
   491 }
   490 
   492 
       
   493 #define assert_pll_locked(test) \
       
   494   assert(Heap_lock->test(), "Reference pending list access requires lock")
       
   495 
       
   496 #define assert_pll_ownership() assert_pll_locked(owned_by_self)
       
   497 
       
   498 oop Universe::reference_pending_list() {
       
   499   assert_pll_ownership();
       
   500   return _reference_pending_list;
       
   501 }
       
   502 
       
   503 void Universe::set_reference_pending_list(oop list) {
       
   504   assert_pll_ownership();
       
   505   _reference_pending_list = list;
       
   506 }
       
   507 
       
   508 bool Universe::has_reference_pending_list() {
       
   509   assert_pll_ownership();
       
   510   return _reference_pending_list != NULL;
       
   511 }
       
   512 
       
   513 oop Universe::swap_reference_pending_list(oop list) {
       
   514   assert_pll_locked(is_locked);
       
   515   return (oop)Atomic::xchg_ptr(list, &_reference_pending_list);
       
   516 }
       
   517 
       
   518 #undef assert_pll_locked
       
   519 #undef assert_pll_ownership
       
   520 
       
   521 
   491 static bool has_run_finalizers_on_exit = false;
   522 static bool has_run_finalizers_on_exit = false;
   492 
   523 
   493 void Universe::run_finalizers_on_exit() {
   524 void Universe::run_finalizers_on_exit() {
   494   if (has_run_finalizers_on_exit) return;
   525   if (has_run_finalizers_on_exit) return;
   495   has_run_finalizers_on_exit = true;
   526   has_run_finalizers_on_exit = true;
   563 }
   594 }
   564 
   595 
   565 
   596 
   566 oop Universe::gen_out_of_memory_error(oop default_err) {
   597 oop Universe::gen_out_of_memory_error(oop default_err) {
   567   // generate an out of memory error:
   598   // generate an out of memory error:
   568   // - if there is a preallocated error with backtrace available then return it wth
   599   // - if there is a preallocated error and stack traces are available
   569   //   a filled in stack trace.
   600   //   (j.l.Throwable is initialized), then return the preallocated
   570   // - if there are no preallocated errors with backtrace available then return
   601   //   error with a filled in stack trace, and with the message
   571   //   an error without backtrace.
   602   //   provided by the default error.
       
   603   // - otherwise, return the default error, without a stack trace.
   572   int next;
   604   int next;
   573   if (_preallocated_out_of_memory_error_avail_count > 0) {
   605   if ((_preallocated_out_of_memory_error_avail_count > 0) &&
       
   606       SystemDictionary::Throwable_klass()->is_initialized()) {
   574     next = (int)Atomic::add(-1, &_preallocated_out_of_memory_error_avail_count);
   607     next = (int)Atomic::add(-1, &_preallocated_out_of_memory_error_avail_count);
   575     assert(next < (int)PreallocatedOutOfMemoryErrorCount, "avail count is corrupt");
   608     assert(next < (int)PreallocatedOutOfMemoryErrorCount, "avail count is corrupt");
   576   } else {
   609   } else {
   577     next = -1;
   610     next = -1;
   578   }
   611   }