How to get rid of MethodHandle::linkTo* call when target method is known but not inlined?

Dean Long dean.long at
Thu Feb 12 01:09:17 UTC 2015

I'm not an expert, but it appears that we generate code for linkTo* 
intrinsics using the assembler, so the compiler,
which is good at detecting compile-time constants, isn't allowed to do 
what it's good at.  What if we implement
all linkTo* intrinsics (or linkToStatic at least) using IR instead?


On 2/11/2015 3:37 PM, Vladimir Ivanov wrote:
> Hi,
> I'm looking at JDK-8072008 [1]. The idea is to get rid of linkTo* call 
> when MemberName is a compile-time constant, but target method isn't 
> inlined. Direct call to target method is issued instead. It should 
> help recursive calls, for example.
> The problem is that compiled call sites start in unlinked state and 
> runtime lacks information to patch them with a correct method (what it 
> sees during fixup is just a linkTo* call).
> The only way I see how to get call site linking working is to attach 
> pre-resolved target method (Method*) to the nmethod and make fixup 
> logic aware of it, so it can skip bytecode inspection step (in 
> SharedRuntime::find_callee_info()).
> Do you see any problems with such approach?
> Any other ideas how to fix original problem?
> Thanks!
> Best regards,
> Vladimir Ivanov
> [1]

More information about the hotspot-compiler-dev mailing list