8150436: Incorrect invocation mode when linkToInteface linker is eliminated

Reviewed-by: kvn, shade
This commit is contained in:
Vladimir Ivanov 2016-02-26 01:58:29 +03:00
parent abebc2da5c
commit a7d78599d7
2 changed files with 17 additions and 7 deletions

View file

@ -1134,12 +1134,19 @@ Handle SharedRuntime::find_callee_info_helper(JavaThread* thread,
MethodHandles::is_signature_polymorphic_intrinsic(id)) {
bc = MethodHandles::signature_polymorphic_intrinsic_bytecode(id);
// Need to adjust invokehandle since inlining through signature-polymorphic
// method happened.
if (bc == Bytecodes::_invokehandle &&
!MethodHandles::is_signature_polymorphic_method(attached_method())) {
bc = attached_method->is_static() ? Bytecodes::_invokestatic
: Bytecodes::_invokevirtual;
// Adjust invocation mode according to the attached method.
switch (bc) {
case Bytecodes::_invokeinterface:
if (!attached_method->method_holder()->is_interface()) {
bc = 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 {