Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/instanceKlass.cpp @ 23463:5cece4584b8e
8058563: InstanceKlass::_dependencies list isn't cleared from empty nmethodBucket entries
Reviewed-by: mgerdin, vlivanov
author | stefank |
---|---|
date | Thu, 12 Nov 2015 09:53:17 +0100 |
parents | c2c7fed86a5e |
children | b5f3a471e646 50e62b688ddc |
comparison
equal
deleted
inserted
replaced
23462:f46ffa934a46 | 23463:5cece4584b8e |
---|---|
1967 // Decrement count of the nmethod in the dependency list and remove | 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 | 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 | 1969 // find a corresponding bucket otherwise there's a bug in the |
1970 // recording of dependecies. | 1970 // recording of dependecies. |
1971 // | 1971 // |
1972 void InstanceKlass::remove_dependent_nmethod(nmethod* nm) { | 1972 void InstanceKlass::remove_dependent_nmethod(nmethod* nm, bool delete_immediately) { |
1973 assert_locked_or_safepoint(CodeCache_lock); | 1973 assert_locked_or_safepoint(CodeCache_lock); |
1974 nmethodBucket* b = _dependencies; | 1974 nmethodBucket* b = _dependencies; |
1975 nmethodBucket* last = NULL; | 1975 nmethodBucket* last = NULL; |
1976 while (b != NULL) { | 1976 while (b != NULL) { |
1977 if (nm == b->get_nmethod()) { | 1977 if (nm == b->get_nmethod()) { |
1978 int val = b->decrement(); | 1978 int val = b->decrement(); |
1979 guarantee(val >= 0, err_msg("Underflow: %d", val)); | 1979 guarantee(val >= 0, err_msg("Underflow: %d", val)); |
1980 if (val == 0) { | 1980 if (val == 0) { |
1981 set_has_unloaded_dependent(true); | 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 } | |
1982 } | 1992 } |
1983 return; | 1993 return; |
1984 } | 1994 } |
1985 last = b; | 1995 last = b; |
1986 b = b->next(); | 1996 b = b->next(); |
2315 assert_is_in) | 2325 assert_is_in) |
2316 return size; | 2326 return size; |
2317 } | 2327 } |
2318 | 2328 |
2319 #endif // INCLUDE_ALL_GCS | 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 } | |
2320 | 2337 |
2321 void InstanceKlass::clean_implementors_list(BoolObjectClosure* is_alive) { | 2338 void InstanceKlass::clean_implementors_list(BoolObjectClosure* is_alive) { |
2322 assert(class_loader_data()->is_alive(is_alive), "this klass should be live"); | 2339 assert(class_loader_data()->is_alive(is_alive), "this klass should be live"); |
2323 if (is_interface()) { | 2340 if (is_interface()) { |
2324 if (ClassUnloading) { | 2341 if (ClassUnloading) { |