Lazy statics (was: Feedback / query on jextract for Windows 10)
john.r.rose at oracle.com
Wed Feb 3 22:19:27 UTC 2021
On Feb 3, 2021, at 1:58 PM, forax at univ-mlv.fr wrote:
> For the runtime exceptions, they should be wrapped into an ExceptionInInitializerError (which is a LinkageError), so we have the same behavior if the constant is initialized in the static bloc or using the lazy constant mechanism.
(Agreed; that’s what I meant by LinkageError in my previous.)
> The initialization semantics is both harder and simpler, we currently have the VM semantics inherited from ldc + condy, the initializer (the bootstrap method) can be called by multiple threads, the first thread to write into the constant pool win and all others threads return the winning value.
> We can not do better without tweaking the VM, so either we decide another semantics and it means adding a new mechanism into the VM or we are piggybacking on what already exists in the VM and just copy the VM semantics into the JLS.
If the user model demands something different, it can be composed
from the VM-provided primitives (condy first-write-wins plus
synchronized blocks plus ju.concurrent) in a translation strategy.
More information about the panama-dev