8330699: Obsolete -XX:+UseEmptySlotsInSupers
Reviewed-by: shade, fparain, dholmes
This commit is contained in:
parent
187710e1c1
commit
4b4a483b6f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2024, 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
|
||||
@ -137,7 +137,7 @@ void FieldLayout::initialize_instance_layout(const InstanceKlass* super_klass) {
|
||||
} else {
|
||||
bool has_fields = reconstruct_layout(super_klass);
|
||||
fill_holes(super_klass);
|
||||
if ((UseEmptySlotsInSupers && !super_klass->has_contended_annotations()) || !has_fields) {
|
||||
if (!super_klass->has_contended_annotations() || !has_fields) {
|
||||
_start = _blocks; // start allocating fields from the first empty block
|
||||
} else {
|
||||
_start = _last; // append fields at the end of the reconstructed layout
|
||||
@ -364,20 +364,6 @@ void FieldLayout::fill_holes(const InstanceKlass* super_klass) {
|
||||
b = p;
|
||||
}
|
||||
|
||||
if (!UseEmptySlotsInSupers) {
|
||||
// Add an empty slots to align fields of the subclass on a heapOopSize boundary
|
||||
// in order to emulate the behavior of the previous algorithm
|
||||
int align = (b->offset() + b->size()) % heapOopSize;
|
||||
if (align != 0) {
|
||||
int sz = heapOopSize - align;
|
||||
LayoutRawBlock* p = new LayoutRawBlock(LayoutRawBlock::EMPTY, sz);
|
||||
p->set_offset(b->offset() + b->size());
|
||||
b->set_next_block(p);
|
||||
p->set_prev_block(b);
|
||||
b = p;
|
||||
}
|
||||
}
|
||||
|
||||
LayoutRawBlock* last = new LayoutRawBlock(LayoutRawBlock::EMPTY, INT_MAX);
|
||||
last->set_offset(b->offset() + b->size());
|
||||
assert(last->offset() > 0, "Sanity check");
|
||||
|
@ -505,7 +505,6 @@ static SpecialFlag const special_jvm_flags[] = {
|
||||
{ "DontYieldALot", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
|
||||
{ "PreserveAllAnnotations", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
|
||||
{ "UseNotificationThread", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
|
||||
{ "UseEmptySlotsInSupers", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
|
||||
// --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
|
||||
{ "CreateMinidumpOnCrash", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
|
||||
|
||||
@ -513,6 +512,7 @@ static SpecialFlag const special_jvm_flags[] = {
|
||||
|
||||
{ "MetaspaceReclaimPolicy", JDK_Version::undefined(), JDK_Version::jdk(21), JDK_Version::undefined() },
|
||||
|
||||
{ "UseEmptySlotsInSupers", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
|
||||
{ "OldSize", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
|
||||
#if defined(X86)
|
||||
{ "UseRTMLocking", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
|
||||
|
@ -1948,10 +1948,6 @@ const int ObjectAlignmentInBytes = 8;
|
||||
product(bool, UseFastUnorderedTimeStamps, false, EXPERIMENTAL, \
|
||||
"Use platform unstable time where supported for timestamps only") \
|
||||
\
|
||||
product(bool, UseEmptySlotsInSupers, true, \
|
||||
"(Deprecated) Allow allocating fields in empty slots of " \
|
||||
"super-classes") \
|
||||
\
|
||||
product(bool, DeoptimizeNMethodBarriersALot, false, DIAGNOSTIC, \
|
||||
"Make nmethod barriers deoptimise a lot.") \
|
||||
\
|
||||
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8239014
|
||||
* @summary -XX:-UseEmptySlotsInSupers sometime fails to reproduce the layout of the old code
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
* @requires vm.bits == "64" & vm.opt.final.UseCompressedOops == true & vm.gc != "Z"
|
||||
* @run main/othervm -XX:+UseCompressedClassPointers -XX:-UseEmptySlotsInSupers OldLayoutCheck
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.bits == "32"
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
* @run main/othervm -XX:-UseEmptySlotsInSupers OldLayoutCheck
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.Platform;
|
||||
|
||||
public class OldLayoutCheck {
|
||||
|
||||
static class LIClass {
|
||||
public long l;
|
||||
public int i;
|
||||
}
|
||||
|
||||
// 32-bit VMs: @0: 8 byte header, @8: long field, @16: int field
|
||||
// 64-bit VMs: @0: 12 byte header, @12: int field, @16: long field
|
||||
static final long INT_OFFSET = Platform.is64bit() ? 12L : 16L;
|
||||
static final long LONG_OFFSET = Platform.is64bit() ? 16L : 8L;
|
||||
|
||||
static public void main(String[] args) {
|
||||
Unsafe unsafe = Unsafe.getUnsafe();
|
||||
Class c = LIClass.class;
|
||||
Field[] fields = c.getFields();
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
long offset = unsafe.objectFieldOffset(fields[i]);
|
||||
if (fields[i].getType() == int.class) {
|
||||
Asserts.assertEquals(offset, INT_OFFSET, "Misplaced int field");
|
||||
} else if (fields[i].getType() == long.class) {
|
||||
Asserts.assertEquals(offset, LONG_OFFSET, "Misplaced long field");
|
||||
} else {
|
||||
Asserts.fail("Unexpected field type");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user