diff src/share/vm/classfile/classFileParser.cpp @ 10303:205dd30230e1

8012939: @Contended doesn't work correctly with inheritance Summary: Fix instance_size miscalculation. Reviewed-by: jrose, kvn
author shade
date Fri, 17 May 2013 01:43:48 +0400
parents a9270d9ecb13
children 50e9396d5257
line wrap: on
line diff
--- a/src/share/vm/classfile/classFileParser.cpp	Thu May 16 17:54:11 2013 +0200
+++ b/src/share/vm/classfile/classFileParser.cpp	Fri May 17 01:43:48 2013 +0400
@@ -3165,13 +3165,13 @@
   first_nonstatic_field_offset = instanceOopDesc::base_offset_in_bytes() +
                                  nonstatic_field_size * heapOopSize;
 
+  next_nonstatic_field_offset = first_nonstatic_field_offset;
+
   // class is contended, pad before all the fields
   if (parsed_annotations->is_contended()) {
-    first_nonstatic_field_offset += pad_size;
+    next_nonstatic_field_offset += pad_size;
   }
 
-  next_nonstatic_field_offset = first_nonstatic_field_offset;
-
   unsigned int nonstatic_double_count = fac->count[NONSTATIC_DOUBLE] - fac_contended.count[NONSTATIC_DOUBLE];
   unsigned int nonstatic_word_count   = fac->count[NONSTATIC_WORD]   - fac_contended.count[NONSTATIC_WORD];
   unsigned int nonstatic_short_count  = fac->count[NONSTATIC_SHORT]  - fac_contended.count[NONSTATIC_SHORT];
@@ -3562,7 +3562,7 @@
   int instance_size = align_object_size(next_nonstatic_type_offset / wordSize);
 
   assert(instance_size == align_object_size(align_size_up(
-         (instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize + ((parsed_annotations->is_contended()) ? pad_size : 0)),
+         (instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize),
           wordSize) / wordSize), "consistent layout helper value");
 
   // Number of non-static oop map blocks allocated at end of klass.