RFR: JDK-8310913 Move ReferencedKeyMap to jdk.internal so it may be shared [v2]
Mandy Chung
mchung at openjdk.org
Fri Jun 30 17:50:57 UTC 2023
On Thu, 29 Jun 2023 18:24:33 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:
>> java.lang.runtime.ReferencedKeyMap was introduced to provide a concurrent caching scheme for Carrier objects. The technique used is generally useful for a variety of caching schemes and is being moved to be shared in other parts of the jdk. The MethodType interning case is one example.
>
> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>
> Remove warning tied to String Templates
MethodType's `ConcurrentWeakInternSet` uses `NativeReferenceQueue` which uses native monitors (that was added for virtual threads). This change uses the reference queue using j.u.c locks. Has you confirmed that this is not an issue? Or `ReferencedKeySet` can take a parameter to specify using the native reference queue?
In `ReferencedKey::equals` method, can use `Reference::refersTo` instead of `Objects.equals`.
src/java.base/share/classes/java/lang/invoke/MethodType.java line 899:
> 897: return equals(mt);
> 898: }
> 899: if (x instanceof ConcurrentWeakInternSet.WeakEntry<?> e
The comment above about `WeakEntry` should also be removed.
-------------
PR Review: https://git.openjdk.org/jdk/pull/14684#pullrequestreview-1507601740
PR Review Comment: https://git.openjdk.org/jdk/pull/14684#discussion_r1248115440
More information about the core-libs-dev
mailing list