diff src/share/vm/prims/jvmtiImpl.cpp @ 612:afa80fa86d22

Merge
author dcubed
date Mon, 02 Mar 2009 14:43:36 -0700
parents 2f716c0acb64
children c18cbe5936b8
line wrap: on
line diff
--- a/src/share/vm/prims/jvmtiImpl.cpp	Sun Feb 22 17:21:13 2009 -0800
+++ b/src/share/vm/prims/jvmtiImpl.cpp	Mon Mar 02 14:43:36 2009 -0700
@@ -238,6 +238,35 @@
 }
 
 
+bool
+JvmtiRawMonitor::is_valid() {
+  int value = 0;
+
+  // This object might not be a JvmtiRawMonitor so we can't assume
+  // the _magic field is properly aligned. Get the value in a safe
+  // way and then check against JVMTI_RM_MAGIC.
+
+  switch (sizeof(_magic)) {
+  case 2:
+    value = Bytes::get_native_u2((address)&_magic);
+    break;
+
+  case 4:
+    value = Bytes::get_native_u4((address)&_magic);
+    break;
+
+  case 8:
+    value = Bytes::get_native_u8((address)&_magic);
+    break;
+
+  default:
+    guarantee(false, "_magic field is an unexpected size");
+  }
+
+  return value == JVMTI_RM_MAGIC;
+}
+
+
 //
 // class JvmtiBreakpoint
 //