[8] RFR (XS): 8031695: CHA ignores default methods during analysis leading to incorrect code generation
Lois Foltan
lois.foltan at oracle.com
Wed Jan 22 12:48:32 PST 2014
On 1/22/2014 3:34 PM, Vladimir Ivanov wrote:
> John, Karen, thanks for review!
>
> Special thanks goes to Lois for initial analysis and instructions how
> to reproduce the issue. It saved me lots of time.
Hi Vladimir,
Thanks, your change looks good and as I mentioned earlier I tried it
with the test case and all is fine. I would also be remiss not to point
out that Christian Tornqvist also was very helpful in diagnosing key
aspects about this problem. Thanks Christian!
Lois
>
> Best regards,
> Vladimir Ivanov
>
> On 1/22/14 11:16 PM, Karen Kinnear wrote:
>> Looks good.
>>
>> many thanks,
>> Karen
>>
>> On Jan 22, 2014, at 12:29 PM, Vladimir Ivanov wrote:
>>
>>> http://cr.openjdk.java.net/~vlivanov/8031695/webrev.00/
>>> https://bugs.openjdk.java.net/browse/JDK-8031695
>>>
>>> CHA erroneously ignores default methods when looking for different
>>> versions of a method in a class hierarchy.
>>>
>>> Consider the following hierarchy:
>>> interface I { default void m() { ... }}
>>> class A implements I {}
>>>
>>> class C extends A { }
>>> class D extends A { public void m() { ... } }
>>>
>>> Call site: invokevirtual A.m()
>>>
>>> A.m resolves to I.m. Searching from A, CHA finds only D.m and
>>> concludes that D.m is the only implementation of I.m, since
>>> Dependencies::is_concrete_method returns false for I.m.
>>>
>>> But there is C with default implementation from I. So, if VM inlines
>>> D.m and then C's instance is passed as objectref, the wrong method
>>> is invoked (D.m instead of I.m).
>>>
>>> The fix is to take default methods into account doing CHA analysis
>>> and treat the call site as non-monomorphic when a concrete method is
>>> found for a default method.
>>>
>>> Conservative approach is chosen, since the fix is targeted for 8.
>>>
>>> Testing: failing application, regression test, vm.defmeth.testlist,
>>> JDK regression tests (java/util/, java/lang)
>>>
>>> Thanks!
>>>
>>> Best regards,
>>> Vladimir Ivanov
>>
More information about the hotspot-dev
mailing list