On Wed, 1 Sep 2021 16:16:38 GMT, Vladimir Ivanov <vliva...@openjdk.org> wrote:
>> Get rid of WeakReference-based logic in >> DirectMethodHandle::checkInitialized() and reimplement it with >> `Unsafe::ensureClassInitialized()`/`shouldBeInitialized()`. >> >> The key observation is that `Unsafe::ensureClassInitialized()` does not >> block the initializing thread. >> >> Also, removed `Unsafe::shouldBeInitialized()` in >> `DMH::shouldBeInitialized(MemberName)` to save on calling into the VM. >> `Unsafe::ensureClassInitialized()` already has a fast-path check which >> checks whether the class is fully initialized or not. >> >> Testing: tier1 - tier6 > > Vladimir Ivanov has updated the pull request incrementally with one > additional commit since the last revision: > > Improve comments Looks good, just a minor suggestion up to you to accept or not. src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 1152: > 1150: * The call returns when either class {@code c} is fully > initialized or > 1151: * class {@code c} is being initialized and the call is performed > from > 1152: * the initializing thread. Suggestion: * The call returns when either class {@code c} is fully initialized or * class {@code c} is being initialized and the call is performed from * the initializing thread. In the latter case a subsequent call to * {@link #shouldBeInitialized}, from the calling thread of this call, * will return {@code true}. ------------- Marked as reviewed by psandoz (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/5258