RFR: 8244413: Avoid rebinds in MethodHandle.viewAsType

Mandy Chung mandy.chung at oracle.com
Wed May 6 20:11:22 UTC 2020



On 5/6/20 12:50 PM, Claes Redestad wrote:
> On 2020-05-06 16:59, Claes Redestad wrote:
>>
>> -XX:TieredStopAtLevel=1:
>>          Benchmark           Mode  Cnt    Score   Error  Units
>> 15-b19  Capture0.lambda_01  avgt    5    6.312 ± 0.919  ns/op
>> 15-b20  Capture0.lambda_01  avgt    5  105.761 ± 7.575  ns/op
>> jdk     Capture0.lambda_01  avgt    5  105.228 ± 7.175  ns/op
>>
>> So outside of the direct bootstrap improvement, there's a positive
>> effect during early warmup. Sadly this patch doesn't translate into an
>> improvement in C1. I can see a rather large regression in C1 on this
>> specific micro in 15-b20 (which is where the Hidden Classes integration
>> happened).
>
> Filed: https://bugs.openjdk.java.net/browse/JDK-8244550
>

Thanks.
> Overhead is entirely in Unsafe::allocateInstance, which will be
> intrinsified by C2, but has ~100ns/op overhead when called from
> interpreter and C1 code.
>
> I've prototyped a patch to remove a few redundant VM->native transitions
> and gotten this overhead down to 60ns/op.
>

FTR, prior to hidden classes, LMF generated a factory method to create 
an instance of lambda proxy via invokespecial.   With hidden classes, it 
can get the constructor iva findConstructor and that causes 
Unsafe::allocateInstance to be called.

Mandy


More information about the core-libs-dev mailing list