changeset 2163:d411927672ed

7012072: CompileTheWorld causes incorrect class initialization Reviewed-by: kvn, twisti
author never
date Wed, 23 Feb 2011 19:09:16 -0800
parents ba5d119730dd
children 5a41a201d08c 6f3746e69a78
files src/share/vm/prims/unsafe.cpp
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/prims/unsafe.cpp	Wed Feb 23 12:28:23 2011 -0800
+++ b/src/share/vm/prims/unsafe.cpp	Wed Feb 23 19:09:16 2011 -0800
@@ -110,6 +110,8 @@
 
 inline void* index_oop_from_field_offset_long(oop p, jlong field_offset) {
   jlong byte_offset = field_offset_to_byte_offset(field_offset);
+  // Don't allow unsafe to be used to read or write the header word of oops
+  assert(p == NULL || field_offset >= oopDesc::header_size(), "offset must be outside of header");
 #ifdef ASSERT
   if (p != NULL) {
     assert(byte_offset >= 0 && byte_offset <= (jlong)MAX_OBJECT_SIZE, "sane offset");