--- old/src/share/vm/c1/c1_GraphBuilder.cpp 2013-10-14 13:44:01.468204978 +0200 +++ new/src/share/vm/c1/c1_GraphBuilder.cpp 2013-10-14 13:44:01.128348335 +0200 @@ -1672,15 +1672,19 @@ } // How many arguments do we want to profile? -Values* GraphBuilder::args_list_for_profiling(int& start, bool may_have_receiver) { +Values* GraphBuilder::args_list_for_profiling(ciMethod* target, int& start, bool may_have_receiver) { int n = 0; - assert(start == 0, "should be initialized"); + bool has_receiver = may_have_receiver && Bytecodes::has_receiver(method()->java_code_at_bci(bci())); + start = has_receiver ? 1 : 0; if (MethodData::profile_arguments()) { ciProfileData* data = method()->method_data()->bci_to_data(bci()); if (data->is_CallTypeData() || data->is_VirtualCallTypeData()) { n = data->is_CallTypeData() ? data->as_CallTypeData()->number_of_arguments() : data->as_VirtualCallTypeData()->number_of_arguments(); - bool has_receiver = may_have_receiver && Bytecodes::has_receiver(method()->java_code_at_bci(bci())); - start = has_receiver ? 1 : 0; + } + } + if (MethodData::profile_parameters() && target != NULL) { + if (target->method_data() != NULL && target->method_data()->parameters_type_data() != NULL) { + n = MAX2(n, target->method_data()->parameters_type_data()->number_of_parameters() - start); } } if (n > 0) { @@ -1690,9 +1694,9 @@ } // Collect arguments that we want to profile in a list -Values* GraphBuilder::collect_args_for_profiling(Values* args, bool may_have_receiver) { +Values* GraphBuilder::collect_args_for_profiling(Values* args, ciMethod* target, bool may_have_receiver) { int start = 0; - Values* obj_args = args_list_for_profiling(start, may_have_receiver); + Values* obj_args = args_list_for_profiling(target, start, may_have_receiver); if (obj_args == NULL) { return NULL; } @@ -2006,7 +2010,7 @@ } else if (exact_target != NULL) { target_klass = exact_target->holder(); } - profile_call(target, recv, target_klass, collect_args_for_profiling(args, false), false); + profile_call(target, recv, target_klass, collect_args_for_profiling(args, NULL, false), false); } } @@ -3561,7 +3565,7 @@ recv = args->at(0); null_check(recv); } - profile_call(callee, recv, NULL, collect_args_for_profiling(args, true), true); + profile_call(callee, recv, NULL, collect_args_for_profiling(args, callee, true), true); } } } @@ -3820,7 +3824,7 @@ if (profile_calls()) { int start = 0; - Values* obj_args = args_list_for_profiling(start, has_receiver); + Values* obj_args = args_list_for_profiling(callee, start, has_receiver); if (obj_args != NULL) { int s = obj_args->size(); // if called through method handle invoke, some arguments may have been popped