[11] RFR (S): 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Tue Jun 5 21:42:41 UTC 2018
http://cr.openjdk.java.net/~vlivanov/8203480/webrev.00/
https://bugs.openjdk.java.net/browse/JDK-8203480
JDK-8072008 enabled MethodHandle linker elimination when MemberName is a
compile-time constant, but target method isn't inlined. It involves
method resolution step and attached method + linker are used to initiate it.
The problematic case is invokevirtual on a default method. As an example:
interface I { default m() {} }
class T implements I {}
invokevirtual T.m() =R=> I.m()
findVirtual(T.class, "m", ...) => DMH: MH.linkToVirtual(..., I.m())
During call site resolution, "invokevirtual I.m()" resolution is
initiated and it fails link-time checks ending with an ICCE.
The fix is to adjust invocation mode for default methods from
invokevirtual to invokeinterface: resolution succeeds for
"invokeinterface I.m()" and it does the right thing.
Testing: hs-precheckin-comp, hs-tier1, hs-tier2
(-XX:+-StressMethodHandleLinkerInlining)
Thanks!
Best regards,
Vladimir Ivanov
More information about the hotspot-compiler-dev
mailing list