Re: RFR: 8244413: Avoid rebinds in MethodHandle.viewAsType

2020-05-06 Thread Mandy Chung
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 

Re: RFR: 8244413: Avoid rebinds in MethodHandle.viewAsType

2020-05-06 Thread Claes Redestad
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 

Re: RFR: 8244413: Avoid rebinds in MethodHandle.viewAsType

2020-05-06 Thread Claes Redestad
On 2020-05-06 00:34, Claes Redestad wrote: Hi Mandy, On 2020-05-06 00:23, Mandy Chung wrote: This looks good. thanks! Pushed. FTR, I took inventory of existing micros, and found a few where the effect of this change on capturing lambdas can be studied. For example: $ make

Re: RFR: 8244413: Avoid rebinds in MethodHandle.viewAsType

2020-05-05 Thread Claes Redestad
Hi Mandy, On 2020-05-06 00:23, Mandy Chung wrote: This looks good. thanks! Nit: one assert with paratheses and the other without.  Better to make them consistent. 163 assert viewAsTypeChecks(newType, strict);  164 assert(this.getClass() == DirectMethodHandle.class); // must override

Re: RFR: 8244413: Avoid rebinds in MethodHandle.viewAsType

2020-05-05 Thread Mandy Chung
On 5/5/20 3:12 PM, Claes Redestad wrote: Hi, in the current implementation MethodHandle.viewAsType eagerly rebinds when creating a view of a method type as an alternative type:     MethodHandle viewAsType(MethodType newType, boolean strict) {     ...     MethodHandle mh = rebind();  

RFR: 8244413: Avoid rebinds in MethodHandle.viewAsType

2020-05-05 Thread Claes Redestad
Hi, in the current implementation MethodHandle.viewAsType eagerly rebinds when creating a view of a method type as an alternative type: MethodHandle viewAsType(MethodType newType, boolean strict) { ... MethodHandle mh = rebind(); return this.copyWith(newType,