diff --git a/common.json b/common.json index 1ae61620baaf..f2caa3fa5de4 100644 --- a/common.json +++ b/common.json @@ -42,13 +42,13 @@ "labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b22-debug", "platformspecific": true }, "labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b22-sulong", "platformspecific": true }, - "oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "20", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]}, - "labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+20-jvmci-b02", "platformspecific": true }, - "labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+20-jvmci-b02-debug", "platformspecific": true }, - "labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+20-jvmci-b02-sulong", "platformspecific": true }, - "labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+20-jvmci-b02", "platformspecific": true }, - "labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+20-jvmci-b02-debug", "platformspecific": true }, - "labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+20-jvmci-b02-sulong", "platformspecific": true } + "oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "22", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]}, + "labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+22-jvmci-b01", "platformspecific": true }, + "labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+22-jvmci-b01-debug", "platformspecific": true }, + "labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+22-jvmci-b01-sulong", "platformspecific": true }, + "labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+22-jvmci-b01", "platformspecific": true }, + "labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+22-jvmci-b01-debug", "platformspecific": true }, + "labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+22-jvmci-b01-sulong", "platformspecific": true } }, "eclipse": { diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/JVMCIVersionCheck.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/JVMCIVersionCheck.java index e8c1347e018c..2654c06e648f 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/JVMCIVersionCheck.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/JVMCIVersionCheck.java @@ -54,8 +54,8 @@ public final class JVMCIVersionCheck { private static final Map> JVMCI_MIN_VERSIONS = Map.of( "21", Map.of(DEFAULT_VENDOR_ENTRY, new Version(23, 1, 22)), "22", Map.of( - "Oracle Corporation", new Version("22+20", 2), - DEFAULT_VENDOR_ENTRY, new Version("22+20", 2))); + "Oracle Corporation", new Version("22+22", 1), + DEFAULT_VENDOR_ENTRY, new Version("22+22", 1))); private static final int NA = 0; /** * Minimum Java release supported by Graal. diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/DeferredCommonPool.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/DeferredCommonPool.java index 78f7424d2cae..ce32220a781b 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/DeferredCommonPool.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/DeferredCommonPool.java @@ -35,6 +35,11 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import com.oracle.svm.core.util.VMError; +import com.oracle.svm.util.ReflectionUtil; + +import jdk.graal.compiler.serviceprovider.JavaVersionUtil; + /** * Pure delegate implementation to ForkJoinPool.commonPool(). */ @@ -79,9 +84,29 @@ public ForkJoinTask submit(Runnable task) { return ForkJoinPool.commonPool().submit(task); } + @SuppressWarnings("unchecked") + public List> invokeAllUninterruptibly(Collection> tasks) { + VMError.guarantee(JavaVersionUtil.JAVA_SPEC >= 22, "invokeAllUninterruptibly only exists in JDK 22+"); + var m = ReflectionUtil.lookupMethod(ForkJoinPool.class, "invokeAllUninterruptibly", Collection.class); + try { + return (List>) m.invoke(ForkJoinPool.commonPool(), tasks); + } catch (ReflectiveOperationException e) { + throw VMError.shouldNotReachHere(e); + } + } + @Override public List> invokeAll(Collection> tasks) { - return ForkJoinPool.commonPool().invokeAll(tasks); + try { + return ForkJoinPool.commonPool().invokeAll(tasks); + } catch (Throwable ex) { + throw rethrow(ex); + } + } + + @SuppressWarnings({"unchecked"}) + private static RuntimeException rethrow(Throwable ex) throws E { + throw (E) ex; } @Override diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/Target_jdk_jfr_internal_instrument_JDKEvents.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/Target_jdk_jfr_internal_instrument_JDKEvents.java index 13386cd36bb8..a18d50e941c0 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/Target_jdk_jfr_internal_instrument_JDKEvents.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/Target_jdk_jfr_internal_instrument_JDKEvents.java @@ -27,6 +27,8 @@ import com.oracle.svm.core.annotate.Alias; import com.oracle.svm.core.annotate.RecomputeFieldValue; import com.oracle.svm.core.annotate.TargetClass; +import com.oracle.svm.core.annotate.TargetElement; +import com.oracle.svm.core.jdk.JDK21OrEarlier; import jdk.jfr.events.ActiveRecordingEvent; import jdk.jfr.events.ActiveSettingEvent; @@ -42,5 +44,8 @@ final class Target_jdk_jfr_internal_instrument_JDKEvents { // This is a list of the classes with instrumentation code that should be applied. @Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias, isFinal = true) private static Class[] instrumentationClasses = new Class[]{}; - @Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias, isFinal = true) private static Class[] mirrorEventClasses = new Class[]{}; + @Alias // + @TargetElement(onlyWith = JDK21OrEarlier.class) // + @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias, isFinal = true) // + private static Class[] mirrorEventClasses = new Class[]{}; } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jfr/JfrEventSubstitution.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jfr/JfrEventSubstitution.java index 3194e412a48f..01001920809e 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jfr/JfrEventSubstitution.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jfr/JfrEventSubstitution.java @@ -43,6 +43,7 @@ import com.oracle.svm.core.util.VMError; import com.oracle.svm.util.ReflectionUtil; +import jdk.graal.compiler.serviceprovider.JavaVersionUtil; import jdk.internal.misc.Unsafe; import jdk.jfr.internal.JVM; import jdk.jfr.internal.SecuritySupport; @@ -66,6 +67,8 @@ public class JfrEventSubstitution extends SubstitutionProcessor { private final ConcurrentHashMap fieldSubstitutions; private final Map> mirrorEventMapping; + private static final Method registerMirror = JavaVersionUtil.JAVA_SPEC < 22 ? ReflectionUtil.lookupMethod(SecuritySupport.class, "registerMirror", Class.class) : null; + JfrEventSubstitution(MetaAccessProvider metaAccess) { baseEventType = metaAccess.lookupJavaType(jdk.internal.event.Event.class); ResolvedJavaType jdkJfrEventWriter = metaAccess.lookupJavaType(EventWriter.class); @@ -73,7 +76,11 @@ public class JfrEventSubstitution extends SubstitutionProcessor { typeSubstitution = new ConcurrentHashMap<>(); methodSubstitutions = new ConcurrentHashMap<>(); fieldSubstitutions = new ConcurrentHashMap<>(); - mirrorEventMapping = createMirrorEventsMapping(); + if (JavaVersionUtil.JAVA_SPEC < 22) { + mirrorEventMapping = createMirrorEventsMapping(); + } else { + mirrorEventMapping = null; + } } @Override @@ -150,10 +157,12 @@ private Boolean initEventClass(ResolvedJavaType eventType) throws RuntimeExcepti Class newEventClass = OriginalClassProvider.getJavaClass(eventType).asSubclass(jdk.internal.event.Event.class); eventType.initialize(); - // It is crucial that mirror events are registered before the actual events. - Class mirrorEventClass = mirrorEventMapping.get(newEventClass.getName()); - if (mirrorEventClass != null) { - SecuritySupport.registerMirror(mirrorEventClass); + if (JavaVersionUtil.JAVA_SPEC < 22) { + // It is crucial that mirror events are registered before the actual events. + Class mirrorEventClass = mirrorEventMapping.get(newEventClass.getName()); + if (mirrorEventClass != null) { + registerMirror.invoke(null, mirrorEventClass); + } } SecuritySupport.registerEvent(newEventClass);