1.1 --- a/src/share/vm/interpreter/interpreterRuntime.cpp Tue Dec 13 10:07:12 2016 -0800 1.2 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp Tue Dec 13 14:37:04 2016 -0500 1.3 @@ -690,7 +690,8 @@ 1.4 IRT_ENTRY(void, InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code bytecode)) { 1.5 // extract receiver from the outgoing argument list if necessary 1.6 Handle receiver(thread, NULL); 1.7 - if (bytecode == Bytecodes::_invokevirtual || bytecode == Bytecodes::_invokeinterface) { 1.8 + if (bytecode == Bytecodes::_invokevirtual || bytecode == Bytecodes::_invokeinterface || 1.9 + bytecode == Bytecodes::_invokespecial) { 1.10 ResourceMark rm(thread); 1.11 methodHandle m (thread, method(thread)); 1.12 Bytecode_invoke call(m, bci(thread)); 1.13 @@ -756,16 +757,25 @@ 1.14 int index = info.resolved_method()->itable_index(); 1.15 assert(info.itable_index() == index, ""); 1.16 } 1.17 + } else if (bytecode == Bytecodes::_invokespecial) { 1.18 + assert(info.call_kind() == CallInfo::direct_call, "must be direct call"); 1.19 } else { 1.20 assert(info.call_kind() == CallInfo::direct_call || 1.21 info.call_kind() == CallInfo::vtable_call, ""); 1.22 } 1.23 #endif 1.24 + // Get sender or sender's host_klass, and only set cpCache entry to resolved if 1.25 + // it is not an interface. The receiver for invokespecial calls within interface 1.26 + // methods must be checked for every call. 1.27 + InstanceKlass* sender = pool->pool_holder(); 1.28 + sender = sender->is_anonymous() ? InstanceKlass::cast(sender->host_klass()) : sender; 1.29 + 1.30 switch (info.call_kind()) { 1.31 case CallInfo::direct_call: 1.32 cache_entry(thread)->set_direct_call( 1.33 bytecode, 1.34 - info.resolved_method()); 1.35 + info.resolved_method(), 1.36 + sender->is_interface()); 1.37 break; 1.38 case CallInfo::vtable_call: 1.39 cache_entry(thread)->set_vtable_call(