Paul Sandoz reported a problem with method inlining through method handles: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2014-October/015993.html _@ 48 MHInlineTest::testPackageMH (24 bytes) inline (hot) __@ 7 java.lang.invoke.LambdaForm$MH/314265080::invokeExact_MT (17 bytes) force inline by annotation ___@ 2 java.lang.invoke.Invokers::checkExactType (30 bytes) force inline by annotation ____@ 11 java.lang.invoke.MethodHandle::type (5 bytes) accessor ___@ 13 java.lang.invoke.LambdaForm$DMH/285377351::invokeVirtual_LL_V (15 bytes) force inline by annotation ____@ 1 java.lang.invoke.DirectMethodHandle::internalMemberName (8 bytes) force inline by annotation ____@ 11 MHInlineTest$A::package_x (6 bytes) virtual call Failing test: public class MHInlineTest { public static class A { void package_x(String s) { ... } } public static final class B extends A { void package_x(String s) { ... } } static final MethodHandle A_PUBLIC_X; static final MethodHandle A_PROTECTED_X; static final MethodHandle A_PACKAGE_X; static final MethodHandle A_PACKAGE_FINAL_X; static { try { A_PACKAGE_X = MethodHandles.lookup().findVirtual( A.class, "package_x", MethodType.methodType(void.class, String.class)); } catch (Exception e) { throw new Error(e); } } static final A a = new B(); public static void main(String[] args) { for (int i = 0; i < 1000_0000; i++) { try { A_PROTECTED_X.invokeExact(a, x); } catch (Throwable throwable) { throw new Error(throwable); } } } }
|