comparison src/share/vm/c1/c1_GraphBuilder.cpp @ 12355:cefad50507d8

Merge with hs25-b53
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 11 Oct 2013 10:38:03 +0200
parents 7894695caee6 1b64d46620a3
children 096c224171c4
comparison
equal deleted inserted replaced
12058:ccb4f2af2319 12355:cefad50507d8
1581 Instruction* constant = NULL; 1581 Instruction* constant = NULL;
1582 obj = apop(); 1582 obj = apop();
1583 ObjectType* obj_type = obj->type()->as_ObjectType(); 1583 ObjectType* obj_type = obj->type()->as_ObjectType();
1584 if (obj_type->is_constant() && !PatchALot) { 1584 if (obj_type->is_constant() && !PatchALot) {
1585 ciObject* const_oop = obj_type->constant_value(); 1585 ciObject* const_oop = obj_type->constant_value();
1586 if (!const_oop->is_null_object()) { 1586 if (!const_oop->is_null_object() && const_oop->is_loaded()) {
1587 if (field->is_constant()) { 1587 if (field->is_constant()) {
1588 ciConstant field_val = field->constant_value_of(const_oop); 1588 ciConstant field_val = field->constant_value_of(const_oop);
1589 BasicType field_type = field_val.basic_type(); 1589 BasicType field_type = field_val.basic_type();
1590 switch (field_type) { 1590 switch (field_type) {
1591 case T_ARRAY: 1591 case T_ARRAY:
1665 ciMethod* target = stream()->get_method(will_link, &declared_signature); 1665 ciMethod* target = stream()->get_method(will_link, &declared_signature);
1666 ciKlass* holder = stream()->get_declared_method_holder(); 1666 ciKlass* holder = stream()->get_declared_method_holder();
1667 const Bytecodes::Code bc_raw = stream()->cur_bc_raw(); 1667 const Bytecodes::Code bc_raw = stream()->cur_bc_raw();
1668 assert(declared_signature != NULL, "cannot be null"); 1668 assert(declared_signature != NULL, "cannot be null");
1669 1669
1670 // FIXME bail out for now 1670 if (!C1PatchInvokeDynamic && Bytecodes::has_optional_appendix(bc_raw) && !will_link) {
1671 if (Bytecodes::has_optional_appendix(bc_raw) && !will_link) { 1671 BAILOUT("unlinked call site (C1PatchInvokeDynamic is off)");
1672 BAILOUT("unlinked call site (FIXME needs patching or recompile support)");
1673 } 1672 }
1674 1673
1675 // we have to make sure the argument size (incl. the receiver) 1674 // we have to make sure the argument size (incl. the receiver)
1676 // is correct for compilation (the call would fail later during 1675 // is correct for compilation (the call would fail later during
1677 // linkage anyway) - was bug (gri 7/28/99) 1676 // linkage anyway) - was bug (gri 7/28/99)
1711 break; 1710 break;
1712 case Bytecodes::_invokehandle: 1711 case Bytecodes::_invokehandle:
1713 code = target->is_static() ? Bytecodes::_invokestatic : Bytecodes::_invokespecial; 1712 code = target->is_static() ? Bytecodes::_invokestatic : Bytecodes::_invokespecial;
1714 break; 1713 break;
1715 } 1714 }
1715 } else {
1716 if (bc_raw == Bytecodes::_invokehandle) {
1717 assert(!will_link, "should come here only for unlinked call");
1718 code = Bytecodes::_invokespecial;
1719 }
1716 } 1720 }
1717 1721
1718 // Push appendix argument (MethodType, CallSite, etc.), if one. 1722 // Push appendix argument (MethodType, CallSite, etc.), if one.
1719 if (stream()->has_appendix()) { 1723 bool patch_for_appendix = false;
1724 int patching_appendix_arg = 0;
1725 if (C1PatchInvokeDynamic &&
1726 (Bytecodes::has_optional_appendix(bc_raw) && (!will_link || PatchALot))) {
1727 Value arg = append(new Constant(new ObjectConstant(compilation()->env()->unloaded_ciinstance()), copy_state_before()));
1728 apush(arg);
1729 patch_for_appendix = true;
1730 patching_appendix_arg = (will_link && stream()->has_appendix()) ? 0 : 1;
1731 } else if (stream()->has_appendix()) {
1720 ciObject* appendix = stream()->get_appendix(); 1732 ciObject* appendix = stream()->get_appendix();
1721 Value arg = append(new Constant(new ObjectConstant(appendix))); 1733 Value arg = append(new Constant(new ObjectConstant(appendix)));
1722 apush(arg); 1734 apush(arg);
1723 } 1735 }
1724 1736
1730 ciMethod* exact_target = NULL; 1742 ciMethod* exact_target = NULL;
1731 Value better_receiver = NULL; 1743 Value better_receiver = NULL;
1732 if (UseCHA && DeoptC1 && klass->is_loaded() && target->is_loaded() && 1744 if (UseCHA && DeoptC1 && klass->is_loaded() && target->is_loaded() &&
1733 !(// %%% FIXME: Are both of these relevant? 1745 !(// %%% FIXME: Are both of these relevant?
1734 target->is_method_handle_intrinsic() || 1746 target->is_method_handle_intrinsic() ||
1735 target->is_compiled_lambda_form())) { 1747 target->is_compiled_lambda_form()) &&
1748 !patch_for_appendix) {
1736 Value receiver = NULL; 1749 Value receiver = NULL;
1737 ciInstanceKlass* receiver_klass = NULL; 1750 ciInstanceKlass* receiver_klass = NULL;
1738 bool type_is_exact = false; 1751 bool type_is_exact = false;
1739 // try to find a precise receiver type 1752 // try to find a precise receiver type
1740 if (will_link && !target->is_static()) { 1753 if (will_link && !target->is_static()) {
1848 } 1861 }
1849 1862
1850 // check if we could do inlining 1863 // check if we could do inlining
1851 if (!PatchALot && Inline && klass->is_loaded() && 1864 if (!PatchALot && Inline && klass->is_loaded() &&
1852 (klass->is_initialized() || klass->is_interface() && target->holder()->is_initialized()) 1865 (klass->is_initialized() || klass->is_interface() && target->holder()->is_initialized())
1853 && target->is_loaded()) { 1866 && target->is_loaded()
1867 && !patch_for_appendix) {
1854 // callee is known => check if we have static binding 1868 // callee is known => check if we have static binding
1855 assert(target->is_loaded(), "callee must be known"); 1869 assert(target->is_loaded(), "callee must be known");
1856 if (code == Bytecodes::_invokestatic || 1870 if (code == Bytecodes::_invokestatic ||
1857 code == Bytecodes::_invokespecial || 1871 code == Bytecodes::_invokespecial ||
1858 code == Bytecodes::_invokevirtual && target->is_final_method() || 1872 code == Bytecodes::_invokevirtual && target->is_final_method() ||
1899 // The bytecode (code) might change in this method so we are checking this very late. 1913 // The bytecode (code) might change in this method so we are checking this very late.
1900 const bool has_receiver = 1914 const bool has_receiver =
1901 code == Bytecodes::_invokespecial || 1915 code == Bytecodes::_invokespecial ||
1902 code == Bytecodes::_invokevirtual || 1916 code == Bytecodes::_invokevirtual ||
1903 code == Bytecodes::_invokeinterface; 1917 code == Bytecodes::_invokeinterface;
1904 Values* args = state()->pop_arguments(target->arg_size_no_receiver()); 1918 Values* args = state()->pop_arguments(target->arg_size_no_receiver() + patching_appendix_arg);
1905 Value recv = has_receiver ? apop() : NULL; 1919 Value recv = has_receiver ? apop() : NULL;
1906 int vtable_index = Method::invalid_vtable_index; 1920 int vtable_index = Method::invalid_vtable_index;
1907 1921
1908 #ifdef SPARC 1922 #ifdef SPARC
1909 // Currently only supported on Sparc. 1923 // Currently only supported on Sparc.
4205 else 4219 else
4206 log->inline_fail("reason unknown"); 4220 log->inline_fail("reason unknown");
4207 } 4221 }
4208 } 4222 }
4209 4223
4210 if (!PrintInlining) return; 4224 if (!PrintInlining && !compilation()->method()->has_option("PrintInlining")) {
4225 return;
4226 }
4211 CompileTask::print_inlining(callee, scope()->level(), bci(), msg); 4227 CompileTask::print_inlining(callee, scope()->level(), bci(), msg);
4212 if (success && CIPrintMethodCodes) { 4228 if (success && CIPrintMethodCodes) {
4213 callee->print_codes(); 4229 callee->print_codes();
4214 } 4230 }
4215 } 4231 }