1695 return new Values(n); |
1695 return new Values(n); |
1696 } |
1696 } |
1697 return NULL; |
1697 return NULL; |
1698 } |
1698 } |
1699 |
1699 |
|
1700 void GraphBuilder::check_args_for_profiling(Values* obj_args, int expected) { |
|
1701 #ifdef ASSERT |
|
1702 bool ignored_will_link; |
|
1703 ciSignature* declared_signature = NULL; |
|
1704 ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature); |
|
1705 assert(expected == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?"); |
|
1706 #endif |
|
1707 } |
|
1708 |
1700 // Collect arguments that we want to profile in a list |
1709 // Collect arguments that we want to profile in a list |
1701 Values* GraphBuilder::collect_args_for_profiling(Values* args, ciMethod* target, bool may_have_receiver) { |
1710 Values* GraphBuilder::collect_args_for_profiling(Values* args, ciMethod* target, bool may_have_receiver) { |
1702 int start = 0; |
1711 int start = 0; |
1703 Values* obj_args = args_list_for_profiling(target, start, may_have_receiver); |
1712 Values* obj_args = args_list_for_profiling(target, start, may_have_receiver); |
1704 if (obj_args == NULL) { |
1713 if (obj_args == NULL) { |
1705 return NULL; |
1714 return NULL; |
1706 } |
1715 } |
1707 int s = obj_args->size(); |
1716 int s = obj_args->size(); |
1708 for (int i = start, j = 0; j < s; i++) { |
1717 // if called through method handle invoke, some arguments may have been popped |
|
1718 for (int i = start, j = 0; j < s && i < args->length(); i++) { |
1709 if (args->at(i)->type()->is_object_kind()) { |
1719 if (args->at(i)->type()->is_object_kind()) { |
1710 obj_args->push(args->at(i)); |
1720 obj_args->push(args->at(i)); |
1711 j++; |
1721 j++; |
1712 } |
1722 } |
1713 } |
1723 } |
1714 assert(s == obj_args->length(), "missed on arg?"); |
1724 check_args_for_profiling(obj_args, s); |
1715 return obj_args; |
1725 return obj_args; |
1716 } |
1726 } |
1717 |
1727 |
1718 |
1728 |
1719 void GraphBuilder::invoke(Bytecodes::Code code) { |
1729 void GraphBuilder::invoke(Bytecodes::Code code) { |
3841 if (v->type()->is_object_kind()) { |
3851 if (v->type()->is_object_kind()) { |
3842 obj_args->push(v); |
3852 obj_args->push(v); |
3843 j++; |
3853 j++; |
3844 } |
3854 } |
3845 } |
3855 } |
3846 #ifdef ASSERT |
3856 check_args_for_profiling(obj_args, s); |
3847 { |
|
3848 bool ignored_will_link; |
|
3849 ciSignature* declared_signature = NULL; |
|
3850 ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature); |
|
3851 assert(s == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?"); |
|
3852 } |
|
3853 #endif |
|
3854 } |
3857 } |
3855 profile_call(callee, recv, holder_known ? callee->holder() : NULL, obj_args, true); |
3858 profile_call(callee, recv, holder_known ? callee->holder() : NULL, obj_args, true); |
3856 } |
3859 } |
3857 } |
3860 } |
3858 |
3861 |