mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8264288: Performance issue with MethodHandle.asCollector
Reviewed-by: jrose, vlivanov
This commit is contained in:
parent
920189918e
commit
b7baca7f32
10 changed files with 197 additions and 358 deletions
|
@ -1244,13 +1244,9 @@ assertEquals("[123]", (String) longsToString.invokeExact((long)123));
|
|||
asCollectorChecks(arrayType, collectArgPos, arrayLength);
|
||||
BoundMethodHandle mh = rebind();
|
||||
MethodType resultType = type().asCollectorType(arrayType, collectArgPos, arrayLength);
|
||||
MethodHandle newArray = MethodHandleImpl.varargsArray(arrayType, arrayLength);
|
||||
LambdaForm lform = mh.editor().collectArgumentArrayForm(1 + collectArgPos, newArray);
|
||||
if (lform != null) {
|
||||
return mh.copyWith(resultType, lform);
|
||||
}
|
||||
lform = mh.editor().collectArgumentsForm(1 + collectArgPos, newArray.type().basicType());
|
||||
return mh.copyWithExtendL(resultType, lform, newArray);
|
||||
MethodHandle collector = MethodHandleImpl.varargsArray(arrayType, arrayLength);
|
||||
LambdaForm lform = mh.editor().collectArgumentsForm(1 + collectArgPos, collector.type().basicType());
|
||||
return mh.copyWithExtendL(resultType, lform, collector);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue