Skip to content

Commit 802c40d

Browse files
OracleLabsAutomationzapster
authored andcommitted
[GR-49852] [GR-49613] Update JVMCI to 22+22-jvmci-b01.
PullRequest: graal/15994
2 parents c36cabf + 1446b09 commit 802c40d

File tree

5 files changed

+55
-16
lines changed

5 files changed

+55
-16
lines changed

common.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@
4242
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b22-debug", "platformspecific": true },
4343
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b22-sulong", "platformspecific": true },
4444

45-
"oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "20", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
46-
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+20-jvmci-b02", "platformspecific": true },
47-
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+20-jvmci-b02-debug", "platformspecific": true },
48-
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+20-jvmci-b02-sulong", "platformspecific": true },
49-
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+20-jvmci-b02", "platformspecific": true },
50-
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+20-jvmci-b02-debug", "platformspecific": true },
51-
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+20-jvmci-b02-sulong", "platformspecific": true }
45+
"oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "22", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
46+
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+22-jvmci-b01", "platformspecific": true },
47+
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+22-jvmci-b01-debug", "platformspecific": true },
48+
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+22-jvmci-b01-sulong", "platformspecific": true },
49+
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+22-jvmci-b01", "platformspecific": true },
50+
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+22-jvmci-b01-debug", "platformspecific": true },
51+
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+22-jvmci-b01-sulong", "platformspecific": true }
5252
},
5353

5454
"eclipse": {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/JVMCIVersionCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public final class JVMCIVersionCheck {
5454
private static final Map<String, Map<String, Version>> JVMCI_MIN_VERSIONS = Map.of(
5555
"21", Map.of(DEFAULT_VENDOR_ENTRY, new Version(23, 1, 22)),
5656
"22", Map.of(
57-
"Oracle Corporation", new Version("22+20", 2),
58-
DEFAULT_VENDOR_ENTRY, new Version("22+20", 2)));
57+
"Oracle Corporation", new Version("22+22", 1),
58+
DEFAULT_VENDOR_ENTRY, new Version("22+22", 1)));
5959
private static final int NA = 0;
6060
/**
6161
* Minimum Java release supported by Graal.

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/DeferredCommonPool.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
import java.util.concurrent.TimeUnit;
3636
import java.util.concurrent.TimeoutException;
3737

38+
import com.oracle.svm.core.util.VMError;
39+
import com.oracle.svm.util.ReflectionUtil;
40+
41+
import jdk.graal.compiler.serviceprovider.JavaVersionUtil;
42+
3843
/**
3944
* Pure delegate implementation to ForkJoinPool.commonPool().
4045
*/
@@ -79,9 +84,29 @@ public ForkJoinTask<?> submit(Runnable task) {
7984
return ForkJoinPool.commonPool().submit(task);
8085
}
8186

87+
@SuppressWarnings("unchecked")
88+
public <T> List<Future<T>> invokeAllUninterruptibly(Collection<? extends Callable<T>> tasks) {
89+
VMError.guarantee(JavaVersionUtil.JAVA_SPEC >= 22, "invokeAllUninterruptibly only exists in JDK 22+");
90+
var m = ReflectionUtil.lookupMethod(ForkJoinPool.class, "invokeAllUninterruptibly", Collection.class);
91+
try {
92+
return (List<Future<T>>) m.invoke(ForkJoinPool.commonPool(), tasks);
93+
} catch (ReflectiveOperationException e) {
94+
throw VMError.shouldNotReachHere(e);
95+
}
96+
}
97+
8298
@Override
8399
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) {
84-
return ForkJoinPool.commonPool().invokeAll(tasks);
100+
try {
101+
return ForkJoinPool.commonPool().invokeAll(tasks);
102+
} catch (Throwable ex) {
103+
throw rethrow(ex);
104+
}
105+
}
106+
107+
@SuppressWarnings({"unchecked"})
108+
private static <E extends Throwable> RuntimeException rethrow(Throwable ex) throws E {
109+
throw (E) ex;
85110
}
86111

