RFR 8173227: [JVMCI] HotSpotJVMCIMetaAccessContext.fromClass is inefficient
Tom Rodriguez
tom.rodriguez at oracle.com
Wed Jan 25 00:43:39 UTC 2017
I added a comment explaining the purpose of the loop and updated the
webrev in place.
tom
Doug Simon wrote:
> + 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