提交 afffc5eb 编写于 作者: S stefank

8047373: Clean the ExceptionCache in one pass

Summary: Also-reviewed-by: kim.barrett@oracle.com
Reviewed-by: jmasa, jwilhelm
上级 bfa001f7
...@@ -384,27 +384,30 @@ void nmethod::add_exception_cache_entry(ExceptionCache* new_entry) { ...@@ -384,27 +384,30 @@ void nmethod::add_exception_cache_entry(ExceptionCache* new_entry) {
set_exception_cache(new_entry); set_exception_cache(new_entry);
} }
void nmethod::remove_from_exception_cache(ExceptionCache* ec) { void nmethod::clean_exception_cache(BoolObjectClosure* is_alive) {
ExceptionCache* prev = NULL; ExceptionCache* prev = NULL;
ExceptionCache* curr = exception_cache(); ExceptionCache* curr = exception_cache();
assert(curr != NULL, "nothing to remove");
// find the previous and next entry of ec while (curr != NULL) {
while (curr != ec) { ExceptionCache* next = curr->next();
prev = curr;
curr = curr->next(); Klass* ex_klass = curr->exception_type();
assert(curr != NULL, "ExceptionCache not found"); if (ex_klass != NULL && !ex_klass->is_loader_alive(is_alive)) {
} if (prev == NULL) {
// now: curr == ec set_exception_cache(next);
ExceptionCache* next = curr->next(); } else {
if (prev == NULL) { prev->set_next(next);
set_exception_cache(next); }
} else { delete curr;
prev->set_next(next); // prev stays the same.
} else {
prev = curr;
}
curr = next;
} }
delete curr;
} }
// public method for accessing the exception cache // public method for accessing the exception cache
// These are the public access methods. // These are the public access methods.
address nmethod::handler_for_exception_and_pc(Handle exception, address pc) { address nmethod::handler_for_exception_and_pc(Handle exception, address pc) {
...@@ -1650,15 +1653,7 @@ void nmethod::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred) ...@@ -1650,15 +1653,7 @@ void nmethod::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred)
} }
// Exception cache // Exception cache
ExceptionCache* ec = exception_cache(); clean_exception_cache(is_alive);
while (ec != NULL) {
Klass* ex_klass = ec->exception_type();
ExceptionCache* next_ec = ec->next();
if (ex_klass != NULL && !ex_klass->is_loader_alive(is_alive)) {
remove_from_exception_cache(ec);
}
ec = next_ec;
}
// If class unloading occurred we first iterate over all inline caches and // If class unloading occurred we first iterate over all inline caches and
// clear ICs where the cached oop is referring to an unloaded klass or method. // clear ICs where the cached oop is referring to an unloaded klass or method.
......
...@@ -534,7 +534,7 @@ public: ...@@ -534,7 +534,7 @@ public:
void set_exception_cache(ExceptionCache *ec) { _exception_cache = ec; } void set_exception_cache(ExceptionCache *ec) { _exception_cache = ec; }
address handler_for_exception_and_pc(Handle exception, address pc); address handler_for_exception_and_pc(Handle exception, address pc);
void add_handler_for_exception_and_pc(Handle exception, address pc, address handler); void add_handler_for_exception_and_pc(Handle exception, address pc, address handler);
void remove_from_exception_cache(ExceptionCache* ec); void clean_exception_cache(BoolObjectClosure* is_alive);
// implicit exceptions support // implicit exceptions support
address continuation_for_implicit_exception(address pc); address continuation_for_implicit_exception(address pc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册