hotspot/src/share/vm/classfile/classFileParser.cpp
Print this page
*** 3180,3202 ****
// Class is contended, pad before all the fields
if (parsed_annotations->is_contended()) {
next_nonstatic_field_offset += ContendedPaddingWidth;
}
// 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];
unsigned int nonstatic_short_count = fac->count[NONSTATIC_SHORT] - fac_contended.count[NONSTATIC_SHORT];
unsigned int nonstatic_byte_count = fac->count[NONSTATIC_BYTE] - fac_contended.count[NONSTATIC_BYTE];
unsigned int nonstatic_oop_count = fac->count[NONSTATIC_OOP] - fac_contended.count[NONSTATIC_OOP];
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);
// Prepare list of oops for oop map generation.
int* nonstatic_oop_offsets;
unsigned int* nonstatic_oop_counts;
--- 3180,3203 ----
// Class is contended, pad before all the fields
if (parsed_annotations->is_contended()) {
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];
unsigned int nonstatic_short_count = fac->count[NONSTATIC_SHORT] - fac_contended.count[NONSTATIC_SHORT];
unsigned int nonstatic_byte_count = fac->count[NONSTATIC_BYTE] - fac_contended.count[NONSTATIC_BYTE];
unsigned int nonstatic_oop_count = fac->count[NONSTATIC_OOP] - fac_contended.count[NONSTATIC_OOP];
bool super_has_nonstatic_fields =
(_super_klass() != NULL && _super_klass->has_nonstatic_fields());
! bool has_nonstatic_fields = super_has_nonstatic_fields || (nonstatic_fields_count != 0);
// Prepare list of oops for oop map generation.
int* nonstatic_oop_offsets;
unsigned int* nonstatic_oop_counts;
*** 3577,3586 ****
--- 3578,3593 ----
assert(instance_size == align_object_size(align_size_up(
(instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize),
wordSize) / wordSize), "consistent layout helper value");
+ // Invariant: has_nostatic_fields can only be true if we do indeed have
+ // the nonstatic fields. Contended class may include the padding without
+ // the fields, and so exempt from this check.
+ assert(nonstatic_field_size == 0 || parsed_annotations->is_contended() || 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,
first_nonstatic_oop_offset);