State of Loom

Alan Bateman Alan.Bateman at oracle.com
Wed May 27 17:32:33 UTC 2020


On 27/05/2020 16:47, Stephane Epardaud wrote:
> Hi
>
> I've read about pinning and how a virtual thread is pinned if it blocks
> with a native call on the stack. I've already mentioned this in the past
> here, but I'm not sure this got thoroughly discussed.
>
Yes, I remember your mails from 2018 on this. This project hasn't put 
effort into that topic since that discussion. Instead we eliminated the 
need to trampoline through a native frame in the two common cases that 
we identified early on. One was AccessController.doPrivileged where the 
privileged stack was setup in the VM - this was replaced in JDK 12 with 
a pure Java implementation so parking while in a privileged operation 
doesn't pin the carrier thread. The other was core reflection to invoke 
methods (or create objects) that would go through the VM for the first 
few invocations before generating code - it no longer does this when 
invoked in the context of a virtual thread.  I've no doubt that will be 
other cases where there are upcalls from native code. So feel free to 
experiment, it's possible that we will need to do something in the future.

-Alan


More information about the loom-dev mailing list