8343132: Remove temporary transitions from Virtual thread implementation

Reviewed-by: dholmes, sspitsyn, pchilanomate
This commit is contained in:
Alan Bateman 2024-10-31 08:53:19 +00:00
parent 2f1ba5ef09
commit dee0982c60
16 changed files with 184 additions and 263 deletions

View file

@ -51,6 +51,7 @@ import java.util.Objects;
import java.util.function.Predicate;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.LockSupport;
import jdk.internal.access.JavaLangAccess;
import jdk.internal.access.JavaUtilConcurrentFJPAccess;
import jdk.internal.access.SharedSecrets;
import jdk.internal.misc.Unsafe;
@ -2632,7 +2633,7 @@ public class ForkJoinPool extends AbstractExecutorService {
private void poolSubmit(boolean signalIfEmpty, ForkJoinTask<?> task) {
Thread t; ForkJoinWorkerThread wt; WorkQueue q; boolean internal;
if (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) &&
if (((t = JLA.currentCarrierThread()) instanceof ForkJoinWorkerThread) &&
(wt = (ForkJoinWorkerThread)t).pool == this) {
internal = true;
q = wt.workQueue;
@ -2643,6 +2644,7 @@ public class ForkJoinPool extends AbstractExecutorService {
}
q.push(task, signalIfEmpty ? this : null, internal);
}
private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
/**
* Returns queue for an external submission, bypassing call to