src/share/vm/classfile/classFileParser.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/classfile/classFileParser.cpp Mon May 19 21:13:15 2008
--- new/src/share/vm/classfile/classFileParser.cpp Mon May 19 21:13:14 2008
*** 2662,2673 ****
--- 2662,2673 ----
(fac.static_short_count * BytesPerShort);
next_static_type_offset = align_size_up((next_static_byte_offset +
fac.static_byte_count ), wordSize );
static_field_size = (next_static_type_offset -
next_static_oop_offset) / wordSize;
! first_nonstatic_field_offset = (instanceOopDesc::header_size() +
! nonstatic_field_size) * wordSize;
! first_nonstatic_field_offset = instanceOopDesc::base_offset_in_bytes() +
! nonstatic_field_size * heapOopSize;
next_nonstatic_field_offset = first_nonstatic_field_offset;
// Add fake fields for java.lang.Class instances (also see below)
if (class_name() == vmSymbols::java_lang_Class() && class_loader.is_null()) {
java_lang_Class_fix_pre(&methods, &fac, CHECK_(nullHandle));
*** 2732,2744 ****
--- 2732,2744 ----
next_nonstatic_short_offset = next_nonstatic_word_offset +
(nonstatic_word_count * BytesPerInt);
next_nonstatic_byte_offset = next_nonstatic_short_offset +
(nonstatic_short_count * BytesPerShort);
next_nonstatic_type_offset = align_size_up((next_nonstatic_byte_offset +
! nonstatic_byte_count ), wordSize );
! nonstatic_byte_count ), heapOopSize );
orig_nonstatic_field_size = nonstatic_field_size +
! ((next_nonstatic_type_offset - first_nonstatic_field_offset)/wordSize);
! ((next_nonstatic_type_offset - first_nonstatic_field_offset)/heapOopSize);
}
#endif
bool compact_fields = CompactFields;
int allocation_style = FieldsAllocationStyle;
if( allocation_style < 0 || allocation_style > 1 ) { // Out of range?
*** 2789,2810 ****
--- 2789,2800 ----
int nonstatic_oop_space_offset;
int nonstatic_word_space_offset;
int nonstatic_short_space_offset;
int nonstatic_byte_space_offset;
bool compact_into_header = (UseCompressedOops &&
allocation_style == 1 && compact_fields &&
!super_has_nonstatic_fields);
if( compact_into_header || nonstatic_double_count > 0 ) {
int offset;
// Pack something in with the header if no super klass has done so.
if (compact_into_header) {
offset = oopDesc::klass_gap_offset_in_bytes();
} else {
offset = next_nonstatic_double_offset;
}
+ if( nonstatic_double_count > 0 ) {
+ int offset = next_nonstatic_double_offset;
next_nonstatic_double_offset = align_size_up(offset, BytesPerLong);
if( compact_fields && offset != next_nonstatic_double_offset ) {
// Allocate available fields into the gap before double field.
int length = next_nonstatic_double_offset - offset;
assert(length == BytesPerInt, "");
*** 2828,2839 ****
--- 2818,2828 ----
nonstatic_byte_space_count += 1;
length -= 1;
}
// Allocate oop field in the gap if there are no other fields for that.
nonstatic_oop_space_offset = offset;
! if(!compact_into_header && length >= heapOopSize &&
nonstatic_oop_count > 0 &&
! if( length >= heapOopSize && nonstatic_oop_count > 0 &&
allocation_style != 0 ) { // when oop fields not first
nonstatic_oop_count -= 1;
nonstatic_oop_space_count = 1; // Only one will fit
length -= heapOopSize;
offset += heapOopSize;
*** 2852,2869 ****
--- 2841,2857 ----
if( allocation_style == 0 ) {
notaligned_offset = next_nonstatic_byte_offset + nonstatic_byte_count;
} else { // allocation_style == 1
next_nonstatic_oop_offset = next_nonstatic_byte_offset + nonstatic_byte_count;
if( nonstatic_oop_count > 0 ) {
notaligned_offset = next_nonstatic_oop_offset;
next_nonstatic_oop_offset = align_size_up(next_nonstatic_oop_offset, heapOopSize);
}
notaligned_offset = next_nonstatic_oop_offset + (nonstatic_oop_count * heapOopSize);
}
! next_nonstatic_type_offset = align_size_up(notaligned_offset, wordSize );
! next_nonstatic_type_offset = align_size_up(notaligned_offset, heapOopSize );
nonstatic_field_size = nonstatic_field_size + ((next_nonstatic_type_offset
! - first_nonstatic_field_offset)/wordSize);
! - first_nonstatic_field_offset)/heapOopSize);
// Iterate over fields again and compute correct offsets.
// The field allocation type was temporarily stored in the offset slot.
// oop fields are located before non-oop fields (static and non-static).
int len = fields->length();
*** 2960,2972 ****
--- 2948,2961 ----
}
// Size of instances
int instance_size;
+ next_nonstatic_type_offset = align_size_up(notaligned_offset, wordSize );
instance_size = align_object_size(next_nonstatic_type_offset / wordSize);
! assert(instance_size == align_object_size(instanceOopDesc::header_size() + nonstatic_field_size), "consistent layout helper value");
! assert(instance_size == align_object_size(align_size_up((instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize), wordSize) / wordSize), "consistent layout helper value");
// Size of non-static oop map blocks (in words) allocated at end of klass
int nonstatic_oop_map_size = compute_oop_map_size(super_klass, nonstatic_oop_map_count, first_nonstatic_oop_offset);
// Compute reference type
*** 3120,3136 ****
--- 3109,3127 ----
}
#ifndef PRODUCT
if( PrintCompactFieldsSavings ) {
if( nonstatic_field_size < orig_nonstatic_field_size ) {
! tty->print("[Saved %d of %3d words in %s]\n",
! orig_nonstatic_field_size - nonstatic_field_size,
! orig_nonstatic_field_size, this_klass->external_name());
! tty->print("[Saved %d of %d bytes in %s]\n",
! (orig_nonstatic_field_size - nonstatic_field_size)*heapOopSize,
! orig_nonstatic_field_size*heapOopSize,
+ this_klass->external_name());
} else if( nonstatic_field_size > orig_nonstatic_field_size ) {
! tty->print("[Wasted %d over %3d words in %s]\n",
! nonstatic_field_size - orig_nonstatic_field_size,
! orig_nonstatic_field_size, this_klass->external_name());
! tty->print("[Wasted %d over %d bytes in %s]\n",
! (nonstatic_field_size - orig_nonstatic_field_size)*heapOopSize,
! orig_nonstatic_field_size*heapOopSize,
+ this_klass->external_name());
}
}
#endif
// preserve result across HandleMark
src/share/vm/classfile/classFileParser.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File