8236224: Obsolete the FieldsAllocationStyle and CompactFields options

Remove the options and code for options deprecated in JDK 14

Reviewed-by: dholmes, hseigel, fparain
This commit is contained in:
Coleen Phillimore 2020-01-07 13:11:35 -05:00
parent ee5729ac21
commit c4b8e38de4
9 changed files with 23 additions and 85 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -4129,25 +4129,14 @@ void ClassFileParser::layout_fields(ConstantPool* cp,
int first_nonstatic_oop_offset = 0; // will be set for first oop field
bool compact_fields = CompactFields;
int allocation_style = FieldsAllocationStyle;
if( allocation_style < 0 || allocation_style > 2 ) { // Out of range?
assert(false, "0 <= FieldsAllocationStyle <= 2");
allocation_style = 1; // Optimistic
}
bool compact_fields = true;
bool allocate_oops_first = false;
// The next classes have predefined hard-coded fields offsets
// (see in JavaClasses::compute_hard_coded_offsets()).
// Use default fields allocation order for them.
if( (allocation_style != 0 || compact_fields ) && _loader_data->class_loader() == NULL &&
(_class_name == vmSymbols::java_lang_AssertionStatusDirectives() ||
_class_name == vmSymbols::java_lang_Class() ||
_class_name == vmSymbols::java_lang_ClassLoader() ||
_class_name == vmSymbols::java_lang_ref_Reference() ||
_class_name == vmSymbols::java_lang_ref_SoftReference() ||
_class_name == vmSymbols::java_lang_StackTraceElement() ||
_class_name == vmSymbols::java_lang_String() ||
_class_name == vmSymbols::java_lang_Throwable() ||
if (_loader_data->class_loader() == NULL &&
(_class_name == vmSymbols::java_lang_ref_Reference() ||
_class_name == vmSymbols::java_lang_Boolean() ||
_class_name == vmSymbols::java_lang_Character() ||
_class_name == vmSymbols::java_lang_Float() ||
@ -4156,7 +4145,7 @@ void ClassFileParser::layout_fields(ConstantPool* cp,
_class_name == vmSymbols::java_lang_Short() ||
_class_name == vmSymbols::java_lang_Integer() ||
_class_name == vmSymbols::java_lang_Long())) {
allocation_style = 0; // Allocate oops first
allocate_oops_first = true; // Allocate oops first
compact_fields = false; // Don't compact fields
}
@ -4164,35 +4153,14 @@ void ClassFileParser::layout_fields(ConstantPool* cp,
int next_nonstatic_double_offset = 0;
// Rearrange fields for a given allocation style
if( allocation_style == 0 ) {
if (allocate_oops_first) {
// Fields order: oops, longs/doubles, ints, shorts/chars, bytes, padded fields
next_nonstatic_oop_offset = next_nonstatic_field_offset;
next_nonstatic_double_offset = next_nonstatic_oop_offset +
(nonstatic_oop_count * heapOopSize);
} else if( allocation_style == 1 ) {
} else {
// Fields order: longs/doubles, ints, shorts/chars, bytes, oops, padded fields
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 ) {
const unsigned int map_count = _super_klass->nonstatic_oop_map_count();
const OopMapBlock* const first_map = _super_klass->start_of_nonstatic_oop_maps();
const OopMapBlock* const last_map = first_map + map_count - 1;
const 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 {
ShouldNotReachHere();
}
int nonstatic_oop_space_count = 0;
@ -4236,7 +4204,7 @@ void ClassFileParser::layout_fields(ConstantPool* cp,
// Allocate oop field in the gap if there are no other fields for that.
nonstatic_oop_space_offset = offset;
if (length >= heapOopSize && nonstatic_oop_count > 0 &&
allocation_style != 0) { // when oop fields not first
!allocate_oops_first) { // when oop fields not first
nonstatic_oop_count -= 1;
nonstatic_oop_space_count = 1; // Only one will fit
length -= heapOopSize;
@ -4255,7 +4223,7 @@ void ClassFileParser::layout_fields(ConstantPool* cp,
nonstatic_byte_count;
// let oops jump before padding with this allocation style
if( allocation_style == 1 ) {
if (!allocate_oops_first) {
next_nonstatic_oop_offset = next_nonstatic_padded_offset;
if( nonstatic_oop_count > 0 ) {
next_nonstatic_oop_offset = align_up(next_nonstatic_oop_offset, heapOopSize);