changeset 4946:1eeac0ff163c

8013945: CMS fatal error: must own lock MemberNameTable_lock Summary: The "delete mnt" needs to grab MemberNameTable_lock if !SafepointSynchronize::is_at_safepoint() Reviewed-by: sla, mgerdin, dholmes, jmasa, twisti Contributed-by: serguei.spitsyn@oracle.com
author sspitsyn
date Fri, 07 Feb 2014 16:11:17 -0800
parents 347c7e0686dd
children 079356ec5392
files src/share/vm/oops/instanceKlass.cpp
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/oops/instanceKlass.cpp	Fri Feb 07 16:10:06 2014 -0800
+++ b/src/share/vm/oops/instanceKlass.cpp	Fri Feb 07 16:11:17 2014 -0800
@@ -1901,10 +1901,15 @@
     FreeHeap(jmeths);
   }
 
-  MemberNameTable* mnt = member_names();
-  if (mnt != NULL) {
-    delete mnt;
-    set_member_names(NULL);
+  // Deallocate MemberNameTable
+  {
+    Mutex* lock_or_null = SafepointSynchronize::is_at_safepoint() ? NULL : MemberNameTable_lock;
+    MutexLockerEx ml(lock_or_null, Mutex::_no_safepoint_check_flag);
+    MemberNameTable* mnt = member_names();
+    if (mnt != NULL) {
+      delete mnt;
+      set_member_names(NULL);
+    }
   }
 
   int* indices = methods_cached_itable_indices_acquire();