1.1 --- a/src/share/vm/c1/c1_GraphBuilder.cpp Thu Nov 17 16:06:56 2016 +0000 1.2 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp Mon Nov 21 05:29:59 2016 +0000 1.3 @@ -1485,6 +1485,21 @@ 1.4 // Check to see whether we are inlining. If so, Return 1.5 // instructions become Gotos to the continuation point. 1.6 if (continuation() != NULL) { 1.7 + 1.8 + int invoke_bci = state()->caller_state()->bci(); 1.9 + 1.10 + if (x != NULL) { 1.11 + ciMethod* caller = state()->scope()->caller()->method(); 1.12 + Bytecodes::Code invoke_raw_bc = caller->raw_code_at_bci(invoke_bci); 1.13 + if (invoke_raw_bc == Bytecodes::_invokehandle || invoke_raw_bc == Bytecodes::_invokedynamic) { 1.14 + ciType* declared_ret_type = caller->get_declared_signature_at_bci(invoke_bci)->return_type(); 1.15 + if (declared_ret_type->is_klass() && x->exact_type() == NULL && 1.16 + x->declared_type() != declared_ret_type && declared_ret_type != compilation()->env()->Object_klass()) { 1.17 + x = append(new TypeCast(declared_ret_type->as_klass(), x, copy_state_before())); 1.18 + } 1.19 + } 1.20 + } 1.21 + 1.22 assert(!method()->is_synchronized() || InlineSynchronizedMethods, "can not inline synchronized methods yet"); 1.23 1.24 if (compilation()->env()->dtrace_method_probes()) { 1.25 @@ -1508,7 +1523,6 @@ 1.26 // State at end of inlined method is the state of the caller 1.27 // without the method parameters on stack, including the 1.28 // return value, if any, of the inlined method on operand stack. 1.29 - int invoke_bci = state()->caller_state()->bci(); 1.30 set_state(state()->caller_state()->copy_for_parsing()); 1.31 if (x != NULL) { 1.32 state()->push(x->type(), x);