Motivation to put Continuation, ContinuationScope, and Scope in jdk.internal.vm package

Ron Pressler ron.pressler at oracle.com
Fri Jul 22 12:48:57 UTC 2022


Correct.
However, we might introduce other (safe) constructs internally employing Continuation under the hood.

The main issue is that the Continuation class can be used in a way that would cause the current thread (i.e. Thread.currentThread()) to change mid-method. This would not only break a lot of Java code in very surprising ways, but also some assumptions made by the JIT compilers. Therefore, all safe constructs based on continuations must be confined to a single thread (or implement a thread, as done by virtual threads).

— Ron

On 22 Jul 2022, at 13:00, Remi Forax <forax at univ-mlv.fr<mailto:forax at univ-mlv.fr>> wrote:

This question has been answered several time on this list by Ron,
the class Contination is unsafe, it's kind of useful to understand how the internals works but this class can not be published publicly.

Rémi

________________________________
From: "Daniel Hinojosa" <dhinojosa at evolutionnext.com<mailto:dhinojosa at evolutionnext.com>>
To: loom-dev at openjdk.org<mailto:loom-dev at openjdk.org>
Sent: Friday, July 22, 2022 5:40:40 AM
Subject: Motivation to put Continuation, ContinuationScope, and Scope in jdk.internal.vm package
Hello,
I have been watching Loom and have been excited about it and I can't wait for the first official preview this fall.  I had one example that I used in demonstrating continuations and scope but it seems now that it was placed in an internal package and likely inaccessible by the module system. Is there any use case where a developer may want to use the Continuation, ContinuationScope and Scope objects for their purposes and would you consider moving it back out into public use?

Danno


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20220722/9fe705e7/attachment-0001.htm>


More information about the loom-dev mailing list