src/hotspot/share/oops/instanceKlass.cpp
changeset 52781 436097b038a1
parent 52706 19b15ff2576b
child 52784 621efe32eb0b
equal deleted inserted replaced
52780:be588be89f68 52781:436097b038a1
  2115   }
  2115   }
  2116   return id;
  2116   return id;
  2117 }
  2117 }
  2118 
  2118 
  2119 inline DependencyContext InstanceKlass::dependencies() {
  2119 inline DependencyContext InstanceKlass::dependencies() {
  2120   DependencyContext dep_context(&_dep_context);
  2120   DependencyContext dep_context(&_dep_context, &_dep_context_last_cleaned);
  2121   return dep_context;
  2121   return dep_context;
  2122 }
  2122 }
  2123 
  2123 
  2124 int InstanceKlass::mark_dependent_nmethods(KlassDepChange& changes) {
  2124 int InstanceKlass::mark_dependent_nmethods(KlassDepChange& changes) {
  2125   return dependencies().mark_dependent_nmethods(changes);
  2125   return dependencies().mark_dependent_nmethods(changes);
  2127 
  2127 
  2128 void InstanceKlass::add_dependent_nmethod(nmethod* nm) {
  2128 void InstanceKlass::add_dependent_nmethod(nmethod* nm) {
  2129   dependencies().add_dependent_nmethod(nm);
  2129   dependencies().add_dependent_nmethod(nm);
  2130 }
  2130 }
  2131 
  2131 
  2132 void InstanceKlass::remove_dependent_nmethod(nmethod* nm, bool delete_immediately) {
  2132 void InstanceKlass::remove_dependent_nmethod(nmethod* nm) {
  2133   dependencies().remove_dependent_nmethod(nm, delete_immediately);
  2133   dependencies().remove_dependent_nmethod(nm);
       
  2134 }
       
  2135 
       
  2136 void InstanceKlass::clean_dependency_context() {
       
  2137   dependencies().clean_unloading_dependents();
  2134 }
  2138 }
  2135 
  2139 
  2136 #ifndef PRODUCT
  2140 #ifndef PRODUCT
  2137 void InstanceKlass::print_dependent_nmethods(bool verbose) {
  2141 void InstanceKlass::print_dependent_nmethods(bool verbose) {
  2138   dependencies().print_dependent_nmethods(verbose);
  2142   dependencies().print_dependent_nmethods(verbose);
  2144 #endif //PRODUCT
  2148 #endif //PRODUCT
  2145 
  2149 
  2146 void InstanceKlass::clean_weak_instanceklass_links() {
  2150 void InstanceKlass::clean_weak_instanceklass_links() {
  2147   clean_implementors_list();
  2151   clean_implementors_list();
  2148   clean_method_data();
  2152   clean_method_data();
  2149 
       
  2150   // Since GC iterates InstanceKlasses sequentially, it is safe to remove stale entries here.
       
  2151   DependencyContext dep_context(&_dep_context);
       
  2152   dep_context.expunge_stale_entries();
       
  2153 }
  2153 }
  2154 
  2154 
  2155 void InstanceKlass::clean_implementors_list() {
  2155 void InstanceKlass::clean_implementors_list() {
  2156   assert(is_loader_alive(), "this klass should be live");
  2156   assert(is_loader_alive(), "this klass should be live");
  2157   if (is_interface()) {
  2157   if (is_interface()) {
  2332   }
  2332   }
  2333 
  2333 
  2334   // These are not allocated from metaspace, but they should should all be empty
  2334   // These are not allocated from metaspace, but they should should all be empty
  2335   // during dump time, so we don't need to worry about them in InstanceKlass::iterate().
  2335   // during dump time, so we don't need to worry about them in InstanceKlass::iterate().
  2336   guarantee(_source_debug_extension == NULL, "must be");
  2336   guarantee(_source_debug_extension == NULL, "must be");
  2337   guarantee(_dep_context == DependencyContext::EMPTY, "must be");
  2337   guarantee(_dep_context == NULL, "must be");
  2338   guarantee(_osr_nmethods_head == NULL, "must be");
  2338   guarantee(_osr_nmethods_head == NULL, "must be");
  2339 
  2339 
  2340 #if INCLUDE_JVMTI
  2340 #if INCLUDE_JVMTI
  2341   guarantee(_breakpoints == NULL, "must be");
  2341   guarantee(_breakpoints == NULL, "must be");
  2342   guarantee(_previous_versions == NULL, "must be");
  2342   guarantee(_previous_versions == NULL, "must be");
  2477   if (jmeths != (jmethodID*)NULL) {
  2477   if (jmeths != (jmethodID*)NULL) {
  2478     release_set_methods_jmethod_ids(NULL);
  2478     release_set_methods_jmethod_ids(NULL);
  2479     FreeHeap(jmeths);
  2479     FreeHeap(jmeths);
  2480   }
  2480   }
  2481 
  2481 
  2482   assert(_dep_context == DependencyContext::EMPTY,
  2482   assert(_dep_context == NULL,
  2483          "dependencies should already be cleaned");
  2483          "dependencies should already be cleaned");
  2484 
  2484 
  2485 #if INCLUDE_JVMTI
  2485 #if INCLUDE_JVMTI
  2486   // Deallocate breakpoint records
  2486   // Deallocate breakpoint records
  2487   if (breakpoints() != 0x0) {
  2487   if (breakpoints() != 0x0) {