< prev index next >

src/hotspot/share/memory/universe.cpp


511 }                                                                                                                                    
512 
513 void Universe::set_reference_pending_list(oop list) {                                                                                
514   assert_pll_ownership();                                                                                                            
515   _reference_pending_list = list;                                                                                                    
516 }                                                                                                                                    
517 
518 bool Universe::has_reference_pending_list() {                                                                                        
519   assert_pll_ownership();                                                                                                            
520   return _reference_pending_list != NULL;                                                                                            
521 }                                                                                                                                    
522 
523 oop Universe::swap_reference_pending_list(oop list) {                                                                                
524   assert_pll_locked(is_locked);                                                                                                      
525   return Atomic::xchg(list, &_reference_pending_list);                                                                               
526 }                                                                                                                                    
527 
528 #undef assert_pll_locked                                                                                                             
529 #undef assert_pll_ownership                                                                                                          
530 
531 // initialize_vtable could cause gc if                                                                                               
532 // 1) we specified true to initialize_vtable and                                                                                     
533 // 2) this ran after gc was enabled                                                                                                  
534 // In case those ever change we use handles for oops                                                                                 
535 void Universe::reinitialize_vtable_of(Klass* ko, TRAPS) {                                                                            
536   // init vtable of k and all subclasses                                                                                             
537   ko->vtable().initialize_vtable(false, CHECK);                                                                                      
538   if (ko->is_instance_klass()) {                                                                                                     
539     for (Klass* sk = ko->subklass();                                                                                                 
540          sk != NULL;                                                                                                                 
541          sk = sk->next_sibling()) {                                                                                                  
542       reinitialize_vtable_of(sk, CHECK);                                                                                             
543     }                                                                                                                                
544   }                                                                                                                                  
545 }                                                                                                                                    
546 
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
547 
548 void initialize_itable_for_klass(InstanceKlass* k, TRAPS) {                                                                          
549   k->itable().initialize_itable(false, CHECK);                                                                                       
550 }                                                                                                                                    
551 
552 
553 void Universe::reinitialize_itables(TRAPS) {                                                                                         
554   MutexLocker mcld(ClassLoaderDataGraph_lock);                                                                                       
555   ClassLoaderDataGraph::dictionary_classes_do(initialize_itable_for_klass, CHECK);                                                   
556 }                                                                                                                                    
557 
558 
559 bool Universe::on_page_boundary(void* addr) {                                                                                        
560   return is_aligned(addr, os::vm_page_size());                                                                                       
561 }                                                                                                                                    
562 
563 
564 bool Universe::should_fill_in_stack_trace(Handle throwable) {                                                                        
565   // never attempt to fill in the stack trace of preallocated errors that do not have                                                

511 }
512 
513 void Universe::set_reference_pending_list(oop list) {
514   assert_pll_ownership();
515   _reference_pending_list = list;
516 }
517 
518 bool Universe::has_reference_pending_list() {
519   assert_pll_ownership();
520   return _reference_pending_list != NULL;
521 }
522 
523 oop Universe::swap_reference_pending_list(oop list) {
524   assert_pll_locked(is_locked);
525   return Atomic::xchg(list, &_reference_pending_list);
526 }
527 
528 #undef assert_pll_locked
529 #undef assert_pll_ownership
530 




