8220606: Move ScavengableNMethods unlinking to unregister_nmethod

Reviewed-by: pliden, eosterlund
This commit is contained in:
Stefan Karlsson 2019-03-18 15:19:39 +01:00
parent 6f30d04d76
commit 788dcfd72d
4 changed files with 15 additions and 21 deletions

View File

@ -717,7 +717,7 @@ void ParallelScavengeHeap::verify_nmethod(nmethod* nm) {
}
void ParallelScavengeHeap::flush_nmethod(nmethod* nm) {
ScavengableNMethods::flush_nmethod(nm);
// nothing particular
}
void ParallelScavengeHeap::prune_nmethods() {

View File

@ -723,7 +723,7 @@ void GenCollectedHeap::verify_nmethod(nmethod* nm) {
}
void GenCollectedHeap::flush_nmethod(nmethod* nm) {
ScavengableNMethods::flush_nmethod(nm);
// Do nothing.
}
void GenCollectedHeap::prune_nmethods() {

View File

@ -65,7 +65,19 @@ void ScavengableNMethods::register_nmethod(nmethod* nm) {
}
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 @@ void ScavengableNMethods::verify_nmethod(nmethod* nm) {
#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;

View File

@ -45,7 +45,6 @@ public:
static void register_nmethod(nmethod* nm);
static void unregister_nmethod(nmethod* nm);
static void verify_nmethod(nmethod* nm);
static void flush_nmethod(nmethod* nm);
static void prune_nmethods();