Skip to content

Commit e70a824

Browse files
committed
[GR-40931] Native Image lets us build with VirtualThread + Truffle now
* It just resorts to a platform thread per VirtualThread in that case.
1 parent a88a02b commit e70a824

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/main/java/org/truffleruby/core/thread/ThreadManager.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import com.oracle.truffle.api.CompilerDirectives;
2626
import com.oracle.truffle.api.CompilerDirectives.ValueType;
2727
import com.oracle.truffle.api.TruffleContext;
28-
import com.oracle.truffle.api.TruffleOptions;
2928
import com.oracle.truffle.api.TruffleSafepoint;
3029
import com.oracle.truffle.api.TruffleSafepoint.Interrupter;
3130
import com.oracle.truffle.api.TruffleSafepoint.InterruptibleFunction;
@@ -144,10 +143,6 @@ public void restartMainThread(Thread mainJavaThread) {
144143
}
145144

146145
private static ThreadFactory getVirtualThreadFactory() {
147-
if (TruffleOptions.AOT) {
148-
return null; // GR-40931 native image does not support deoptimization + VirtualThread currently.
149-
}
150-
151146
final Method ofVirtual, unstarted;
152147
try {
153148
ofVirtual = Thread.class.getMethod("ofVirtual");
@@ -166,7 +161,7 @@ private static ThreadFactory getVirtualThreadFactory() {
166161
};
167162
}
168163

169-
@CompilationFinal static ThreadFactory VIRTUAL_THREAD_FACTORY = getVirtualThreadFactory();
164+
static final ThreadFactory VIRTUAL_THREAD_FACTORY = getVirtualThreadFactory();
170165

171166
public Thread createFiberJavaThread(RubyFiber fiber, SourceSection sourceSection, Runnable beforeEnter,
172167
Runnable body, Runnable afterLeave, Node node) {

0 commit comments

Comments
 (0)