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

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Mon Dec 8 19:32:14 UTC 2014


Thanks for looking into that and for you initial prototype!

> So WeakReferences did not hold LambdaForms long enough even with strong
> back-reference from LambdaForm to the lambda form 'this' was derived
> from? So final derived LambdaForms (leaves) are not kept referenced from
> the code? Or did back-references keep intermediate LambdaForms in cache
> for too long (forever?) and you wanted them to be evicted too?
Regarding back references, my main concern was footprint. In some corner 
cases, LambdaFormEditor chain can become very long and I wanted to allow 
unloading of unused LambdaForms.

Also, there's another major source of method handles - MethodTypeForm - 
where most of the LambdaFormEditor chains root. It should be cleared as 
well to avoid memory exhaustion.

Regarding WeakReferences, my experiments showed that cache hit rate 
degrades significantly when they are used (30x more instantiated 
LambdaForms- from 1-3k to 30k-60k on Octane/Nashorn).

So, SoftReferences look like a good fit.

Best regards,
Vladimir Ivanov

More information about the core-libs-dev mailing list