mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8161211: better inlining support for loop bytecode intrinsics
Reviewed-by: jrose, vlivanov, redestad
This commit is contained in:
parent
8469097dde
commit
281862a6aa
6 changed files with 150 additions and 88 deletions
|
@ -4368,10 +4368,11 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||
}
|
||||
|
||||
// Step 4: fill in missing parameter types.
|
||||
List<MethodHandle> finit = fillParameterTypes(init, commonSuffix);
|
||||
List<MethodHandle> fstep = fillParameterTypes(step, commonParameterSequence);
|
||||
List<MethodHandle> fpred = fillParameterTypes(pred, commonParameterSequence);
|
||||
List<MethodHandle> ffini = fillParameterTypes(fini, commonParameterSequence);
|
||||
// Also convert all handles to fixed-arity handles.
|
||||
List<MethodHandle> finit = fixArities(fillParameterTypes(init, commonSuffix));
|
||||
List<MethodHandle> fstep = fixArities(fillParameterTypes(step, commonParameterSequence));
|
||||
List<MethodHandle> fpred = fixArities(fillParameterTypes(pred, commonParameterSequence));
|
||||
List<MethodHandle> ffini = fixArities(fillParameterTypes(fini, commonParameterSequence));
|
||||
|
||||
assert finit.stream().map(MethodHandle::type).map(MethodType::parameterList).
|
||||
allMatch(pl -> pl.equals(commonSuffix));
|
||||
|
@ -4389,6 +4390,10 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static List<MethodHandle> fixArities(List<MethodHandle> hs) {
|
||||
return hs.stream().map(MethodHandle::asFixedArity).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a {@code while} loop from an initializer, a body, and a predicate. This is a convenience wrapper for
|
||||
* the {@linkplain #loop(MethodHandle[][]) generic loop combinator}.
|
||||
|
@ -4887,7 +4892,8 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||
// target parameter list.
|
||||
cleanup = dropArgumentsToMatch(cleanup, (rtype == void.class ? 1 : 2), targetParamTypes, 0);
|
||||
|
||||
return MethodHandleImpl.makeTryFinally(target, cleanup, rtype, targetParamTypes);
|
||||
// Use asFixedArity() to avoid unnecessary boxing of last argument for VarargsCollector case.
|
||||
return MethodHandleImpl.makeTryFinally(target.asFixedArity(), cleanup.asFixedArity(), rtype, targetParamTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue