8333716: Shenandoah: Check for disarmed method before taking the nmethod lock
Reviewed-by: shade, ysr, wkemper
This commit is contained in:
parent
c37d02aef3
commit
18e7d7b5e7
@ -36,13 +36,19 @@
|
|||||||
#include "runtime/threadWXSetters.inline.hpp"
|
#include "runtime/threadWXSetters.inline.hpp"
|
||||||
|
|
||||||
bool ShenandoahBarrierSetNMethod::nmethod_entry_barrier(nmethod* nm) {
|
bool ShenandoahBarrierSetNMethod::nmethod_entry_barrier(nmethod* nm) {
|
||||||
|
if (!is_armed(nm)) {
|
||||||
|
// Some other thread got here first and healed the oops
|
||||||
|
// and disarmed the nmethod. No need to continue.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
ShenandoahReentrantLock* lock = ShenandoahNMethod::lock_for_nmethod(nm);
|
ShenandoahReentrantLock* lock = ShenandoahNMethod::lock_for_nmethod(nm);
|
||||||
assert(lock != nullptr, "Must be");
|
assert(lock != nullptr, "Must be");
|
||||||
ShenandoahReentrantLocker locker(lock);
|
ShenandoahReentrantLocker locker(lock);
|
||||||
|
|
||||||
if (!is_armed(nm)) {
|
if (!is_armed(nm)) {
|
||||||
// Some other thread got here first and healed the oops
|
// Some other thread managed to complete while we were
|
||||||
// and disarmed the nmethod.
|
// waiting for lock. No need to continue.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user