RFR: 8273000: Remove WeakReference-based class initialisation barrier implementation

Vladimir Ivanov vlivanov at openjdk.java.net
Wed Aug 25 22:13:37 UTC 2021


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

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

Commit messages:
 - Remove WeakReference-based logic

Changes: https://git.openjdk.java.net/jdk/pull/5258/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5258&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8273000
  Stats: 35 lines in 1 file changed: 0 ins; 32 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5258.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5258/head:pull/5258

PR: https://git.openjdk.java.net/jdk/pull/5258


More information about the core-libs-dev mailing list