< prev index next >

src/share/vm/oops/instanceKlass.cpp

Print this page




1952   assert_locked_or_safepoint(CodeCache_lock);
1953   nmethodBucket* b = _dependencies;
1954   nmethodBucket* last = NULL;
1955   while (b != NULL) {
1956     if (nm == b->get_nmethod()) {
1957       b->increment();
1958       return;
1959     }
1960     b = b->next();
1961   }
1962   _dependencies = new nmethodBucket(nm, _dependencies);
1963 }
1964 
1965 
1966 //
1967 // Decrement count of the nmethod in the dependency list and remove
1968 // the bucket competely when the count goes to 0.  This method must
1969 // find a corresponding bucket otherwise there's a bug in the
1970 // recording of dependecies.
1971 //
1972 void InstanceKlass::remove_dependent_nmethod(nmethod* nm) {
1973   assert_locked_or_safepoint(CodeCache_lock);
1974   nmethodBucket* b = _dependencies;
1975   nmethodBucket* last = NULL;
1976   while (b != NULL) {
1977     if (nm == b->get_nmethod()) {
1978       int val = b->decrement();
1979       guarantee(val >= 0, err_msg("Underflow: %d", val));
1980       if (val == 0) {









1981         set_has_unloaded_dependent(true);
1982       }

1983       return;
1984     }
1985     last = b;
1986     b = b->next();
1987   }
1988 #ifdef ASSERT
1989   tty->print_cr("### %s can't find dependent nmethod:", this->external_name());
1990   nm->print();
1991 #endif // ASSERT
1992   ShouldNotReachHere();
1993 }
1994 
1995 
1996 #ifndef PRODUCT
1997 void InstanceKlass::print_dependent_nmethods(bool verbose) {
1998   nmethodBucket* b = _dependencies;
1999   int idx = 0;
2000   while (b != NULL) {
2001     nmethod* nm = b->get_nmethod();
2002     tty->print("[%d] count=%d { ", idx++, b->count());


2300 #if INCLUDE_ALL_GCS
2301 void InstanceKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
2302   InstanceKlass_OOP_MAP_REVERSE_ITERATE( \
2303     obj, \
2304     if (PSScavenge::should_scavenge(p)) { \
2305       pm->claim_or_forward_depth(p); \
2306     }, \
2307     assert_nothing )
2308 }
2309 
2310 int InstanceKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
2311   int size = size_helper();
2312   InstanceKlass_OOP_MAP_ITERATE( \
2313     obj, \
2314     PSParallelCompact::adjust_pointer(p), \
2315     assert_is_in)
2316   return size;
2317 }
2318 
2319 #endif // INCLUDE_ALL_GCS







2320 
2321 void InstanceKlass::clean_implementors_list(BoolObjectClosure* is_alive) {
2322   assert(class_loader_data()->is_alive(is_alive), "this klass should be live");
2323   if (is_interface()) {
2324     if (ClassUnloading) {
2325       Klass* impl = implementor();
2326       if (impl != NULL) {
2327         if (!impl->is_loader_alive(is_alive)) {
2328           // remove this guy
2329           Klass** klass = adr_implementor();
2330           assert(klass != NULL, "null klass");
2331           if (klass != NULL) {
2332             *klass = NULL;
2333           }
2334         }
2335       }
2336     }
2337   }
2338 }
2339 




1952   assert_locked_or_safepoint(CodeCache_lock);
1953   nmethodBucket* b = _dependencies;
1954   nmethodBucket* last = NULL;
1955   while (b != NULL) {
1956     if (nm == b->get_nmethod()) {
1957       b->increment();
1958       return;
1959     }
1960     b = b->next();
1961   }
1962   _dependencies = new nmethodBucket(nm, _dependencies);
1963 }
1964 
1965 
1966 //
1967 // Decrement count of the nmethod in the dependency list and remove
1968 // the bucket competely when the count goes to 0.  This method must
1969 // find a corresponding bucket otherwise there's a bug in the
1970 // recording of dependecies.
1971 //
1972 void InstanceKlass::remove_dependent_nmethod(nmethod* nm, bool delete_immediately) {
1973   assert_locked_or_safepoint(CodeCache_lock);
1974   nmethodBucket* b = _dependencies;
1975   nmethodBucket* last = NULL;
1976   while (b != NULL) {
1977     if (nm == b->get_nmethod()) {
1978       int val = b->decrement();
1979       guarantee(val >= 0, err_msg("Underflow: %d", val));
1980       if (val == 0) {
1981         if (delete_immediately) {
1982           if (last == NULL) {
1983             _dependencies = b->next();
1984           } else {
1985             last->set_next(b->next());
1986           }
1987           delete b;
1988         } else {
1989           // The deletion of this entry is deferred until a later, potentially parallel GC phase.
1990           set_has_unloaded_dependent(true);
1991         }
1992       }
1993       return;
1994     }
1995     last = b;
1996     b = b->next();
1997   }
1998 #ifdef ASSERT
1999   tty->print_cr("### %s can't find dependent nmethod:", this->external_name());
2000   nm->print();
2001 #endif // ASSERT
2002   ShouldNotReachHere();
2003 }
2004 
2005 
2006 #ifndef PRODUCT
2007 void InstanceKlass::print_dependent_nmethods(bool verbose) {
2008   nmethodBucket* b = _dependencies;
2009   int idx = 0;
2010   while (b != NULL) {
2011     nmethod* nm = b->get_nmethod();
2012     tty->print("[%d] count=%d { ", idx++, b->count());


2310 #if INCLUDE_ALL_GCS
2311 void InstanceKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
2312   InstanceKlass_OOP_MAP_REVERSE_ITERATE( \
2313     obj, \
2314     if (PSScavenge::should_scavenge(p)) { \
2315       pm->claim_or_forward_depth(p); \
2316     }, \
2317     assert_nothing )
2318 }
2319 
2320 int InstanceKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
2321   int size = size_helper();
2322   InstanceKlass_OOP_MAP_ITERATE( \
2323     obj, \
2324     PSParallelCompact::adjust_pointer(p), \
2325     assert_is_in)
2326   return size;
2327 }
2328 
2329 #endif // INCLUDE_ALL_GCS
2330 
2331 void InstanceKlass::clean_weak_instanceklass_links(BoolObjectClosure* is_alive) {
2332   clean_implementors_list(is_alive);
2333   clean_method_data(is_alive);
2334 
2335   clean_dependent_nmethods();
2336 }
2337 
2338 void InstanceKlass::clean_implementors_list(BoolObjectClosure* is_alive) {
2339   assert(class_loader_data()->is_alive(is_alive), "this klass should be live");
2340   if (is_interface()) {
2341     if (ClassUnloading) {
2342       Klass* impl = implementor();
2343       if (impl != NULL) {
2344         if (!impl->is_loader_alive(is_alive)) {
2345           // remove this guy
2346           Klass** klass = adr_implementor();
2347           assert(klass != NULL, "null klass");
2348           if (klass != NULL) {
2349             *klass = NULL;
2350           }
2351         }
2352       }
2353     }
2354   }
2355 }
2356 


< prev index next >