mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8203886: Invoke LambdaMetafactory::altMetafactory exactly from the BootstrapMethodInvoker
Reviewed-by: mchung
This commit is contained in:
parent
ff2c3d4dbe
commit
b67da0de17
1 changed files with 14 additions and 0 deletions
|
@ -134,6 +134,8 @@ final class BootstrapMethodInvoker {
|
||||||
String recipe = (String)argv[0];
|
String recipe = (String)argv[0];
|
||||||
Object[] shiftedArgs = Arrays.copyOfRange(argv, 1, argv.length);
|
Object[] shiftedArgs = Arrays.copyOfRange(argv, 1, argv.length);
|
||||||
result = (CallSite)bootstrapMethod.invokeExact(caller, name, (MethodType)type, recipe, shiftedArgs);
|
result = (CallSite)bootstrapMethod.invokeExact(caller, name, (MethodType)type, recipe, shiftedArgs);
|
||||||
|
} else if (isLambdaMetafactoryAltMetafactoryBSM(bsmType)) {
|
||||||
|
result = (CallSite)bootstrapMethod.invokeExact(caller, name, (MethodType)type, argv);
|
||||||
} else {
|
} else {
|
||||||
switch (argv.length) {
|
switch (argv.length) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -286,6 +288,9 @@ final class BootstrapMethodInvoker {
|
||||||
private static final MethodType LMF_INDY_MT = MethodType.methodType(CallSite.class,
|
private static final MethodType LMF_INDY_MT = MethodType.methodType(CallSite.class,
|
||||||
Lookup.class, String.class, MethodType.class, MethodType.class, MethodHandle.class, MethodType.class);
|
Lookup.class, String.class, MethodType.class, MethodType.class, MethodHandle.class, MethodType.class);
|
||||||
|
|
||||||
|
private static final MethodType LMF_ALT_MT = MethodType.methodType(CallSite.class,
|
||||||
|
Lookup.class, String.class, MethodType.class, Object[].class);
|
||||||
|
|
||||||
private static final MethodType LMF_CONDY_MT = MethodType.methodType(Object.class,
|
private static final MethodType LMF_CONDY_MT = MethodType.methodType(Object.class,
|
||||||
Lookup.class, String.class, Class.class, MethodType.class, MethodHandle.class, MethodType.class);
|
Lookup.class, String.class, Class.class, MethodType.class, MethodHandle.class, MethodType.class);
|
||||||
|
|
||||||
|
@ -319,6 +324,15 @@ final class BootstrapMethodInvoker {
|
||||||
return bsmType == LMF_INDY_MT;
|
return bsmType == LMF_INDY_MT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true iff the BSM method type exactly matches
|
||||||
|
* {@see java.lang.invoke.LambdaMetafactory#altMetafactory(
|
||||||
|
* MethodHandles.Lookup,String,MethodType,Object[])}
|
||||||
|
*/
|
||||||
|
private static boolean isLambdaMetafactoryAltMetafactoryBSM(MethodType bsmType) {
|
||||||
|
return bsmType == LMF_ALT_MT;
|
||||||
|
}
|
||||||
|
|
||||||
/** The JVM produces java.lang.Integer values to box
|
/** The JVM produces java.lang.Integer values to box
|
||||||
* CONSTANT_Integer boxes but does not intern them.
|
* CONSTANT_Integer boxes but does not intern them.
|
||||||
* Let's intern them. This is slightly wrong for
|
* Let's intern them. This is slightly wrong for
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue