comparison src/share/vm/c1/c1_GraphBuilder.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 4ca6dc0799b6 ee1c924763d2
children 7848fc12602b
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
1567 break; 1567 break;
1568 1568
1569 default: 1569 default:
1570 constant = new Constant(as_ValueType(field_val)); 1570 constant = new Constant(as_ValueType(field_val));
1571 } 1571 }
1572 // Stable static fields are checked for non-default values in ciField::initialize_from().
1572 } 1573 }
1573 if (constant != NULL) { 1574 if (constant != NULL) {
1574 push(type, append(constant)); 1575 push(type, append(constant));
1575 } else { 1576 } else {
1576 if (state_before == NULL) { 1577 if (state_before == NULL) {
1608 } 1609 }
1609 break; 1610 break;
1610 default: 1611 default:
1611 constant = new Constant(as_ValueType(field_val)); 1612 constant = new Constant(as_ValueType(field_val));
1612 } 1613 }
1614 if (FoldStableValues && field->is_stable() && field_val.is_null_or_zero()) {
1615 // Stable field with default value can't be constant.
1616 constant = NULL;
1617 }
1613 } else { 1618 } else {
1614 // For CallSite objects treat the target field as a compile time constant. 1619 // For CallSite objects treat the target field as a compile time constant.
1615 if (const_oop->is_call_site()) { 1620 if (const_oop->is_call_site()) {
1616 ciCallSite* call_site = const_oop->as_call_site(); 1621 ciCallSite* call_site = const_oop->as_call_site();
1617 if (field->is_call_site_target()) { 1622 if (field->is_call_site_target()) {
1695 return new Values(n); 1700 return new Values(n);
1696 } 1701 }
1697 return NULL; 1702 return NULL;
1698 } 1703 }
1699 1704
1705 void GraphBuilder::check_args_for_profiling(Values* obj_args, int expected) {
1706 #ifdef ASSERT
1707 bool ignored_will_link;
1708 ciSignature* declared_signature = NULL;
1709 ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature);
1710 assert(expected == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?");
1711 #endif
1712 }
1713
1700 // Collect arguments that we want to profile in a list 1714 // 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) { 1715 Values* GraphBuilder::collect_args_for_profiling(Values* args, ciMethod* target, bool may_have_receiver) {
1702 int start = 0; 1716 int start = 0;
1703 Values* obj_args = args_list_for_profiling(target, start, may_have_receiver); 1717 Values* obj_args = args_list_for_profiling(target, start, may_have_receiver);
1704 if (obj_args == NULL) { 1718 if (obj_args == NULL) {
1705 return NULL; 1719 return NULL;
1706 } 1720 }
1707 int s = obj_args->size(); 1721 int s = obj_args->size();
1708 for (int i = start, j = 0; j < s; i++) { 1722 // if called through method handle invoke, some arguments may have been popped
1723 for (int i = start, j = 0; j < s && i < args->length(); i++) {
1709 if (args->at(i)->type()->is_object_kind()) { 1724 if (args->at(i)->type()->is_object_kind()) {
1710 obj_args->push(args->at(i)); 1725 obj_args->push(args->at(i));
1711 j++; 1726 j++;
1712 } 1727 }
1713 } 1728 }
1714 assert(s == obj_args->length(), "missed on arg?"); 1729 check_args_for_profiling(obj_args, s);
1715 return obj_args; 1730 return obj_args;
1716 } 1731 }
1717 1732
1718 1733
1719 void GraphBuilder::invoke(Bytecodes::Code code) { 1734 void GraphBuilder::invoke(Bytecodes::Code code) {
1981 // The UseInlineCaches only controls dispatch to invokevirtuals for 1996 // The UseInlineCaches only controls dispatch to invokevirtuals for
1982 // loaded classes which we weren't able to statically bind. 1997 // loaded classes which we weren't able to statically bind.
1983 if (!UseInlineCaches && is_loaded && code == Bytecodes::_invokevirtual 1998 if (!UseInlineCaches && is_loaded && code == Bytecodes::_invokevirtual
1984 && !target->can_be_statically_bound()) { 1999 && !target->can_be_statically_bound()) {
1985 // Find a vtable index if one is available 2000 // Find a vtable index if one is available
1986 vtable_index = target->resolve_vtable_index(calling_klass, callee_holder); 2001 // For arrays, callee_holder is Object. Resolving the call with
2002 // Object would allow an illegal call to finalize() on an
2003 // array. We use holder instead: illegal calls to finalize() won't
2004 // be compiled as vtable calls (IC call resolution will catch the
2005 // illegal call) and the few legal calls on array types won't be
2006 // either.
2007 vtable_index = target->resolve_vtable_index(calling_klass, holder);
1987 } 2008 }
1988 #endif 2009 #endif
1989 2010
1990 if (recv != NULL && 2011 if (recv != NULL &&
1991 (code == Bytecodes::_invokespecial || 2012 (code == Bytecodes::_invokespecial ||
3767 if (is_profiling() && !callee->ensure_method_data()) { 3788 if (is_profiling() && !callee->ensure_method_data()) {
3768 INLINE_BAILOUT("mdo allocation failed"); 3789 INLINE_BAILOUT("mdo allocation failed");
3769 } 3790 }
3770 3791
3771 // now perform tests that are based on flag settings 3792 // now perform tests that are based on flag settings
3772 if (callee->force_inline()) { 3793 if (callee->force_inline() || callee->should_inline()) {
3773 if (inline_level() > MaxForceInlineLevel) INLINE_BAILOUT("MaxForceInlineLevel"); 3794 if (inline_level() > MaxForceInlineLevel ) INLINE_BAILOUT("MaxForceInlineLevel");
3774 print_inlining(callee, "force inline by annotation"); 3795 if (recursive_inline_level(callee) > MaxRecursiveInlineLevel) INLINE_BAILOUT("recursive inlining too deep");
3775 } else if (callee->should_inline()) { 3796
3776 print_inlining(callee, "force inline by CompileOracle"); 3797 const char* msg = "";
3798 if (callee->force_inline()) msg = "force inline by annotation";
3799 if (callee->should_inline()) msg = "force inline by CompileOracle";
3800 print_inlining(callee, msg);
3777 } else { 3801 } else {
3778 // use heuristic controls on inlining 3802 // use heuristic controls on inlining
3779 if (inline_level() > MaxInlineLevel ) INLINE_BAILOUT("inlining too deep"); 3803 if (inline_level() > MaxInlineLevel ) INLINE_BAILOUT("inlining too deep");
3780 if (recursive_inline_level(callee) > MaxRecursiveInlineLevel) INLINE_BAILOUT("recursive inlining too deep"); 3804 if (recursive_inline_level(callee) > MaxRecursiveInlineLevel) INLINE_BAILOUT("recursive inlining too deep");
3781 if (callee->code_size_for_inlining() > max_inline_size() ) INLINE_BAILOUT("callee is too large"); 3805 if (callee->code_size_for_inlining() > max_inline_size() ) INLINE_BAILOUT("callee is too large");
3840 if (v->type()->is_object_kind()) { 3864 if (v->type()->is_object_kind()) {
3841 obj_args->push(v); 3865 obj_args->push(v);
3842 j++; 3866 j++;
3843 } 3867 }
3844 } 3868 }
3845 #ifdef ASSERT 3869 check_args_for_profiling(obj_args, s);
3846 {
3847 bool ignored_will_link;
3848 ciSignature* declared_signature = NULL;
3849 ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature);
3850 assert(s == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?");
3851 }
3852 #endif
3853 } 3870 }
3854 profile_call(callee, recv, holder_known ? callee->holder() : NULL, obj_args, true); 3871 profile_call(callee, recv, holder_known ? callee->holder() : NULL, obj_args, true);
3855 } 3872 }
3856 } 3873 }
3857 3874