RFR: 8308609: java/lang/ScopedValue/StressStackOverflow.java fails with "-XX:-VMContinuations"

Alan Bateman alanb at openjdk.org
Fri Jun 9 17:22:41 UTC 2023


On Fri, 9 Jun 2023 16:53:15 GMT, Andrew Haley <aph at openjdk.org> wrote:

> Move `runWith()` from `VirtualThread` to `BaseVirtualThread`.
> 
> `BoundVirtualThread` does not use `runWith()` to run its task, so when a VM error occurs it can not recover scoped values.
> 
> Moving `runWith()` into the common subclass of both `VirtualThread` and `BoundVirtualThread` fixes the problem.

src/java.base/share/classes/java/lang/BaseVirtualThread.java line 78:

> 76:         op.run();
> 77:         Reference.reachabilityFence(bindings);
> 78:     }

BaseVirtualThread <: Thread.  Would it be simpler, and avoid duplicate, to just change Thread.runWith to be a final method with default access. That would be accessibility to VirtualThread and BoundVirtualThread without duplication.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14399#discussion_r1224563933


More information about the core-libs-dev mailing list