提交 7795c7e7 编写于 作者: K kvn

6940733: allocate non static oop fields in super and sub classes together

Summary: Use FieldsAllocationStyle=2 to allocate non static oop fields in super and sub classes together
Reviewed-by: twisti
上级 2c9a6e9a
...@@ -2956,8 +2956,8 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name, ...@@ -2956,8 +2956,8 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
#endif #endif
bool compact_fields = CompactFields; bool compact_fields = CompactFields;
int allocation_style = FieldsAllocationStyle; int allocation_style = FieldsAllocationStyle;
if( allocation_style < 0 || allocation_style > 1 ) { // Out of range? if( allocation_style < 0 || allocation_style > 2 ) { // Out of range?
assert(false, "0 <= FieldsAllocationStyle <= 1"); assert(false, "0 <= FieldsAllocationStyle <= 2");
allocation_style = 1; // Optimistic allocation_style = 1; // Optimistic
} }
...@@ -2993,6 +2993,25 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name, ...@@ -2993,6 +2993,25 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
} else if( allocation_style == 1 ) { } else if( allocation_style == 1 ) {
// Fields order: longs/doubles, ints, shorts/chars, bytes, oops // Fields order: longs/doubles, ints, shorts/chars, bytes, oops
next_nonstatic_double_offset = next_nonstatic_field_offset; next_nonstatic_double_offset = next_nonstatic_field_offset;
} else if( allocation_style == 2 ) {
// Fields allocation: oops fields in super and sub classes are together.
if( nonstatic_field_size > 0 && super_klass() != NULL &&
super_klass->nonstatic_oop_map_size() > 0 ) {
int map_size = super_klass->nonstatic_oop_map_size();
OopMapBlock* first_map = super_klass->start_of_nonstatic_oop_maps();
OopMapBlock* last_map = first_map + map_size - 1;
int next_offset = last_map->offset() + (last_map->count() * heapOopSize);
if (next_offset == next_nonstatic_field_offset) {
allocation_style = 0; // allocate oops first
next_nonstatic_oop_offset = next_nonstatic_field_offset;
next_nonstatic_double_offset = next_nonstatic_oop_offset +
(nonstatic_oop_count * heapOopSize);
}
}
if( allocation_style == 2 ) {
allocation_style = 1; // allocate oops last
next_nonstatic_double_offset = next_nonstatic_field_offset;
}
} else { } else {
ShouldNotReachHere(); ShouldNotReachHere();
} }
......
...@@ -1052,7 +1052,8 @@ class CommandLineFlags { ...@@ -1052,7 +1052,8 @@ class CommandLineFlags {
"Use SSE2 MOVDQU instruction for Arraycopy") \ "Use SSE2 MOVDQU instruction for Arraycopy") \
\ \
product(intx, FieldsAllocationStyle, 1, \ product(intx, FieldsAllocationStyle, 1, \
"0 - type based with oops first, 1 - with oops last") \ "0 - type based with oops first, 1 - with oops last, " \
"2 - oops in super and sub classes are together") \
\ \
product(bool, CompactFields, true, \ product(bool, CompactFields, true, \
"Allocate nonstatic fields in gaps between previous fields") \ "Allocate nonstatic fields in gaps between previous fields") \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册