mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8244413: Avoid rebinds in MethodHandle.viewAsType
Reviewed-by: mchung, jrose
This commit is contained in:
parent
463e377053
commit
72704aaba1
4 changed files with 92 additions and 36 deletions
|
@ -1640,12 +1640,9 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
|
|||
/*non-public*/
|
||||
MethodHandle viewAsType(MethodType newType, boolean strict) {
|
||||
// No actual conversions, just a new view of the same method.
|
||||
// Note that this operation must not produce a DirectMethodHandle,
|
||||
// because retyped DMHs, like any transformed MHs,
|
||||
// cannot be cracked into MethodHandleInfo.
|
||||
assert viewAsTypeChecks(newType, strict);
|
||||
BoundMethodHandle mh = rebind();
|
||||
return mh.copyWith(newType, mh.form);
|
||||
// Overridden in DMH, which has special rules
|
||||
assert(viewAsTypeChecks(newType, strict));
|
||||
return copyWith(newType, form);
|
||||
}
|
||||
|
||||
/*non-public*/
|
||||
|
@ -1693,7 +1690,7 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
|
|||
} else {
|
||||
// The following case is rare. Mask the internalMemberName by wrapping the MH in a BMH.
|
||||
MethodHandle result = rebind();
|
||||
assert (result.internalMemberName() == null);
|
||||
assert(result.internalMemberName() == null);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -1703,6 +1700,11 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
|
|||
return false; // DMH.Special returns true
|
||||
}
|
||||
|
||||
/*non-public*/
|
||||
boolean isCrackable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*non-public*/
|
||||
Object internalValues() {
|
||||
return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue