[13] RFR (S): 8192001: C2: inlining through dispatching MH linkers ignores speculative type of the receiver

Tobias Hartmann tobias.hartmann at oracle.com
Fri Jan 25 08:25:55 UTC 2019


Hi Vladimir,

this looks good to me too.

Best regards,
Tobias

On 25.01.19 02:56, Vladimir Ivanov wrote:
> http://cr.openjdk.java.net/~vlivanov/8192001/webrev.00/
> https://bugs.openjdk.java.net/browse/JDK-8192001
> 
> When inlining through MethodHandle calls, C2 can improve inlining decisions by taking speculative
> types into account (availability of type information is addressed by JDK-8191998 [1]).
> 
> There's no profiling performed at method handle linker call sites (MethodHandle::linkTo*), but type
> info can flow from other sources.
> 
> As an example, consider the following case:
> 
>   class A           { void m() { ... } }
>   class B extends A { void m() { ... } }
> 
>   MH = LOOKUP.findVirtual(A.class, "m", ...);
> 
>   void test(A o) throws Throwable {
>     MH.invokeExact(o);
>   }
> 
>   test(new B());
> 
> Before (no inlining):
> 251   12   !b        TestMH::test (21 bytes)
>   ...
>   @ 16   TestMH1$A::m (1 bytes)   virtual call
> 
> After (guarded inlining):
> 251   12   !b        TestMH::test (21 bytes)
>   ...
>   @ 16   TestMH1$B1::m (1 bytes)   inline (hot)
>      \-> TypeProfile (-1/6701 counts) = TestMH1$B1
> 
> Testing: hs-precheckin-comp, hs-tier1, hs-tier2.
> 
> Best regards,
> Vladimir Ivanov
> 
> [1] https://bugs.openjdk.java.net/browse/JDK-8192001


More information about the hotspot-compiler-dev mailing list