87112
@Override

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/Target_jdk_jfr_internal_instrument_JDKEvents.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import com.oracle.svm.core.annotate.Alias;
2828
import com.oracle.svm.core.annotate.RecomputeFieldValue;
2929
import com.oracle.svm.core.annotate.TargetClass;
30+
import com.oracle.svm.core.annotate.TargetElement;
31+
import com.oracle.svm.core.jdk.JDK21OrEarlier;
3032

3133
import jdk.jfr.events.ActiveRecordingEvent;
3234
import jdk.jfr.events.ActiveSettingEvent;
@@ -42,5 +44,8 @@ final class Target_jdk_jfr_internal_instrument_JDKEvents {
4244
// This is a list of the classes with instrumentation code that should be applied.
4345
@Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias, isFinal = true) private static Class<?>[] instrumentationClasses = new Class<?>[]{};
4446

45-
@Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias, isFinal = true) private static Class<?>[] mirrorEventClasses = new Class<?>[]{};
47+
@Alias //
48+
@TargetElement(onlyWith = JDK21OrEarlier.class) //
49+
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias, isFinal = true) //
50+
private static Class<?>[] mirrorEventClasses = new Class<?>[]{};
4651
}

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jfr/JfrEventSubstitution.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import com.oracle.svm.core.util.VMError;
4444
import com.oracle.svm.util.ReflectionUtil;
4545

46+
import jdk.graal.compiler.serviceprovider.JavaVersionUtil;
4647
import jdk.internal.misc.Unsafe;
4748
import jdk.jfr.internal.JVM;
4849
import jdk.jfr.internal.SecuritySupport;
@@ -66,14 +67,20 @@ public class JfrEventSubstitution extends SubstitutionProcessor {
6667
private final ConcurrentHashMap<ResolvedJavaField, ResolvedJavaField> fieldSubstitutions;
6768
private final Map<String, Class<? extends jdk.jfr.Event>> mirrorEventMapping;
6869

70+
private static final Method registerMirror = JavaVersionUtil.JAVA_SPEC < 22 ? ReflectionUtil.lookupMethod(SecuritySupport.class, "registerMirror", Class.class) : null;
71+
6972
JfrEventSubstitution(MetaAccessProvider metaAccess) {
7073
baseEventType = metaAccess.lookupJavaType(jdk.internal.event.Event.class);
7174
ResolvedJavaType jdkJfrEventWriter = metaAccess.lookupJavaType(EventWriter.class);
7275
changeWriterResetMethod(jdkJfrEventWriter);
7376
typeSubstitution = new ConcurrentHashMap<>();
7477
methodSubstitutions = new ConcurrentHashMap<>();
7578
fieldSubstitutions = new ConcurrentHashMap<>();
76-
mirrorEventMapping = createMirrorEventsMapping();
79+
if (JavaVersionUtil.JAVA_SPEC < 22) {
80+
mirrorEventMapping = createMirrorEventsMapping();
81+
} else {
82+
mirrorEventMapping = null;
83+
}
7784
}
7885

7986
@Override
@@ -150,10 +157,12 @@ private Boolean initEventClass(ResolvedJavaType eventType) throws RuntimeExcepti
150157
Class<? extends jdk.internal.event.Event> newEventClass = OriginalClassProvider.getJavaClass(eventType).asSubclass(jdk.internal.event.Event.class);
151158
eventType.initialize();
152159

153-
// It is crucial that mirror events are registered before the actual events.
154-
Class<? extends jdk.jfr.Event> mirrorEventClass = mirrorEventMapping.get(newEventClass.getName());
155-
if (mirrorEventClass != null) {
156-
SecuritySupport.registerMirror(mirrorEventClass);
160+
if (JavaVersionUtil.JAVA_SPEC < 22) {
161+
// It is crucial that mirror events are registered before the actual events.
162+
Class<? extends jdk.jfr.Event> mirrorEventClass = mirrorEventMapping.get(newEventClass.getName());
163+
if (mirrorEventClass != null) {
164+
registerMirror.invoke(null, mirrorEventClass);
165+
}
157166
}
158167

159168
SecuritySupport.registerEvent(newEventClass);

0 commit comments

Comments
 (0)