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

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Dec 3 11:11:59 UTC 2014

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?


More information about the core-libs-dev mailing list