Skip to content

Commit 5f35e9e

Browse files
committed
Minor style improvements.
1 parent d81bc5d commit 5f35e9e

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/ContinuationsFeature.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ public void afterRegistration(AfterRegistrationAccess access) {
5454
VMError.guarantee(JavaVersionUtil.JAVA_SPEC >= 19);
5555
ImageSingletons.add(VirtualThreads.class, new LoomVirtualThreads());
5656
} else if (JavaVersionUtil.JAVA_SPEC == 17) {
57+
ImageSingletons.add(VirtualThreads.class, new SubstrateVirtualThreads());
58+
} else {
5759
/*
58-
* GR-37518: ForkJoinPool on 11 syncs on a String which doesn't have its own monitor
60+
* GR-37518: on 11, ForkJoinPool syncs on a String which doesn't have its own monitor
5961
* field, and unparking a virtual thread in additionalMonitorsLock.unlock causes a
6062
* deadlock between carrier thread and virtual thread. 17 uses a ReentrantLock.
6163
*/
62-
ImageSingletons.add(VirtualThreads.class, new SubstrateVirtualThreads());
63-
} else {
6464
throw UserError.abort("Continuations are currently supported only on JDK 17 with option %s, or on JDK 19 with preview features enabled (-J--enable-preview).",
6565
SubstrateOptionsParser.commandArgument(SubstrateOptions.SupportContinuations, "+"));
6666
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/LoomVirtualThreads.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private static StackTraceElement[] asyncGetStackTrace(Target_java_lang_VirtualTh
200200
return stackTrace;
201201
}
202202

203-
private static StackTraceElement[] asyncMountedGetStackTrace(@SuppressWarnings("unused") Target_java_lang_VirtualThread thread) {
203+
private static StackTraceElement[] asyncMountedGetStackTrace(Target_java_lang_VirtualThread thread) {
204204
return StackTraceUtils.asyncGetStackTrace(Thread.class.cast(thread));
205205
}
206206

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/PlatformThreads.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,12 @@
105105
* @see JavaThreads
106106
*/
107107
public abstract class PlatformThreads {
108-
private static final Field FIELDHOLDER_STATUS_FIELD = (!ImageInfo.inImageCode() || JavaVersionUtil.JAVA_SPEC < 19) ? null
109-
: ReflectionUtil.lookupField(Target_java_lang_Thread_FieldHolder.class, "threadStatus");
110-
private static final Field THREAD_STATUS_FIELD = (!ImageInfo.inImageCode() || JavaVersionUtil.JAVA_SPEC >= 19) ? null
111-
: ReflectionUtil.lookupField(Target_java_lang_Thread.class, "threadStatus");
108+
private static final Field FIELDHOLDER_STATUS_FIELD = (JavaVersionUtil.JAVA_SPEC >= 19 && ImageInfo.inImageCode())
109+
? ReflectionUtil.lookupField(Target_java_lang_Thread_FieldHolder.class, "threadStatus")
110+
: null;
111+
private static final Field THREAD_STATUS_FIELD = (JavaVersionUtil.JAVA_SPEC < 19 && ImageInfo.inImageCode())
112+
? ReflectionUtil.lookupField(Target_java_lang_Thread.class, "threadStatus")
113+
: null;
112114

113115
@Fold
114116
public static PlatformThreads singleton() {

0 commit comments

Comments
 (0)