diff -r 2786541e4f91 -r b4779a44476b src/hotspot/share/gc/shared/scavengableNMethods.cpp --- a/src/hotspot/share/gc/shared/scavengableNMethods.cpp Wed Mar 13 20:07:54 2019 +0100 +++ b/src/hotspot/share/gc/shared/scavengableNMethods.cpp Mon Mar 18 15:19:39 2019 +0100 @@ -65,7 +65,19 @@ } void ScavengableNMethods::unregister_nmethod(nmethod* nm) { - // Do nothing. Unlinking is currently delayed until the purge phase. + assert_locked_or_safepoint(CodeCache_lock); + + if (gc_data(nm).on_list()) { + nmethod* prev = NULL; + for (nmethod* cur = _head; cur != NULL; cur = gc_data(cur).next()) { + if (cur == nm) { + CodeCache::print_trace("unregister_nmethod", nm); + unlist_nmethod(cur, prev); + return; + } + prev = cur; + } + } } #ifndef PRODUCT @@ -112,23 +124,6 @@ #endif // PRODUCT } -void ScavengableNMethods::flush_nmethod(nmethod* nm) { - assert_locked_or_safepoint(CodeCache_lock); - - // TODO: Should be done in unregister_nmethod, during the "unlink" phase. - if (gc_data(nm).on_list()) { - CodeCache::print_trace("flush_nmethod", nm); - nmethod* prev = NULL; - for (nmethod* cur = _head; cur != NULL; cur = gc_data(cur).next()) { - if (cur == nm) { - unlist_nmethod(cur, prev); - return; - } - prev = cur; - } - } -} - class HasScavengableOops: public OopClosure { BoolObjectClosure* _is_scavengable; bool _found;