RFR: 8343218: Add option to disable allocating interface and abstract classes in non-class metaspace
Yudi Zheng
yzheng at openjdk.org
Sun Aug 3 20:56:02 UTC 2025
On Thu, 31 Jul 2025 18:13:30 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
> This change introduces a diagnostic flag to disable the change to allocate interface and abstract Klass metadata in the non-class metaspace. Testing for JDK 25 has completed with this feature in place, but there may be cases where we should disable this. A future change will be to remove this code.
> Tested with tier1-4 with the flag off, and 1-4 with the flag on.
Could you please apply the following patch?
diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMetaspaceConstantImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMetaspaceConstantImpl.java
index 55d5492c2f8..fd08361f682 100644
--- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMetaspaceConstantImpl.java
+++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMetaspaceConstantImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, 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
@@ -95,7 +95,7 @@ public boolean isCompressible() {
}
private boolean canBeStoredInCompressibleMetaSpace() {
- if (metaspaceObject instanceof HotSpotResolvedJavaType t && !t.isArray()) {
+ if (!HotSpotVMConfig.config().useClassMetaspaceForAllClasses && metaspaceObject instanceof HotSpotResolvedJavaType t && !t.isArray()) {
// As of JDK-8338526, interface and abstract types are not stored
// in compressible metaspace.
return !t.isInterface() && !t.isAbstract();
diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotVMConfig.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotVMConfig.java
index bc2e121fe90..449b315e467 100644
--- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotVMConfig.java
+++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotVMConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2025, 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
@@ -67,6 +67,8 @@ static String getHostArchitectureName() {
final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class);
+ final boolean useClassMetaspaceForAllClasses = getFlag("UseClassMetaspaceForAllClasses", Boolean.class);
+
final int objectAlignment = getFlag("ObjectAlignmentInBytes", Integer.class);
final int klassOffsetInBytes = getFieldValue("CompilerToVM::Data::oopDesc_klass_offset_in_bytes", Integer.class, "int");
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26579#issuecomment-3148692596
More information about the hotspot-dev
mailing list