RFR (M): 8067344: Adjust java/lang/invoke/LFCaching/LFGarbageCollectedTest.java for recent changes in java.lang.invoke
peter.levart at gmail.com
Wed Dec 24 12:20:56 UTC 2014
I just wanted to ask about the reason you used PhantomReference to
detect that a referent is not softly reachable any more. You could use
another SoftReference or a WeakReference for the same effect, since it
is guaranteed that all SoftReferences for same referent are cleared
atomically and WeakReferences are cleared when referent is not softly
reachable any more. Using Weak or PhantomReference in test can
theoretically give false failures, since the object can still be weakly
of phantom reachable, but not softly reachable any more.
I think that it is enough for test to check that the referent is not
softly reachable any more, since cache is using SoftReferences.
Therefore it would be most appropriate to use a SoftReference in test too.
What do you think?
On 12/23/2014 01:40 PM, Vladimir Ivanov wrote:
> Spotted some more problems:
> - need to skip identity operations (identity_* LambdaForms) in the
> test, since corresponding LambdaForms reside in a permanent cache;
> - need to keep original test data for diagnostic purposes, since
> getTestCaseData() produces new instance.
> Updated version:
> Best regards,
> Vladimir Ivanov
> On 12/22/14 11:53 PM, Vladimir Ivanov wrote:
>> LFGarbageCollectedTest should be adjusted after JDK-8057020.
>> There are a couple of problems with the test.
>> (1) Existing logic to test that LambdaForm instance is collected isn't
>> stable enough. Consequent System.GCs can hinder reference enqueueing.
>> To speed up the test, I added -XX:SoftRefLRUPolicyMSPerMB=0 and limited
>> the heap by -Xmx64m.
>> (2) MethodType-based invoker caches are deliberately left strongly
>> reachable. So, they should be skipped in the test.
>> (3) Added additional diagnostic output to simplify failure analysis
>> (test case details, method handle type and LambdaForm, heap dump
>> (optional, -DHEAP_DUMP=true)).
>> Testing: failing test.
>> Best regards,
>> Vladimir Ivanov
More information about the core-libs-dev