mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8150436: Incorrect invocation mode when linkToInteface linker is eliminated
Reviewed-by: kvn, shade
This commit is contained in:
parent
abebc2da5c
commit
a7d78599d7
2 changed files with 17 additions and 7 deletions
|
@ -1134,12 +1134,19 @@ Handle SharedRuntime::find_callee_info_helper(JavaThread* thread,
|
||||||
MethodHandles::is_signature_polymorphic_intrinsic(id)) {
|
MethodHandles::is_signature_polymorphic_intrinsic(id)) {
|
||||||
bc = MethodHandles::signature_polymorphic_intrinsic_bytecode(id);
|
bc = MethodHandles::signature_polymorphic_intrinsic_bytecode(id);
|
||||||
|
|
||||||
// Need to adjust invokehandle since inlining through signature-polymorphic
|
// Adjust invocation mode according to the attached method.
|
||||||
// method happened.
|
switch (bc) {
|
||||||
if (bc == Bytecodes::_invokehandle &&
|
case Bytecodes::_invokeinterface:
|
||||||
!MethodHandles::is_signature_polymorphic_method(attached_method())) {
|
if (!attached_method->method_holder()->is_interface()) {
|
||||||
bc = attached_method->is_static() ? Bytecodes::_invokestatic
|
bc = Bytecodes::_invokevirtual;
|
||||||
: Bytecodes::_invokevirtual;
|
}
|
||||||
|
break;
|
||||||
|
case Bytecodes::_invokehandle:
|
||||||
|
if (!MethodHandles::is_signature_polymorphic_method(attached_method())) {
|
||||||
|
bc = attached_method->is_static() ? Bytecodes::_invokestatic
|
||||||
|
: Bytecodes::_invokevirtual;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -180,7 +180,10 @@ public class InvokeTest {
|
||||||
static void testInterface() {
|
static void testInterface() {
|
||||||
System.out.println("linkToInterface");
|
System.out.println("linkToInterface");
|
||||||
|
|
||||||
// Monomorphic case (optimized virtual call)
|
// Monomorphic case (optimized virtual call), concrete target method
|
||||||
|
run(() -> linkToInterface(new P1(), P1.class));
|
||||||
|
|
||||||
|
// Monomorphic case (optimized virtual call), default target method
|
||||||
run(() -> linkToInterface(new T(), I.class));
|
run(() -> linkToInterface(new T(), I.class));
|
||||||
|
|
||||||
// Megamorphic case (virtual call)
|
// Megamorphic case (virtual call)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue