[9, 8u40] RFR (M): 8057020: LambdaForm caches should support eviction

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Wed Dec 3 11:45:19 UTC 2014

Aleksey, thanks for the review.

I haven't tried -XX:SoftRefLRUPolicyMSPerMB=0, but I did extensive 
testing on Octane/Nashorn with multiple low -Xmx levels + frequent Full 
GCs (8060147 [1] was the result of those experiments) and stress tested 
cache eviction with jdk/java/lang/invoke/LFCache tests in long running 

Best regards,
Vladimir Ivanov

[1] https://bugs.openjdk.java.net/browse/JDK-8060147

On 12/3/14, 3:11 PM, Aleksey Shipilev wrote:
> On 12/01/2014 07:58 PM, Vladimir Ivanov wrote:
>> http://cr.openjdk.java.net/~vlivanov/8057020/webrev.00/
>> https://bugs.openjdk.java.net/browse/JDK-8057020
> Looks okay, although the cache management logic gives me a headache
> after the vacation. I thought I spotted a few bugs, but those were only
> false positives.
>> The fix is to use SoftReferences to keep LambdaForms alive as long as
>> possible, but avoid throwing OOME until the caches are evicted. I
>> experimented with WeakReferences, but it doesn't hold LambdaForms for
>> long enough: LambdaForm cache hit rate degrades significantly and it
>> negatively affects application startup and warmup, since every
>> instantiated LambdaForm is precompiled to bytecode before usage.
>> Testing: jdk/java/lang/invoke/LFCache in stress mode + jck
>> (api/java_lang/invoke), jdk/java/lang/invoke, jdk/java/util/streams, octane
> SoftReferences are tricky in the way they can get suddenly drop the
> referent, and normal testing would not catch it (e.g. the normal
> operation would reclaim softrefs under your feet almost never). Does
> this code survive with -XX:SoftRefLRUPolicyMSPerMB=0?
> Thanks,
> -Aleksey.

More information about the core-libs-dev mailing list