RFR 8173227: [JVMCI] HotSpotJVMCIMetaAccessContext.fromClass is inefficient
Doug Simon
doug.simon at oracle.com
Tue Jan 24 10:09:07 UTC 2017
+ while (javaType == null) {
+ WeakReference<ResolvedJavaType> type = resolvedJavaType.get(javaClass);
+ javaType = type.get();
+ if (javaType == null) {
+ resolvedJavaType.remove(javaClass);
+ }
Maybe add a small comment as to why the loop is necessary.
Otherwise, looks good.
> On 24 Jan 2017, at 09:50, Tom Rodriguez <tom.rodriguez at oracle.com> wrote:
>
> http://cr.openjdk.java.net/~never/8173227/webrev
> https://bugs.openjdk.java.net/browse/JDK-8173227
>
> HotSpotJVMCIMetaAccessContext.createClass is a synchronized wrapper around a WeakHashMap with WeakReference values. During bytecode parsing this can be a heavy contention point between between multiple threads. Additionally the use of WeakReferences for the keys and values is expensive. A ClassValue<WeakReference<ResolvedJavaType>> would avoid the contention around the synchronized method and would eliminate one of the two required WeakReferences. Tested with Graal.
>
> tom
More information about the hotspot-compiler-dev
mailing list