On Thu, 1 Jun 2023 19:39:27 GMT, Mandy Chung <mch...@openjdk.org> wrote:

> As for the implementation of `LazyStaticVarHandle`, I expect that 
> `makeFieldHandle` can always create the direct var handle (i.e. 
> `FieldStaticReadXXX` var handle) and then wrapped by `LazyStaticVarHandle` 
> similar to how `IndirectVarHandle` does; 

Since I am not familiar with hotspot internals, I assumed that staticFieldBase 
and staticFieldOffset shouldn't be used until the class is initialized (rather 
than linked). This for certain can be done if they are ready once a class is 
linked, and we should probably update unsafe's comment as well. Can you confirm 
that they staticFieldBase/Offset are safe to be called before initialization?

If this change is safe, we can significantly reduce the initial-call overhead 
of the lazy VH significantly as well.

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

PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1572801392

Reply via email to