--- old/src/share/vm/opto/graphKit.cpp 2016-11-24 11:13:27.883576870 +0100 +++ new/src/share/vm/opto/graphKit.cpp 2016-11-24 11:13:27.814577267 +0100 @@ -1708,13 +1708,25 @@ void GraphKit::set_arguments_for_java_call(CallJavaNode* call) { // Add the call arguments: uint nargs = call->method()->arg_size(); - for (uint i = 0; i < nargs; i++) { + for (uint i = 0, idx = 0; i < nargs; i++) { Node* arg = argument(i); - if (arg->is_ValueType()) { - // Pass value type argument via oop to callee - arg = arg->as_ValueType()->store_to_memory(this); + if (ValueTypePassFieldsAsArgs) { + if (arg->is_ValueType()) { + ValueTypeNode* vt = arg->as_ValueType(); + // We don't pass value type arguments by reference but instead + // pass each field of the value type + idx += vt->set_arguments_for_java_call(call, idx + TypeFunc::Parms, *this); + } else { + call->init_req(idx + TypeFunc::Parms, arg); + idx++; + } + } else { + if (arg->is_ValueType()) { + // Pass value type argument via oop to callee + arg = arg->as_ValueType()->store_to_memory(this); + } + call->init_req(i + TypeFunc::Parms, arg); } - call->init_req(i + TypeFunc::Parms, arg); } } @@ -2118,9 +2130,9 @@ void GraphKit::round_double_arguments(ciMethod* dest_method) { // (Note: TypeFunc::make has a cache that makes this fast.) const TypeFunc* tf = TypeFunc::make(dest_method); - int nargs = tf->domain()->cnt() - TypeFunc::Parms; + int nargs = tf->domain_sig()->cnt() - TypeFunc::Parms; for (int j = 0; j < nargs; j++) { - const Type *targ = tf->domain()->field_at(j + TypeFunc::Parms); + const Type *targ = tf->domain_sig()->field_at(j + TypeFunc::Parms); if( targ->basic_type() == T_DOUBLE ) { // If any parameters are doubles, they must be rounded before // the call, dstore_rounding does gvn.transform @@ -2222,10 +2234,10 @@ return; } const TypeFunc* tf = TypeFunc::make(dest_method); - int nargs = tf->domain()->cnt() - TypeFunc::Parms; + int nargs = tf->domain_sig()->cnt() - TypeFunc::Parms; int skip = Bytecodes::has_receiver(bc) ? 1 : 0; for (int j = skip, i = 0; j < nargs && i < TypeProfileArgsLimit; j++) { - const Type *targ = tf->domain()->field_at(j + TypeFunc::Parms); + const Type *targ = tf->domain_sig()->field_at(j + TypeFunc::Parms); if (targ->basic_type() == T_OBJECT || targ->basic_type() == T_ARRAY) { bool maybe_null = true; ciKlass* better_type = NULL;