From 9ccd4c81c952c005884eb28dbf8ca508ccb0cc0d Mon Sep 17 00:00:00 2001 From: Yudi Zheng Date: Mon, 9 Dec 2024 14:09:24 +0100 Subject: [PATCH 1/2] Adapt JDK-8345687: Improve the implementation of SegmentFactories::allocateSegment --- .../core/jdk/Target_jdk_internal_misc_VM.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_misc_VM.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_misc_VM.java index ae7b5fee71f8..60175cfbcfe8 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_misc_VM.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_misc_VM.java @@ -35,6 +35,7 @@ import com.oracle.svm.core.annotate.RecomputeFieldValue.Kind; import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; +import com.oracle.svm.core.annotate.TargetElement; import com.oracle.svm.core.snippets.KnownIntrinsics; import jdk.internal.misc.Unsafe; @@ -68,7 +69,12 @@ public static ClassLoader latestUserDefinedLoader0() { @Alias @InjectAccessors(DirectMemoryAccessors.class) // private static long directMemory; @Alias @InjectAccessors(PageAlignDirectMemoryAccessors.class) // - private static boolean pageAlignDirectMemory; + @TargetElement(onlyWith = JDKLatest.class) // + private static Boolean pageAlignDirectMemory; + + @Alias @InjectAccessors(PageAlignDirectMemoryJDK21Accessors.class) // + @TargetElement(name = "pageAlignDirectMemory", onlyWith = JDK21OrEarlier.class) // + private static boolean pageAlignDirectMemoryJDK21; } final class DirectMemoryAccessors { @@ -125,7 +131,7 @@ final class PageAlignDirectMemoryAccessors { private static boolean initialized; private static boolean pageAlignDirectMemory; - static boolean getPageAlignDirectMemory() { + static Boolean getPageAlignDirectMemory() { if (!initialized) { initialize(); } @@ -140,3 +146,9 @@ private static void initialize() { initialized = true; } } + +final class PageAlignDirectMemoryJDK21Accessors { + static boolean getPageAlignDirectMemory() { + return PageAlignDirectMemoryAccessors.getPageAlignDirectMemory(); + } +} \ No newline at end of file From d9ee0a50adb38451f3a9fe81aeaf261b1730de87 Mon Sep 17 00:00:00 2001 From: Yudi Zheng Date: Mon, 9 Dec 2024 14:09:53 +0100 Subject: [PATCH 2/2] Update galahad jdk. --- common.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.json b/common.json index d2e86081a7ff..c5b69f6d5239 100644 --- a/common.json +++ b/common.json @@ -8,7 +8,7 @@ "COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet", "jdks": { - "galahad-jdk": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24+27-3513", "platformspecific": true, "extrabundles": ["static-libs"]}, + "galahad-jdk": {"name": "jpg-jdk", "version": "24", "build_id": "2024-12-09-1307270.yudi.zheng.jdk", "platformspecific": true, "extrabundles": ["static-libs"]}, "oraclejdk17": {"name": "jpg-jdk", "version": "17.0.7", "build_id": "jdk-17.0.7+8", "platformspecific": true, "extrabundles": ["static-libs"]}, "labsjdk-ce-17": {"name": "labsjdk", "version": "ce-17.0.7+4-jvmci-23.1-b02", "platformspecific": true },