[9] RFR (L): Improve LambdaForm sharing by using LambdaFormEditor more extensively
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. Testing: jdk/java/lang/invoke, jdk/java/util/streams, nashorn, octane w/ "-ea -esa", COMPILE_THRESHOLD={0,30}, and USE_LAMBDA_FORM_EDITOR={true,false}. Reviewed-by: vlivanov, ? Contributed-by: john.r.rose@oracle.com Thanks! Best regards, Vladimir Ivanov
On Sep 9, 2014, at 12:51 PM, Vladimir Ivanov <vladimir.x.ivanov@oracle.com> wrote:
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() - 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)". Paul.
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.
On Sep 9, 2014, at 3:39 PM, Vladimir Ivanov <vladimir.x.ivanov@oracle.com> wrote:
Paul, thanks for review!
+1 Paul.
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.
participants (2)
-
Paul Sandoz
-
Vladimir Ivanov