8217309: ZGC: Fix ZNMethodTable corruption

Reviewed-by: eosterlund, stefank
This commit is contained in:
Per Lidén 2019-01-24 12:23:01 +01:00
parent 25bd20f5d9
commit ad65ea3c85
3 changed files with 14 additions and 20 deletions

View file

@ -1100,7 +1100,11 @@ void nmethod::make_unloaded() {
"must be at safepoint");
// Unregister must be done before the state change
Universe::heap()->unregister_nmethod(this);
{
MutexLockerEx ml(SafepointSynchronize::is_at_safepoint() ? NULL : CodeCache_lock,
Mutex::_no_safepoint_check_flag);
Universe::heap()->unregister_nmethod(this);
}
// Log the unloading.
log_state_change();