< prev index next >

src/hotspot/share/oops/instanceKlass.cpp

Print this page




 576     // Delete any cached resolution errors for the constant pool
 577     SystemDictionary::delete_resolution_error(constants());
 578 
 579     set_constants(NULL);
 580   }
 581 
 582   if (inner_classes() != NULL &&
 583       inner_classes() != Universe::the_empty_short_array() &&
 584       !inner_classes()->is_shared()) {
 585     MetadataFactory::free_array<jushort>(loader_data, inner_classes());
 586   }
 587   set_inner_classes(NULL);
 588 
 589   if (nest_members() != NULL &&
 590       nest_members() != Universe::the_empty_short_array() &&
 591       !nest_members()->is_shared()) {
 592     MetadataFactory::free_array<jushort>(loader_data, nest_members());
 593   }
 594   set_nest_members(NULL);
 595 






 596   // We should deallocate the Annotations instance if it's not in shared spaces.
 597   if (annotations() != NULL && !annotations()->is_shared()) {
 598     MetadataFactory::free_metadata(loader_data, annotations());
 599   }
 600   set_annotations(NULL);
 601 
 602   if (DumpSharedSpaces) {
 603     SystemDictionaryShared::remove_dumptime_info(this);
 604   }
 605 }
 606 
 607 bool InstanceKlass::should_be_initialized() const {
 608   return !is_initialized();
 609 }
 610 
 611 klassItable InstanceKlass::itable() const {
 612   return klassItable(const_cast<InstanceKlass*>(this));
 613 }
 614 
 615 void InstanceKlass::eager_initialize(Thread *thread) {


2290 
2291   if (itable_length() > 0) {
2292     itableOffsetEntry* ioe = (itableOffsetEntry*)start_of_itable();
2293     int method_table_offset_in_words = ioe->offset()/wordSize;
2294     int nof_interfaces = (method_table_offset_in_words - itable_offset_in_words())
2295                          / itableOffsetEntry::size();
2296 
2297     for (int i = 0; i < nof_interfaces; i ++, ioe ++) {
2298       if (ioe->interface_klass() != NULL) {
2299         it->push(ioe->interface_klass_addr());
2300         itableMethodEntry* ime = ioe->first_method_entry(this);
2301         int n = klassItable::method_count_for_interface(ioe->interface_klass());
2302         for (int index = 0; index < n; index ++) {
2303           it->push(ime[index].method_addr());
2304         }
2305       }
2306     }
2307   }
2308 
2309   it->push(&_nest_members);

2310 }
2311 
2312 void InstanceKlass::remove_unshareable_info() {
2313   Klass::remove_unshareable_info();
2314 
2315   if (is_in_error_state()) {
2316     // Classes are attempted to link during dumping and may fail,
2317     // but these classes are still in the dictionary and class list in CLD.
2318     // Check in_error state first because in_error is > linked state, so
2319     // is_linked() is true.
2320     // If there's a linking error, there is nothing else to remove.
2321     return;
2322   }
2323 
2324   // Reset to the 'allocated' state to prevent any premature accessing to
2325   // a shared class at runtime while the class is still being loaded and
2326   // restored. A class' init_state is set to 'loaded' at runtime when it's
2327   // being added to class hierarchy (see SystemDictionary:::add_to_hierarchy()).
2328   _init_state = allocated;
2329 




 576     // Delete any cached resolution errors for the constant pool
 577     SystemDictionary::delete_resolution_error(constants());
 578 
 579     set_constants(NULL);
 580   }
 581 
 582   if (inner_classes() != NULL &&
 583       inner_classes() != Universe::the_empty_short_array() &&
 584       !inner_classes()->is_shared()) {
 585     MetadataFactory::free_array<jushort>(loader_data, inner_classes());
 586   }
 587   set_inner_classes(NULL);
 588 
 589   if (nest_members() != NULL &&
 590       nest_members() != Universe::the_empty_short_array() &&
 591       !nest_members()->is_shared()) {
 592     MetadataFactory::free_array<jushort>(loader_data, nest_members());
 593   }
 594   set_nest_members(NULL);
 595 
 596   if (record_params() != NULL &&
 597       record_params() != Universe::the_empty_short_array()) {
 598     MetadataFactory::free_array<jushort>(loader_data, record_params());
 599   }
 600   set_record_params(NULL, 0);
 601 
 602   // We should deallocate the Annotations instance if it's not in shared spaces.
 603   if (annotations() != NULL && !annotations()->is_shared()) {
 604     MetadataFactory::free_metadata(loader_data, annotations());
 605   }
 606   set_annotations(NULL);
 607 
 608   if (DumpSharedSpaces) {
 609     SystemDictionaryShared::remove_dumptime_info(this);
 610   }
 611 }
 612 
 613 bool InstanceKlass::should_be_initialized() const {
 614   return !is_initialized();
 615 }
 616 
 617 klassItable InstanceKlass::itable() const {
 618   return klassItable(const_cast<InstanceKlass*>(this));
 619 }
 620 
 621 void InstanceKlass::eager_initialize(Thread *thread) {


2296 
2297   if (itable_length() > 0) {
2298     itableOffsetEntry* ioe = (itableOffsetEntry*)start_of_itable();
2299     int method_table_offset_in_words = ioe->offset()/wordSize;
2300     int nof_interfaces = (method_table_offset_in_words - itable_offset_in_words())
2301                          / itableOffsetEntry::size();
2302 
2303     for (int i = 0; i < nof_interfaces; i ++, ioe ++) {
2304       if (ioe->interface_klass() != NULL) {
2305         it->push(ioe->interface_klass_addr());
2306         itableMethodEntry* ime = ioe->first_method_entry(this);
2307         int n = klassItable::method_count_for_interface(ioe->interface_klass());
2308         for (int index = 0; index < n; index ++) {
2309           it->push(ime[index].method_addr());
2310         }
2311       }
2312     }
2313   }
2314 
2315   it->push(&_nest_members);
2316   it->push(&_record_params);
2317 }
2318 
2319 void InstanceKlass::remove_unshareable_info() {
2320   Klass::remove_unshareable_info();
2321 
2322   if (is_in_error_state()) {
2323     // Classes are attempted to link during dumping and may fail,
2324     // but these classes are still in the dictionary and class list in CLD.
2325     // Check in_error state first because in_error is > linked state, so
2326     // is_linked() is true.
2327     // If there's a linking error, there is nothing else to remove.
2328     return;
2329   }
2330 
2331   // Reset to the 'allocated' state to prevent any premature accessing to
2332   // a shared class at runtime while the class is still being loaded and
2333   // restored. A class' init_state is set to 'loaded' at runtime when it's
2334   // being added to class hierarchy (see SystemDictionary:::add_to_hierarchy()).
2335   _init_state = allocated;
2336 


< prev index next >