diff src/share/vm/runtime/mutex.cpp @ 55:2a8eb116ebbe

6610420: Debug VM crashes during monitor lock rank checking Summary: Make SerializePage lock as raw lock and add name for mutex locks Reviewed-by: never, dice, dholmes
author xlu
date Tue, 05 Feb 2008 23:21:57 -0800
parents a61af66fc99e
children d1605aabd0a1
line wrap: on
line diff
--- a/src/share/vm/runtime/mutex.cpp	Thu Jan 31 14:56:50 2008 -0500
+++ b/src/share/vm/runtime/mutex.cpp	Tue Feb 05 23:21:57 2008 -0800
@@ -1119,10 +1119,15 @@
   assert ((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "") ;
 }
 
-void Monitor::ClearMonitor (Monitor * m) {
+void Monitor::ClearMonitor (Monitor * m, const char *name) {
   m->_owner             = NULL ;
   m->_snuck             = false ;
-  m->_name              = "UNKNOWN" ;
+  if (name == NULL) {
+    strcpy(m->_name, "UNKNOWN") ;
+  } else {
+    strncpy(m->_name, name, MONITOR_NAME_LEN - 1);
+    m->_name[MONITOR_NAME_LEN - 1] = '\0';
+  }
   m->_LockWord.FullWord = 0 ;
   m->_EntryList         = NULL ;
   m->_OnDeck            = NULL ;
@@ -1133,7 +1138,7 @@
 Monitor::Monitor() { ClearMonitor(this); }
 
 Monitor::Monitor (int Rank, const char * name, bool allow_vm_block) {
-  ClearMonitor (this) ;
+  ClearMonitor (this, name) ;
 #ifdef ASSERT
   _allow_vm_block  = allow_vm_block;
   _rank            = Rank ;
@@ -1145,7 +1150,7 @@
 }
 
 Mutex::Mutex (int Rank, const char * name, bool allow_vm_block) {
-  ClearMonitor ((Monitor *) this) ;
+  ClearMonitor ((Monitor *) this, name) ;
 #ifdef ASSERT
  _allow_vm_block   = allow_vm_block;
  _rank             = Rank ;