Skip to content
Permalink
Browse files

Lightweight -> virtual thread

  • Loading branch information
AlanBateman committed Nov 16, 2019
1 parent 7d71fce commit 4516bf36d71cb14fa851d3aea5c59cbc2c96a52c
Showing with 602 additions and 604 deletions.
  1. +1 −1 src/java.base/share/classes/java/lang/Object.java
  2. +3 −3 src/java.base/share/classes/java/lang/StringCoding.java
  3. +3 −3 src/java.base/share/classes/java/lang/System.java
  4. +165 −167 src/java.base/share/classes/java/lang/Thread.java
  5. +2 −2 src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
  6. +15 −15 src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java
  7. +6 −6 src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java
  8. +1 −1 src/java.base/share/classes/jdk/internal/math/FloatingDecimal.java
  9. +1 −1 src/java.base/share/classes/jdk/internal/math/FormattedFloatingDecimal.java
  10. +2 −2 src/java.base/share/classes/jdk/internal/misc/Blocker.java
  11. +2 −2 src/java.base/share/classes/jdk/internal/misc/TerminatingThreadLocal.java
  12. +9 −9 src/java.base/share/classes/jdk/internal/misc/{LightweightThreads.java → VirtualThreads.java}
  13. +1 −1 src/java.base/share/classes/jdk/internal/reflect/NativeConstructorAccessorImpl.java
  14. +1 −1 src/java.base/share/classes/jdk/internal/reflect/NativeMethodAccessorImpl.java
  15. +3 −3 src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java
  16. +9 −9 src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java
  17. +4 −4 src/java.base/share/classes/sun/nio/ch/SelChImpl.java
  18. +2 −2 src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
  19. +5 −5 src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java
  20. +1 −1 src/java.base/share/classes/sun/nio/cs/ThreadLocalCoders.java
  21. +9 −9 src/java.base/unix/classes/sun/nio/ch/NativeThread.java
  22. +1 −1 src/java.base/unix/classes/sun/nio/ch/SinkChannelImpl.java
  23. +1 −1 src/java.base/unix/classes/sun/nio/ch/SourceChannelImpl.java
  24. +4 −4 src/java.base/windows/classes/sun/nio/ch/NativeThread.java
  25. +3 −3 test/hotspot/jtreg/serviceability/jvmti/DoContinueSingleStepTest/DoContinueSingleStepTest.java
  26. +2 −2 test/hotspot/jtreg/serviceability/jvmti/FiberTest/MyPackage/FiberTest.java
  27. +57 −57 test/jdk/java/lang/Thread/BuilderTest.java
  28. +7 −7 test/jdk/java/lang/Thread/{lightweight → virtual}/Collectable.java
  29. +20 −20 test/jdk/java/lang/Thread/{lightweight → virtual}/Locking.java
  30. +19 −19 test/jdk/java/lang/Thread/{lightweight → virtual}/NetSockets.java
  31. +53 −53 test/jdk/java/lang/Thread/{lightweight → virtual}/NioChannels.java
  32. +37 −37 test/jdk/java/lang/Thread/{lightweight → virtual}/Parking.java
  33. +5 −5 test/jdk/java/lang/Thread/{lightweight → virtual}/TestHelper.java
  34. +125 −125 test/jdk/java/lang/Thread/{lightweight → virtual}/ThreadAPI.java
  35. +13 −13 test/jdk/java/lang/Thread/{lightweight → virtual}/ThreadLocals.java
  36. +10 −10 test/jdk/java/lang/Thread/{lightweight → virtual}/WaitNotify.java
@@ -347,7 +347,7 @@ public final void wait(long timeoutMillis) throws InterruptedException {
wait0(timeoutMillis);
} catch (InterruptedException e) {
Thread thread = Thread.currentThread();
if (thread.isLightweight()) {
if (thread.isVirtual()) {
thread.clearInterrupt();
}
throw e;
@@ -73,7 +73,7 @@ private StringCoding() { }
private static final Charset UTF_8 = sun.nio.cs.UTF_8.INSTANCE;

private static <T> T deref(ThreadLocal<SoftReference<T>> tl) {
if (!Thread.currentThread().isLightweight()) {
if (!Thread.currentThread().isVirtual()) {
SoftReference<T> sr = tl.get();
if (sr != null)
return sr.get();
@@ -82,7 +82,7 @@ private StringCoding() { }
}

private static <T> void set(ThreadLocal<SoftReference<T>> tl, T ob) {
if (!Thread.currentThread().isLightweight())
if (!Thread.currentThread().isVirtual())
tl.set(new SoftReference<>(ob));
}

@@ -533,7 +533,7 @@ final String requestedCharsetName() {
}};

private static StringCoding.Result cachedResultObject() {
if (Thread.currentThread().isLightweight()) {
if (Thread.currentThread().isVirtual()) {
return new StringCoding.Result();
} else {
return resultCached.get();
@@ -2306,15 +2306,15 @@ public Thread currentCarrierThread() {
local.setCarrierThreadLocal(value);
}

public void parkLightweightThread() {
public void parkVirtualThread() {
Fiber.park();
}

public void parkLightweightThread(long nanos) {
public void parkVirtualThread(long nanos) {
Fiber.parkNanos(nanos);
}

public void unparkLightweightThread(Thread thread) {
public void unparkVirtualThread(Thread thread) {
((Fiber) thread).unpark();
}
});

0 comments on commit 4516bf3

Please sign in to comment.
You can’t perform that action at this time.