# HG changeset patch # User never # Date 1298516956 28800 # Node ID d58c5dbf8c7bf587a584701ba166ec5bef61c452 # Parent 7ab03c61543623197d8d65bc7b2e1d2f3199fc70 7012072: CompileTheWorld causes incorrect class initialization Reviewed-by: kvn, twisti diff -r 7ab03c615436 -r d58c5dbf8c7b hotspot/src/share/vm/prims/unsafe.cpp --- a/hotspot/src/share/vm/prims/unsafe.cpp Wed Feb 23 12:28:23 2011 -0800 +++ b/hotspot/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");