--- old/src/share/vm/opto/callGenerator.cpp 2017-07-25 14:58:14.557834806 +0200 +++ new/src/share/vm/opto/callGenerator.cpp 2017-07-25 14:58:09.954844406 +0200 @@ -443,7 +443,7 @@ } else { if (t->isa_valuetypeptr() && t->is_valuetypeptr()->klass() != C->env()->___Value_klass()) { ciValueKlass* vk = t->is_valuetypeptr()->value_type()->value_klass(); - Node* vt = C->create_vt_node(call, vk, vk, 0, j, true); + Node* vt = ValueTypeNode::make(gvn, call, vk, j, true); map->set_argument(jvms, i1, gvn.transform(vt)); j += vk->value_arg_slots(); } else { @@ -494,7 +494,7 @@ C->env()->notice_inlined_method(_inline_cg->method()); C->set_inlining_progress(true); - if (return_type->is_valuetype() && return_type != C->env()->___Value_klass()) { + if (return_type->is_valuetype()) { if (result->is_ValueType()) { ValueTypeNode* vt = result->as_ValueType(); if (!call->tf()->returns_value_type_as_fields()) { @@ -505,15 +505,23 @@ vt->replace_call_results(call, C); } } else { - assert(result->is_top(), "what else?"); - for (DUIterator_Fast imax, i = call->fast_outs(imax); i < imax; i++) { - ProjNode *pn = call->fast_out(i)->as_Proj(); - uint con = pn->_con; - if (con >= TypeFunc::Parms) { - // C->gvn_replace_by(pn, C->top()); - C->initial_gvn()->hash_delete(pn); - pn->set_req(0, C->top()); - --i; --imax; + const Type* vt_t = call->_tf->range_sig()->field_at(TypeFunc::Parms); + if (vt_t->is_valuetypeptr()->value_type()->value_klass() != C->env()->___Value_klass()) { + if (gvn.type(result)->isa_valuetypeptr() && call->tf()->returns_value_type_as_fields()) { + Node* cast = gvn.transform(new CheckCastPPNode(NULL, result, vt_t)); + ValueTypePtrNode* vtptr = ValueTypePtrNode::make(gvn, kit.merged_memory(), cast); + vtptr->replace_call_results(call, C); + } else { + assert(result->is_top(), "what else?"); + for (DUIterator_Fast imax, i = call->fast_outs(imax); i < imax; i++) { + ProjNode *pn = call->fast_out(i)->as_Proj(); + uint con = pn->_con; + if (con >= TypeFunc::Parms) { + C->initial_gvn()->hash_delete(pn); + pn->set_req(0, C->top()); + --i; --imax; + } + } } } }