[9] RFR (L): Improve LambdaForm sharing by using LambdaFormEditor more extensively

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Sep 9 13:39:11 UTC 2014


Paul, thanks for review!

Updated webrev in place.

>> http://cr.openjdk.java.net/~vlivanov/8057922/webrev.00
>> https://bugs.openjdk.java.net/browse/JDK-8057922
>>
>> Introduce more sharing on LambdaForm level by rewriting most of the MH combinators using LambdaFormEditor.
>>
>> The new code is guarded by USE_LAMBDA_FORM_EDITOR flag and turned off by default because it introduces significant peak performance regression on Octane benchmark. I'm working on the fix. Original implementation will be removed once performance degradation is fixed.
>>
>
> Generally looks ok.
>
>
> - LambdaFormEditor
>
>   465         buf.endEdit();
>   466         form = buf.lambdaForm();
>   467         return putInCache(key, form);
>
> A suggestion (feel free to ignore), that pattern repeats quite a bit. With some tweaks one could do:
>
>    return putIntCache(but.endEdit()); // or buf.toLambdaForm()
I decided to make LambdaFormBuffer.lambdaForm() private and return 
constructed LambdaForm from LFB.endEdit(). I didn't combine endEdit() & 
putInCache() into a single statement, because I find current shape more 
convenient for debugging.

> - MethodHandles
>
> 2869     public static
> 2870     MethodHandle filterReturnValue(MethodHandle target, MethodHandle filter) {
> 2871         MethodType targetType = target.type();
> 2872         MethodType filterType = filter.type();
> 2873         filterReturnValueChecks(targetType, filterType);
> 2874         BoundMethodHandle result = target.rebind();
> 2875         BasicType rtype = BasicType.basicType(filterType.returnType());
> 2876         LambdaForm lform = result.editor().filterReturnForm(rtype, false);
> 2877         MethodType newType = targetType.changeReturnType(filterType.returnType());
> 2878         result = result.copyWithExtendL(newType, lform, filter);
> 2879         return result;
> 2880     }
>
> Missing "if (USE_LAMBDA_FORM_EDITOR)".
Fixed.

Best regards,
Vladimir Ivanov
>
> Paul.
>


More information about the mlvm-dev mailing list