Skip to content

Commit d560964

Browse files
committed
8252794: Creation of JNIMethodBlock should be done with a leaf lock
Reviewed-by: coleenp, dholmes
1 parent 5fef8dd commit d560964

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/hotspot/share/oops/method.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,9 +2185,9 @@ void Method::ensure_jmethod_ids(ClassLoaderData* loader_data, int capacity) {
21852185
ClassLoaderData* cld = loader_data;
21862186
if (!SafepointSynchronize::is_at_safepoint()) {
21872187
// Have to add jmethod_ids() to class loader data thread-safely.
2188-
// Also have to add the method to the list safely, which the cld lock
2188+
// Also have to add the method to the list safely, which the lock
21892189
// protects as well.
2190-
MutexLocker ml(cld->metaspace_lock(), Mutex::_no_safepoint_check_flag);
2190+
MutexLocker ml(JmethodIdCreation_lock, Mutex::_no_safepoint_check_flag);
21912191
if (cld->jmethod_ids() == NULL) {
21922192
cld->set_jmethod_ids(new JNIMethodBlock(capacity));
21932193
} else {
@@ -2209,9 +2209,9 @@ jmethodID Method::make_jmethod_id(ClassLoaderData* loader_data, Method* m) {
22092209

22102210
if (!SafepointSynchronize::is_at_safepoint()) {
22112211
// Have to add jmethod_ids() to class loader data thread-safely.
2212-
// Also have to add the method to the list safely, which the cld lock
2212+
// Also have to add the method to the list safely, which the lock
22132213
// protects as well.
2214-
MutexLocker ml(cld->metaspace_lock(), Mutex::_no_safepoint_check_flag);
2214+
MutexLocker ml(JmethodIdCreation_lock, Mutex::_no_safepoint_check_flag);
22152215
if (cld->jmethod_ids() == NULL) {
22162216
cld->set_jmethod_ids(new JNIMethodBlock());
22172217
}

src/hotspot/share/runtime/mutexLocker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ void mutex_init() {
253253
Notification_lock = Service_lock;
254254
}
255255

256-
def(JmethodIdCreation_lock , PaddedMutex , leaf, true, _safepoint_check_never); // used for creating jmethodIDs.
256+
def(JmethodIdCreation_lock , PaddedMutex , special-2, true, _safepoint_check_never); // used for creating jmethodIDs.
257257

258258
def(SystemDictionary_lock , PaddedMonitor, leaf, true, _safepoint_check_always);
259259
def(ProtectionDomainSet_lock , PaddedMutex , leaf-1, true, _safepoint_check_never);

0 commit comments

Comments
 (0)