531 void Universe::reinitialize_vtable_of(Klass* ko, TRAPS) {
532   // init vtable of k and all subclasses
533   ko->vtable().initialize_vtable(false, CHECK);
534   if (ko->is_instance_klass()) {
535     for (Klass* sk = ko->subklass();
536          sk != NULL;
537          sk = sk->next_sibling()) {
538       reinitialize_vtable_of(sk, CHECK);
539     }
540   }
541 }
542 
543 void Universe::reinitialize_vtables(TRAPS) {
544   // The vtables are initialized by starting at java.lang.Object and
545   // initializing through the subclass links, so that the super
546   // classes are always initialized first.
547   Klass* ok = SystemDictionary::Object_klass();
548   Universe::reinitialize_vtable_of(ok, THREAD);
549 }
550 
551 
552 void initialize_itable_for_klass(InstanceKlass* k, TRAPS) {
553   k->itable().initialize_itable(false, CHECK);
554 }
555 
556 
557 void Universe::reinitialize_itables(TRAPS) {
558   MutexLocker mcld(ClassLoaderDataGraph_lock);
559   ClassLoaderDataGraph::dictionary_classes_do(initialize_itable_for_klass, CHECK);
560 }
561 
562 
563 bool Universe::on_page_boundary(void* addr) {
564   return is_aligned(addr, os::vm_page_size());
565 }
566 
567 
568 bool Universe::should_fill_in_stack_trace(Handle throwable) {
569   // never attempt to fill in the stack trace of preallocated errors that do not have

943                           vmSymbols::doStackWalk_signature(), false, CHECK);                                                         
944 }                                                                                                                                    
945 
946 void universe2_init() {                                                                                                              
947   EXCEPTION_MARK;                                                                                                                    
948   Universe::genesis(CATCH);                                                                                                          
949 }                                                                                                                                    
950 
951 // Set after initialization of the module runtime, call_initModuleRuntime                                                            
952 void universe_post_module_init() {                                                                                                   
953   Universe::_module_initialized = true;                                                                                              
954 }                                                                                                                                    
955 
956 bool universe_post_init() {                                                                                                          
957   assert(!is_init_completed(), "Error: initialization not yet completed!");                                                          
958   Universe::_fully_initialized = true;                                                                                               
959   EXCEPTION_MARK;                                                                                                                    
960   { ResourceMark rm;                                                                                                                 
961     Interpreter::initialize();      // needed for interpreter entry points                                                           
962     if (!UseSharedSpaces) {                                                                                                          
963       HandleMark hm(THREAD);                                                                                                         
964       Klass* ok = SystemDictionary::Object_klass();                                                                                  
965       Universe::reinitialize_vtable_of(ok, CHECK_false);                                                                             
966       Universe::reinitialize_itables(CHECK_false);                                                                                   
967     }                                                                                                                                
968   }                                                                                                                                  
969 
970   HandleMark hm(THREAD);                                                                                                             
971   // Setup preallocated empty java.lang.Class array                                                                                  
972   Universe::_the_empty_class_klass_array = oopFactory::new_objArray(SystemDictionary::Class_klass(), 0, CHECK_false);                
973 
974   // Setup preallocated OutOfMemoryError errors                                                                                      
975   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_OutOfMemoryError(), true, CHECK_false);                          
976   InstanceKlass* ik = InstanceKlass::cast(k);                                                                                        
977   Universe::_out_of_memory_error_java_heap = ik->allocate_instance(CHECK_false);                                                     
978   Universe::_out_of_memory_error_metaspace = ik->allocate_instance(CHECK_false);                                                     
979   Universe::_out_of_memory_error_class_metaspace = ik->allocate_instance(CHECK_false);                                               
980   Universe::_out_of_memory_error_array_size = ik->allocate_instance(CHECK_false);                                                    
981   Universe::_out_of_memory_error_gc_overhead_limit =                                                                                 
982     ik->allocate_instance(CHECK_false);                                                                                              
983   Universe::_out_of_memory_error_realloc_objects = ik->allocate_instance(CHECK_false);                                               
984   Universe::_out_of_memory_error_retry = ik->allocate_instance(CHECK_false);                                                         

947                           vmSymbols::doStackWalk_signature(), false, CHECK);
948 }
949 
950 void universe2_init() {
951   EXCEPTION_MARK;
952   Universe::genesis(CATCH);
953 }
954 
955 // Set after initialization of the module runtime, call_initModuleRuntime
956 void universe_post_module_init() {
957   Universe::_module_initialized = true;
958 }
959 
960 bool universe_post_init() {
961   assert(!is_init_completed(), "Error: initialization not yet completed!");
962   Universe::_fully_initialized = true;
963   EXCEPTION_MARK;
964   { ResourceMark rm;
965     Interpreter::initialize();      // needed for interpreter entry points
966     if (!UseSharedSpaces) {
967       Universe::reinitialize_vtables(CHECK_false);


968       Universe::reinitialize_itables(CHECK_false);
969     }
970   }
971 
972   HandleMark hm(THREAD);
973   // Setup preallocated empty java.lang.Class array
974   Universe::_the_empty_class_klass_array = oopFactory::new_objArray(SystemDictionary::Class_klass(), 0, CHECK_false);
975 
976   // Setup preallocated OutOfMemoryError errors
977   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_OutOfMemoryError(), true, CHECK_false);
978   InstanceKlass* ik = InstanceKlass::cast(k);
979   Universe::_out_of_memory_error_java_heap = ik->allocate_instance(CHECK_false);
980   Universe::_out_of_memory_error_metaspace = ik->allocate_instance(CHECK_false);
981   Universe::_out_of_memory_error_class_metaspace = ik->allocate_instance(CHECK_false);
982   Universe::_out_of_memory_error_array_size = ik->allocate_instance(CHECK_false);
983   Universe::_out_of_memory_error_gc_overhead_limit =
984     ik->allocate_instance(CHECK_false);
985   Universe::_out_of_memory_error_realloc_objects = ik->allocate_instance(CHECK_false);
986   Universe::_out_of_memory_error_retry = ik->allocate_instance(CHECK_false);
< prev index next >