--- old/hotspot/src/share/vm/classfile/classFileParser.cpp 2013-05-21 15:26:52.716627808 +0400 +++ new/hotspot/src/share/vm/classfile/classFileParser.cpp 2013-05-21 15:26:52.608627805 +0400 @@ -3182,6 +3182,10 @@ next_nonstatic_field_offset += ContendedPaddingWidth; } + unsigned int nonstatic_fields_count = fac->count[NONSTATIC_DOUBLE] + fac->count[NONSTATIC_WORD] + + fac->count[NONSTATIC_SHORT] + fac->count[NONSTATIC_BYTE] + + fac->count[NONSTATIC_OOP]; + // Compute the non-contended fields count 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]; @@ -3191,10 +3195,7 @@ bool super_has_nonstatic_fields = (_super_klass() != NULL && _super_klass->has_nonstatic_fields()); - bool has_nonstatic_fields = super_has_nonstatic_fields || - ((nonstatic_double_count + nonstatic_word_count + - nonstatic_short_count + nonstatic_byte_count + - nonstatic_oop_count) != 0); + bool has_nonstatic_fields = super_has_nonstatic_fields || (nonstatic_fields_count != 0); // Prepare list of oops for oop map generation. @@ -3579,6 +3580,10 @@ (instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize), wordSize) / wordSize), "consistent layout helper value"); + assert(nonstatic_field_size == 0 || parsed_annotations->is_contended() + || (nonstatic_field_size > 0 && has_nonstatic_fields), + "consistent has_nonstatic_fields for non-contended class"); + // Number of non-static oop map blocks allocated at end of klass. const unsigned int total_oop_map_count = compute_oop_map_count(_super_klass, nonstatic_oop_map_count,