3188 FieldLayoutInfo* info, |
3188 FieldLayoutInfo* info, |
3189 TRAPS) { |
3189 TRAPS) { |
3190 |
3190 |
3191 // Field size and offset computation |
3191 // Field size and offset computation |
3192 int nonstatic_field_size = _super_klass() == NULL ? 0 : _super_klass()->nonstatic_field_size(); |
3192 int nonstatic_field_size = _super_klass() == NULL ? 0 : _super_klass()->nonstatic_field_size(); |
3193 int next_static_oop_offset; |
3193 int next_static_oop_offset = 0; |
3194 int next_static_double_offset; |
3194 int next_static_double_offset = 0; |
3195 int next_static_word_offset; |
3195 int next_static_word_offset = 0; |
3196 int next_static_short_offset; |
3196 int next_static_short_offset = 0; |
3197 int next_static_byte_offset; |
3197 int next_static_byte_offset = 0; |
3198 int next_nonstatic_oop_offset; |
3198 int next_nonstatic_oop_offset = 0; |
3199 int next_nonstatic_double_offset; |
3199 int next_nonstatic_double_offset = 0; |
3200 int next_nonstatic_word_offset; |
3200 int next_nonstatic_word_offset = 0; |
3201 int next_nonstatic_short_offset; |
3201 int next_nonstatic_short_offset = 0; |
3202 int next_nonstatic_byte_offset; |
3202 int next_nonstatic_byte_offset = 0; |
3203 int first_nonstatic_oop_offset; |
3203 int first_nonstatic_oop_offset = 0; |
3204 int next_nonstatic_field_offset; |
3204 int next_nonstatic_field_offset = 0; |
3205 int next_nonstatic_padded_offset; |
3205 int next_nonstatic_padded_offset = 0; |
3206 |
3206 |
3207 // Count the contended fields by type. |
3207 // Count the contended fields by type. |
3208 // |
3208 // |
3209 // We ignore static fields, because @Contended is not supported for them. |
3209 // We ignore static fields, because @Contended is not supported for them. |
3210 // The layout code below will also ignore the static fields. |
3210 // The layout code below will also ignore the static fields. |
3353 } |
3353 } |
3354 } else { |
3354 } else { |
3355 ShouldNotReachHere(); |
3355 ShouldNotReachHere(); |
3356 } |
3356 } |
3357 |
3357 |
3358 int nonstatic_oop_space_count = 0; |
3358 int nonstatic_oop_space_count = 0; |
3359 int nonstatic_word_space_count = 0; |
3359 int nonstatic_word_space_count = 0; |
3360 int nonstatic_short_space_count = 0; |
3360 int nonstatic_short_space_count = 0; |
3361 int nonstatic_byte_space_count = 0; |
3361 int nonstatic_byte_space_count = 0; |
3362 int nonstatic_oop_space_offset; |
3362 int nonstatic_oop_space_offset = 0; |
3363 int nonstatic_word_space_offset; |
3363 int nonstatic_word_space_offset = 0; |
3364 int nonstatic_short_space_offset; |
3364 int nonstatic_short_space_offset = 0; |
3365 int nonstatic_byte_space_offset; |
3365 int nonstatic_byte_space_offset = 0; |
3366 |
3366 |
3367 // Try to squeeze some of the fields into the gaps due to |
3367 // Try to squeeze some of the fields into the gaps due to |
3368 // long/double alignment. |
3368 // long/double alignment. |
3369 if( nonstatic_double_count > 0 ) { |
3369 if( nonstatic_double_count > 0 ) { |
3370 int offset = next_nonstatic_double_offset; |
3370 int offset = next_nonstatic_double_offset; |
3432 if (fs.is_offset_set()) continue; |
3432 if (fs.is_offset_set()) continue; |
3433 |
3433 |
3434 // contended instance fields are handled below |
3434 // contended instance fields are handled below |
3435 if (fs.is_contended() && !fs.access_flags().is_static()) continue; |
3435 if (fs.is_contended() && !fs.access_flags().is_static()) continue; |
3436 |
3436 |
3437 int real_offset; |
3437 int real_offset = 0; |
3438 FieldAllocationType atype = (FieldAllocationType) fs.allocation_type(); |
3438 FieldAllocationType atype = (FieldAllocationType) fs.allocation_type(); |
3439 |
3439 |
3440 // pack the rest of the fields |
3440 // pack the rest of the fields |
3441 switch (atype) { |
3441 switch (atype) { |
3442 case STATIC_OOP: |
3442 case STATIC_OOP: |
3565 if (!fs.is_contended() || (fs.contended_group() != current_group)) continue; |
3565 if (!fs.is_contended() || (fs.contended_group() != current_group)) continue; |
3566 |
3566 |
3567 // handle statics below |
3567 // handle statics below |
3568 if (fs.access_flags().is_static()) continue; |
3568 if (fs.access_flags().is_static()) continue; |
3569 |
3569 |
3570 int real_offset; |
3570 int real_offset = 0; |
3571 FieldAllocationType atype = (FieldAllocationType) fs.allocation_type(); |
3571 FieldAllocationType atype = (FieldAllocationType) fs.allocation_type(); |
3572 |
3572 |
3573 switch (atype) { |
3573 switch (atype) { |
3574 case NONSTATIC_BYTE: |
3574 case NONSTATIC_BYTE: |
3575 next_nonstatic_padded_offset = align_size_up(next_nonstatic_padded_offset, 1); |
3575 next_nonstatic_padded_offset = align_size_up(next_nonstatic_padded_offset, 1); |