--- a/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp Fri May 24 09:23:58 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp Wed May 22 21:24:09 2019 -0400
@@ -120,15 +120,14 @@
}
};
-ShenandoahCodeRoots::PaddedLock ShenandoahCodeRoots::_recorded_nms_lock;
GrowableArray<ShenandoahNMethod*>* ShenandoahCodeRoots::_recorded_nms;
void ShenandoahCodeRoots::initialize() {
- _recorded_nms_lock._lock = 0;
_recorded_nms = new (ResourceObj::C_HEAP, mtGC) GrowableArray<ShenandoahNMethod*>(100, true, mtGC);
}
void ShenandoahCodeRoots::add_nmethod(nmethod* nm) {
+ assert(CodeCache_lock->owned_by_self(), "Must own CodeCache_lock");
switch (ShenandoahCodeRootsStyle) {
case 0:
case 1:
@@ -140,9 +139,6 @@
if (detector.has_oops()) {
ShenandoahNMethod* nmr = new ShenandoahNMethod(nm, detector.oops());
nmr->assert_alive_and_correct();
-
- ShenandoahCodeRootsLock lock(true);
-
int idx = _recorded_nms->find(nm, ShenandoahNMethod::find_with_nmethod);
if (idx != -1) {
ShenandoahNMethod* old = _recorded_nms->at(idx);
@@ -160,6 +156,7 @@
};
void ShenandoahCodeRoots::remove_nmethod(nmethod* nm) {
+ assert(CodeCache_lock->owned_by_self(), "Must own CodeCache_lock");
switch (ShenandoahCodeRootsStyle) {
case 0:
case 1: {
@@ -170,8 +167,6 @@
nm->oops_do(&detector, /* allow_zombie = */ true);
if (detector.has_oops()) {
- ShenandoahCodeRootsLock lock(true);
-
int idx = _recorded_nms->find(nm, ShenandoahNMethod::find_with_nmethod);
assert(idx != -1, "nmethod " PTR_FORMAT " should be registered", p2i(nm));
ShenandoahNMethod* old = _recorded_nms->at(idx);
@@ -199,7 +194,7 @@
break;
}
case 2: {
- ShenandoahCodeRoots::acquire_lock(false);
+ CodeCache_lock->lock();
break;
}
default:
@@ -215,7 +210,7 @@
break;
}
case 2: {
- ShenandoahCodeRoots::release_lock(false);
+ CodeCache_lock->unlock();
break;
}
default: