diff --git a/ci/common.jsonnet b/ci/common.jsonnet index 0929d471ca20..d48f4c2d8a9c 100644 --- a/ci/common.jsonnet +++ b/ci/common.jsonnet @@ -23,6 +23,9 @@ local common_json = import "../common.json"; } + { [name]: common_json.jdks[name] + { jdk_version:: 21 } for name in ["oraclejdk21"] + variants("labsjdk-ce-21") + variants("labsjdk-ee-21") + } + { + [name]: common_json.jdks[name] + { jdk_version:: 22 } + for name in ["oraclejdk22"] }, assert std.assertEqual(std.objectFields(common_json.jdks), std.objectFields(jdks_data)), @@ -58,6 +61,7 @@ local common_json = import "../common.json"; "windows-jdk19": { packages+: { "devkit:VS2022-17.1.0+1": "==0" }}, "windows-jdk20": { packages+: { "devkit:VS2022-17.1.0+1": "==0" }}, "windows-jdk21": { packages+: { "devkit:VS2022-17.1.0+1": "==1" }}, + "windows-jdk22": { packages+: { "devkit:VS2022-17.1.0+1": "==1" }}, "linux-jdk17": { packages+: { "devkit:gcc11.2.0-OL6.4+1": "==0" }}, "linux-jdk19": { packages+: { "devkit:gcc11.2.0-OL6.4+1": "==0" }}, "linux-jdk20": { packages+: { "devkit:gcc11.2.0-OL6.4+1": "==0" }}, diff --git a/common.json b/common.json index 0aefff7c68e6..ed95bb5fbb6c 100644 --- a/common.json +++ b/common.json @@ -40,8 +40,9 @@ "labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21+27-jvmci-23.1-b08-sulong", "platformspecific": true }, "labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21+27-jvmci-23.1-b08", "platformspecific": true }, "labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21+27-jvmci-23.1-b08-debug", "platformspecific": true }, - "labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21+27-jvmci-23.1-b08-sulong", "platformspecific": true } + "labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21+27-jvmci-23.1-b08-sulong", "platformspecific": true }, + "oraclejdk22": {"name": "jpg-jdk", "version": "22", "build_id": "1", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]} }, "eclipse": { diff --git a/compiler/mx.compiler/mx_compiler.py b/compiler/mx.compiler/mx_compiler.py index e87c640c398c..1f89925550bf 100644 --- a/compiler/mx.compiler/mx_compiler.py +++ b/compiler/mx.compiler/mx_compiler.py @@ -1172,7 +1172,7 @@ def java_base_unittest(args): # Remove GRAAL_MANAGEMENT from the module path as it # depends on the java.management module which is not in # the limited module set - base_modules = ['java.base', 'java.logging', 'jdk.internal.vm.ci', 'jdk.unsupported', 'jdk.compiler'] + base_modules = ['java.base', 'java.logging', 'jdk.internal.vm.ci', 'jdk.unsupported', 'jdk.compiler', 'java.instrument'] compiler_modules = [as_java_module(d, jdk).name for d in _graal_config().dists if d.name != 'GRAAL_MANAGEMENT'] root_module_names = base_modules + compiler_modules extra_args = ['--limit-modules=' + ','.join(root_module_names)] diff --git a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/replacements/classfile/Classfile.java b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/replacements/classfile/Classfile.java index 98f878eb98a6..7cf9b9edd471 100644 --- a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/replacements/classfile/Classfile.java +++ b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/replacements/classfile/Classfile.java @@ -49,7 +49,7 @@ public class Classfile { private final List codeAttributes; private static final int MAJOR_VERSION_JAVA_MIN = 51; // JDK7 - private static final int MAJOR_VERSION_JAVA_MAX = 65; // JDK21 + private static final int MAJOR_VERSION_JAVA_MAX = 66; // JDK22 private static final int MAGIC = 0xCAFEBABE; /** diff --git a/substratevm/mx.substratevm/mx_substratevm.py b/substratevm/mx.substratevm/mx_substratevm.py index f488336a1f8c..c7cbd590e35c 100644 --- a/substratevm/mx.substratevm/mx_substratevm.py +++ b/substratevm/mx.substratevm/mx_substratevm.py @@ -1719,8 +1719,9 @@ def compute_graal_compiler_flags_map(self): graal_compiler_flags_map['19-ea'] = graal_compiler_flags_map['19'] # Currently JDK 20 and JDK 19 have the same flags graal_compiler_flags_map['20'] = graal_compiler_flags_map['19'] - # Currently JDK 21 and JDK 20 have the same flags + # Currently JDK 22, JDK 21 and JDK 20 have the same flags graal_compiler_flags_map['21'] = graal_compiler_flags_map['20'] + graal_compiler_flags_map['22'] = graal_compiler_flags_map['21'] # DO NOT ADD ANY NEW ADD-OPENS OR ADD-EXPORTS HERE! # # Instead provide the correct requiresConcealed entries in the moduleInfo diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK21OrEarlier.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK21OrEarlier.java new file mode 100644 index 000000000000..92a235285958 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK21OrEarlier.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023, 2023, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package com.oracle.svm.core.jdk; + +import java.util.function.BooleanSupplier; + +import org.graalvm.compiler.serviceprovider.JavaVersionUtil; + +public class JDK21OrEarlier implements BooleanSupplier { + @Override + public boolean getAsBoolean() { + return JavaVersionUtil.JAVA_SPEC <= 21; + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK22OrLater.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK22OrLater.java new file mode 100644 index 000000000000..d3f7ef2311af --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK22OrLater.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023, 2023, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package com.oracle.svm.core.jdk; + +import java.util.function.BooleanSupplier; + +import org.graalvm.compiler.serviceprovider.JavaVersionUtil; + +public class JDK22OrLater implements BooleanSupplier { + @Override + public boolean getAsBoolean() { + return JavaVersionUtil.JAVA_SPEC >= 22; + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java index 7a4abda61bce..d5c78c08ccb5 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java @@ -32,6 +32,7 @@ import java.util.Objects; import java.util.concurrent.ThreadFactory; +import com.oracle.svm.core.jdk.JDK21OrEarlier; import org.graalvm.compiler.api.directives.GraalDirectives; import org.graalvm.compiler.replacements.ReplacementsUtil; import org.graalvm.compiler.serviceprovider.JavaVersionUtil; @@ -95,14 +96,16 @@ public final class Target_java_lang_Thread { @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) // volatile boolean interrupted; - @Inject @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) // + @Inject // + @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) // long parentThreadId; @Inject // @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) // public boolean jfrExcluded; - @Inject @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.NewInstance, declClass = ThreadData.class)// + @Inject // + @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.NewInstance, declClass = ThreadData.class)// UnacquiredThreadData threadData; @Alias// @@ -111,19 +114,23 @@ public final class Target_java_lang_Thread { @Alias// volatile String name; - @Alias @TargetElement(onlyWith = JDK17OrEarlier.class)// + @Alias // + @TargetElement(onlyWith = JDK17OrEarlier.class)// int priority; /* Whether or not the thread is a daemon . */ - @Alias @TargetElement(onlyWith = JDK17OrEarlier.class)// + @Alias // + @TargetElement(onlyWith = JDK17OrEarlier.class)// boolean daemon; /* What will be run. */ - @Alias @TargetElement(onlyWith = JDK17OrEarlier.class)// + @Alias // + @TargetElement(onlyWith = JDK17OrEarlier.class)// Runnable target; /* The group of this thread */ - @Alias @TargetElement(onlyWith = JDK17OrEarlier.class)// + @Alias // + @TargetElement(onlyWith = JDK17OrEarlier.class)// ThreadGroup group; @Alias// @@ -136,18 +143,22 @@ public final class Target_java_lang_Thread { * The requested stack size for this thread, or 0 if the creator did not specify a stack size. * It is up to the VM to do whatever it likes with this number; some VMs will ignore it. */ - @Alias @TargetElement(onlyWith = JDK17OrEarlier.class)// + @Alias // + @TargetElement(onlyWith = JDK17OrEarlier.class)// long stackSize; - @Alias @TargetElement(onlyWith = JDK19OrLater.class)// + @Alias // + @TargetElement(onlyWith = JDK19OrLater.class)// Target_java_lang_Thread_FieldHolder holder; /* Thread ID */ - @Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Custom, declClass = ThreadIdRecomputation.class) // + @Alias // + @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Custom, declClass = ThreadIdRecomputation.class) // public long tid; /** We have our own atomic number in {@link JavaThreads#threadSeqNumber}. */ - @Delete @TargetElement(onlyWith = JDK17OrEarlier.class)// + @Delete // + @TargetElement(onlyWith = JDK17OrEarlier.class)// static long threadSeqNumber; /** We have our own atomic number in {@link JavaThreads#threadInitNumber}. */ @Delete// @@ -158,34 +169,43 @@ public final class Target_java_lang_Thread { * For unstarted threads created during image generation like the main thread, we do not want to * inherit a (more or less random) access control context. */ - @Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) // + @Alias // + @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) // public AccessControlContext inheritedAccessControlContext; - @Alias @TargetElement(onlyWith = JDK17OrEarlier.class) // + @Alias // + @TargetElement(onlyWith = JDK17OrEarlier.class) // @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Custom, declClass = ThreadStatusRecomputation.class) // volatile int threadStatus; - @Alias @TargetElement(onlyWith = JDK17OrEarlier.class) // + @Alias // + @TargetElement(onlyWith = JDK17OrEarlier.class) // Object blockerLock; - @Alias @TargetElement(onlyWith = JDK19OrLater.class) // + @Alias // + @TargetElement(onlyWith = JDK19OrLater.class) // Object interruptLock; - @Alias @TargetElement(onlyWith = JDK17OrEarlier.class) // + @Alias // + @TargetElement(onlyWith = JDK17OrEarlier.class) // volatile Target_sun_nio_ch_Interruptible blocker; - @Alias @TargetElement(onlyWith = JDK19OrLater.class) // + @Alias // + @TargetElement(onlyWith = JDK19OrLater.class) // volatile Target_sun_nio_ch_Interruptible nioBlocker; /** @see JavaThreads#setCurrentThreadLockHelper */ - @Inject @TargetElement(onlyWith = ContinuationsSupported.class) // + @Inject // + @TargetElement(onlyWith = ContinuationsSupported.class) // @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) // Object lockHelper; - @Inject @TargetElement(onlyWith = JDK19OrLater.class) // + @Inject // + @TargetElement(onlyWith = JDK19OrLater.class) // @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) // Object[] scopedValueCache; - @Alias @TargetElement(onlyWith = JDK20OrLater.class) // + @Alias // + @TargetElement(onlyWith = JDK20OrLater.class) // Object scopedValueBindings; @Alias @@ -305,7 +325,8 @@ static Thread currentCarrierThread() { } /** On HotSpot, a field in C++ class {@code JavaThread}. Loads and stores are unordered. */ - @Inject @TargetElement(onlyWith = ContinuationsSupported.class)// + @Inject // + @TargetElement(onlyWith = ContinuationsSupported.class)// @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset)// Thread vthread = null; @@ -505,6 +526,7 @@ private void resume0() { } @Substitute + @TargetElement(onlyWith = JDK21OrEarlier.class) @SuppressWarnings({"static-method"}) private int countStackFrames() { throw VMError.unsupportedFeature("The deprecated method Thread.countStackFrames is not supported"); @@ -632,12 +654,13 @@ private static void clearInterruptEvent() { @TargetElement(onlyWith = JDK19OrLater.class) native void setInterrupt(); - @Alias + @Alias // @TargetElement(onlyWith = JDK19OrLater.class) native void clearInterrupt(); /** Carrier threads only: the current innermost continuation. */ - @Alias @TargetElement(onlyWith = LoomJDK.class) // + @Alias // + @TargetElement(onlyWith = LoomJDK.class) // Target_jdk_internal_vm_Continuation cont; @Alias @@ -788,7 +811,8 @@ interface Target_java_lang_Thread_Builder { @TargetClass(value = Thread.class, innerClass = "Constants", onlyWith = JDK19OrLater.class) final class Target_java_lang_Thread_Constants { // Checkstyle: stop - @SuppressWarnings("removal") @Alias static AccessControlContext NO_PERMISSIONS_ACC; + @SuppressWarnings("removal") // + @Alias static AccessControlContext NO_PERMISSIONS_ACC; @Alias // @TargetElement(onlyWith = JDK20OrEarlier.class) // diff --git a/vm/ci/ci_common/libgraal.jsonnet b/vm/ci/ci_common/libgraal.jsonnet index f60ddf91a0d1..c47509e513ce 100644 --- a/vm/ci/ci_common/libgraal.jsonnet +++ b/vm/ci/ci_common/libgraal.jsonnet @@ -75,6 +75,7 @@ local utils = import '../../../ci/ci_common/common-utils.libsonnet'; "gate-vm-libgraal_compiler_zgc-labsjdk-21-linux-amd64": {}, "gate-vm-libgraal_compiler_quickbuild-labsjdk-21-linux-amd64": {}, "gate-vm-libgraal_truffle_quickbuild-labsjdk-21-linux-amd64": t("1:10:00"), + "gate-vm-libgraal_compiler-oraclejdk-22-linux-amd64": {}, }, # See definition of `dailies` local variable in ../../compiler/ci_common/gate.jsonnet @@ -115,6 +116,7 @@ local utils = import '../../../ci/ci_common/common-utils.libsonnet'; vm["custom_vm_" + os(os_arch)] + g.make_build(jdk, os_arch, task, extra_tasks=self, suite="vm", include_common_os_arch=false, + jdk_name = if jdk == "22" then "oraclejdk" else "labsjdk", gates_manifest=gates, dailies_manifest=dailies, weeklies_manifest=weeklies, @@ -133,6 +135,28 @@ local utils = import '../../../ci/ci_common/common-utils.libsonnet'; ] ], + # Builds run on OracleJDK22 + local oraclejdk22_builds = [ + c["gate_vm_" + underscore(os_arch)] + + svm_common(os_arch, jdk) + + vm["custom_vm_" + os(os_arch)] + + g.make_build(jdk, os_arch, task, extra_tasks=self, suite="vm", + include_common_os_arch=false, + jdk_name="oraclejdk", + gates_manifest=gates, + dailies_manifest=dailies, + weeklies_manifest=weeklies, + monthlies_manifest=monthlies).build + + vm["vm_java_" + jdk] + for jdk in [ + "22" + ] + for os_arch in ["linux-amd64"] + for task in [ + "libgraal_compiler", + ] + ], + local adjust_windows_version(gate) = ( # replace 2016 with 2019 gate + { capabilities: [ if x == "windows_server_2016" then "windows_server_2019" else x for x in gate.capabilities ] } @@ -161,8 +185,8 @@ local utils = import '../../../ci/ci_common/common-utils.libsonnet'; ] ], - # Builds run on only on linux-amd64-jdk21 - local linux_amd64_jdk21_builds = [ + # Coverage builds only on jdk21 + local coverage_jdk21_builds = [ c["gate_vm_" + underscore(os_arch)] + svm_common(os_arch, jdk) + vm["custom_vm_" + os(os_arch)] + @@ -189,8 +213,9 @@ local utils = import '../../../ci/ci_common/common-utils.libsonnet'; # Complete set of builds defined in this file local all_builds = all_platforms_builds + + oraclejdk22_builds + all_platforms_zgc_builds + - linux_amd64_jdk21_builds, + coverage_jdk21_builds, builds: if g.check_manifest(gates, all_builds, std.thisFile, "gates").result diff --git a/vm/ci/ci_includes/vm.jsonnet b/vm/ci/ci_includes/vm.jsonnet index 0c17bfe29470..75be3eaad2d7 100644 --- a/vm/ci/ci_includes/vm.jsonnet +++ b/vm/ci/ci_includes/vm.jsonnet @@ -10,6 +10,7 @@ local graal_common = import '../../../ci/ci_common/common.jsonnet'; vm_java_17:: graal_common.labsjdk17 + vm_common.vm_env_mixin('17'), vm_java_20:: graal_common.labsjdk20 + vm_common.vm_env_mixin('20'), vm_java_21:: graal_common.labsjdk21 + vm_common.vm_env_mixin('21'), + vm_java_22:: graal_common.oraclejdk22 + vm_common.vm_env_mixin('22'), vm_java_17_llvm:: self.vm_java_17 + graal_common['labsjdk-ce-17-llvm'], vm_java_20_llvm:: self.vm_java_20 + graal_common['labsjdk-ce-20-llvm'],