On Fri, 5 May 2023 13:02:05 GMT, Maurizio Cimadamore <[email protected]>
wrote:
>> src/java.base/share/classes/java/lang/invoke/VarHandles.java line 110:
>>
>>> 108: }
>>> 109: else {
>>> 110: if (UNSAFE.shouldBeInitialized(refc)) {
>>
>> This seems unrelated to the issue this PR is really about (if I understand
>> correctly). Would it make sense to address this as part of another PR?
>
> Also, perhaps @PaulSandoz knows more history on this one (I believe this code
> predates FFM).
Eh? I am not sure what you mean here. This is the essence of the patch, where
the "TODO" above is fixed: lookup.findStaticVarHandle now creates lazy
varhandle if the defining class of the field is not initialized.
The fixing of IndirectVarHandle.isAccessModeSupported is a side effect, because
the override of `getMethodHandle` in `IndirectVarHandle` appears to me as a
no-op; turns out it exists due to NPE in isAccessModeSupported, which IMO
should be fixed as it's a public API.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1186075452