4778 // and skip a call to MH.linkTo*/invokeBasic adapter, additional information
4779 // about the method being invoked should be attached to the call site to
4780 // make resolution logic work (see SharedRuntime::resolve_{virtual,opt_virtual}_call_C).
4781 slow_call->set_override_symbolic_info(true);
4782 }
4783 set_arguments_for_java_call(slow_call);
4784 set_edges_for_java_call(slow_call);
4785 return slow_call;
4786 }
4787
4788
4789 /**
4790 * Build special case code for calls to hashCode on an object. This call may
4791 * be virtual (invokevirtual) or bound (invokespecial). For each case we generate
4792 * slightly different code.
4793 */
4794 bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) {
4795 assert(is_static == callee()->is_static(), "correct intrinsic selection");
4796 assert(!(is_virtual && is_static), "either virtual, special, or static");
4797
4798 enum { _slow_path = 1, _fast_path, _null_path, PATH_LIMIT };
4799
4800 RegionNode* result_reg = new RegionNode(PATH_LIMIT);
4801 PhiNode* result_val = new PhiNode(result_reg, TypeInt::INT);
4802 PhiNode* result_io = new PhiNode(result_reg, Type::ABIO);
4803 PhiNode* result_mem = new PhiNode(result_reg, Type::MEMORY, TypePtr::BOTTOM);
4804 Node* obj = nullptr;
4805 if (!is_static) {
4806 // Check for hashing null object
4807 obj = null_check_receiver();
4808 if (stopped()) return true; // unconditionally null
4809 result_reg->init_req(_null_path, top());
4810 result_val->init_req(_null_path, top());
4811 } else {
4812 // Do a null check, and return zero if null.
4813 // System.identityHashCode(null) == 0
4814 obj = argument(0);
4815 Node* null_ctl = top();
4816 obj = null_check_oop(obj, &null_ctl);
4817 result_reg->init_req(_null_path, null_ctl);
4818 result_val->init_req(_null_path, _gvn.intcon(0));
4826 return true;
4827 }
4828
4829 // We only go to the fast case code if we pass a number of guards. The
4830 // paths which do not pass are accumulated in the slow_region.
4831 RegionNode* slow_region = new RegionNode(1);
4832 record_for_igvn(slow_region);
4833
4834 // If this is a virtual call, we generate a funny guard. We pull out
4835 // the vtable entry corresponding to hashCode() from the target object.
4836 // If the target method which we are calling happens to be the native
4837 // Object hashCode() method, we pass the guard. We do not need this
4838 // guard for non-virtual calls -- the caller is known to be the native
4839 // Object hashCode().
4840 if (is_virtual) {
4841 // After null check, get the object's klass.
4842 Node* obj_klass = load_object_klass(obj);
4843 generate_virtual_guard(obj_klass, slow_region);
4844 }
4845
4846 // Get the header out of the object, use LoadMarkNode when available
4847 Node* header_addr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes());
4848 // The control of the load must be null. Otherwise, the load can move before
4849 // the null check after castPP removal.
4850 Node* no_ctrl = nullptr;
4851 Node* header = make_load(no_ctrl, header_addr, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
4852
4853 if (!UseObjectMonitorTable) {
4854 // Test the header to see if it is safe to read w.r.t. locking.
4855 Node *lock_mask = _gvn.MakeConX(markWord::lock_mask_in_place);
4856 Node *lmasked_header = _gvn.transform(new AndXNode(header, lock_mask));
4857 Node *monitor_val = _gvn.MakeConX(markWord::monitor_value);
4858 Node *chk_monitor = _gvn.transform(new CmpXNode(lmasked_header, monitor_val));
4859 Node *test_monitor = _gvn.transform(new BoolNode(chk_monitor, BoolTest::eq));
4860
4861 generate_slow_guard(test_monitor, slow_region);
4862 }
4863
4864 // Get the hash value and check to see that it has been properly assigned.
4865 // We depend on hash_mask being at most 32 bits and avoid the use of
4866 // hash_mask_in_place because it could be larger than 32 bits in a 64-bit
4867 // vm: see markWord.hpp.
4868 Node *hash_mask = _gvn.intcon(markWord::hash_mask);
4869 Node *hash_shift = _gvn.intcon(markWord::hash_shift);
4870 Node *hshifted_header= _gvn.transform(new URShiftXNode(header, hash_shift));
4871 // This hack lets the hash bits live anywhere in the mark object now, as long
4872 // as the shift drops the relevant bits into the low 32 bits. Note that
4873 // Java spec says that HashCode is an int so there's no point in capturing
4874 // an 'X'-sized hashcode (32 in 32-bit build or 64 in 64-bit build).
4875 hshifted_header = ConvX2I(hshifted_header);
4876 Node *hash_val = _gvn.transform(new AndINode(hshifted_header, hash_mask));
4877
4878 Node *no_hash_val = _gvn.intcon(markWord::no_hash);
4879 Node *chk_assigned = _gvn.transform(new CmpINode( hash_val, no_hash_val));
4880 Node *test_assigned = _gvn.transform(new BoolNode( chk_assigned, BoolTest::eq));
4881
4882 generate_slow_guard(test_assigned, slow_region);
4883
4884 Node* init_mem = reset_memory();
4885 // fill in the rest of the null path:
4886 result_io ->init_req(_null_path, i_o());
4887 result_mem->init_req(_null_path, init_mem);
4888
4889 result_val->init_req(_fast_path, hash_val);
4890 result_reg->init_req(_fast_path, control());
4891 result_io ->init_req(_fast_path, i_o());
4892 result_mem->init_req(_fast_path, init_mem);
4893
4894 // Generate code for the slow case. We make a call to hashCode().
4895 set_control(_gvn.transform(slow_region));
4896 if (!stopped()) {
4897 // No need for PreserveJVMState, because we're using up the present state.
4898 set_all_memory(init_mem);
4899 vmIntrinsics::ID hashCode_id = is_static ? vmIntrinsics::_identityHashCode : vmIntrinsics::_hashCode;
4900 CallJavaNode* slow_call = generate_method_call(hashCode_id, is_virtual, is_static, false);
4901 Node* slow_result = set_results_for_java_call(slow_call);
4902 // this->control() comes from set_results_for_java_call
4903 result_reg->init_req(_slow_path, control());
4904 result_val->init_req(_slow_path, slow_result);
4905 result_io ->set_req(_slow_path, i_o());
4906 result_mem ->set_req(_slow_path, reset_memory());
4907 }
4908
4909 // Return the combined state.
4910 set_i_o( _gvn.transform(result_io) );
4911 set_all_memory( _gvn.transform(result_mem));
4912
4913 set_result(result_reg, result_val);
4914 return true;
5647 _gvn.hash_delete(alloc);
5648 alloc->set_req(TypeFunc::Control, control());
5649 alloc->set_req(TypeFunc::I_O, i_o());
5650 Node *mem = reset_memory();
5651 set_all_memory(mem);
5652 alloc->set_req(TypeFunc::Memory, mem);
5653 set_control(init->proj_out_or_null(TypeFunc::Control));
5654 set_i_o(callprojs.fallthrough_ioproj);
5655
5656 // Update memory as done in GraphKit::set_output_for_allocation()
5657 const TypeInt* length_type = _gvn.find_int_type(alloc->in(AllocateNode::ALength));
5658 const TypeOopPtr* ary_type = _gvn.type(alloc->in(AllocateNode::KlassNode))->is_klassptr()->as_instance_type();
5659 if (ary_type->isa_aryptr() && length_type != nullptr) {
5660 ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
5661 }
5662 const TypePtr* telemref = ary_type->add_offset(Type::OffsetBot);
5663 int elemidx = C->get_alias_index(telemref);
5664 // Need to properly move every memory projection for the Initialize
5665 #ifdef ASSERT
5666 int mark_idx = C->get_alias_index(ary_type->add_offset(oopDesc::mark_offset_in_bytes()));
5667 int klass_idx = C->get_alias_index(ary_type->add_offset(oopDesc::klass_offset_in_bytes()));
5668 #endif
5669 auto move_proj = [&](ProjNode* proj) {
5670 int alias_idx = C->get_alias_index(proj->adr_type());
5671 assert(alias_idx == Compile::AliasIdxRaw ||
5672 alias_idx == elemidx ||
5673 alias_idx == mark_idx ||
5674 alias_idx == klass_idx, "should be raw memory or array element type");
5675 set_memory(proj, alias_idx);
5676 };
5677 init->for_each_proj(move_proj, TypeFunc::Memory);
5678
5679 Node* allocx = _gvn.transform(alloc);
5680 assert(allocx == alloc, "where has the allocation gone?");
5681 assert(dest->is_CheckCastPP(), "not an allocation result?");
5682
5683 _gvn.hash_delete(dest);
5684 dest->set_req(0, control());
5685 Node* destx = _gvn.transform(dest);
5686 assert(destx == dest, "where has the allocation result gone?");
5687
|
4778 // and skip a call to MH.linkTo*/invokeBasic adapter, additional information
4779 // about the method being invoked should be attached to the call site to
4780 // make resolution logic work (see SharedRuntime::resolve_{virtual,opt_virtual}_call_C).
4781 slow_call->set_override_symbolic_info(true);
4782 }
4783 set_arguments_for_java_call(slow_call);
4784 set_edges_for_java_call(slow_call);
4785 return slow_call;
4786 }
4787
4788
4789 /**
4790 * Build special case code for calls to hashCode on an object. This call may
4791 * be virtual (invokevirtual) or bound (invokespecial). For each case we generate
4792 * slightly different code.
4793 */
4794 bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) {
4795 assert(is_static == callee()->is_static(), "correct intrinsic selection");
4796 assert(!(is_virtual && is_static), "either virtual, special, or static");
4797
4798 enum { _slow_path = 1, _null_path, _fast_path, _fast_path2, PATH_LIMIT };
4799
4800 RegionNode* result_reg = new RegionNode(PATH_LIMIT);
4801 PhiNode* result_val = new PhiNode(result_reg, TypeInt::INT);
4802 PhiNode* result_io = new PhiNode(result_reg, Type::ABIO);
4803 PhiNode* result_mem = new PhiNode(result_reg, Type::MEMORY, TypePtr::BOTTOM);
4804 Node* obj = nullptr;
4805 if (!is_static) {
4806 // Check for hashing null object
4807 obj = null_check_receiver();
4808 if (stopped()) return true; // unconditionally null
4809 result_reg->init_req(_null_path, top());
4810 result_val->init_req(_null_path, top());
4811 } else {
4812 // Do a null check, and return zero if null.
4813 // System.identityHashCode(null) == 0
4814 obj = argument(0);
4815 Node* null_ctl = top();
4816 obj = null_check_oop(obj, &null_ctl);
4817 result_reg->init_req(_null_path, null_ctl);
4818 result_val->init_req(_null_path, _gvn.intcon(0));
4826 return true;
4827 }
4828
4829 // We only go to the fast case code if we pass a number of guards. The
4830 // paths which do not pass are accumulated in the slow_region.
4831 RegionNode* slow_region = new RegionNode(1);
4832 record_for_igvn(slow_region);
4833
4834 // If this is a virtual call, we generate a funny guard. We pull out
4835 // the vtable entry corresponding to hashCode() from the target object.
4836 // If the target method which we are calling happens to be the native
4837 // Object hashCode() method, we pass the guard. We do not need this
4838 // guard for non-virtual calls -- the caller is known to be the native
4839 // Object hashCode().
4840 if (is_virtual) {
4841 // After null check, get the object's klass.
4842 Node* obj_klass = load_object_klass(obj);
4843 generate_virtual_guard(obj_klass, slow_region);
4844 }
4845
4846 if (UseCompactObjectHeaders) {
4847 // Get the header out of the object.
4848 Node* header_addr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes());
4849 // The control of the load must be null. Otherwise, the load can move before
4850 // the null check after castPP removal.
4851 Node* no_ctrl = nullptr;
4852 Node* header = make_load(no_ctrl, header_addr, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
4853
4854 // Test the header to see if the object is in hashed or copied state.
4855 Node* hashctrl_mask = _gvn.MakeConX(markWord::hashctrl_mask_in_place);
4856 Node* masked_header = _gvn.transform(new AndXNode(header, hashctrl_mask));
4857
4858 // Take slow-path when the object has not been hashed.
4859 Node* not_hashed_val = _gvn.MakeConX(0);
4860 Node* chk_hashed = _gvn.transform(new CmpXNode(masked_header, not_hashed_val));
4861 Node* test_hashed = _gvn.transform(new BoolNode(chk_hashed, BoolTest::eq));
4862
4863 generate_slow_guard(test_hashed, slow_region);
4864
4865 // Test whether the object is hashed or hashed&copied.
4866 Node* hashed_copied = _gvn.MakeConX(markWord::hashctrl_expanded_mask_in_place | markWord::hashctrl_hashed_mask_in_place);
4867 Node* chk_copied = _gvn.transform(new CmpXNode(masked_header, hashed_copied));
4868 // If true, then object has been hashed&copied, otherwise it's only hashed.
4869 Node* test_copied = _gvn.transform(new BoolNode(chk_copied, BoolTest::eq));
4870 IfNode* if_copied = create_and_map_if(control(), test_copied, PROB_FAIR, COUNT_UNKNOWN);
4871 Node* if_true = _gvn.transform(new IfTrueNode(if_copied));
4872 Node* if_false = _gvn.transform(new IfFalseNode(if_copied));
4873
4874 // Hashed&Copied path: read hash-code out of the object.
4875 set_control(if_true);
4876 // result_val->del_req(_fast_path2);
4877 // result_reg->del_req(_fast_path2);
4878 // result_io->del_req(_fast_path2);
4879 // result_mem->del_req(_fast_path2);
4880
4881 Node* obj_klass = load_object_klass(obj);
4882 Node* hash_addr;
4883 const TypeKlassPtr* klass_t = _gvn.type(obj_klass)->isa_klassptr();
4884 bool load_offset_runtime = true;
4885
4886 if (klass_t != nullptr) {
4887 if (klass_t->klass_is_exact() && klass_t->isa_instklassptr()) {
4888 ciInstanceKlass* ciKlass = reinterpret_cast<ciInstanceKlass*>(klass_t->is_instklassptr()->exact_klass());
4889 if (!ciKlass->is_mirror_instance_klass() && !ciKlass->is_reference_instance_klass()) {
4890 // We know the InstanceKlass, load hash_offset from there at compile-time.
4891 int hash_offset = ciKlass->hash_offset_in_bytes();
4892 hash_addr = basic_plus_adr(obj, hash_offset);
4893 Node* loaded_hash = make_load(control(), hash_addr, TypeInt::INT, T_INT, MemNode::unordered);
4894 result_val->init_req(_fast_path2, loaded_hash);
4895 result_reg->init_req(_fast_path2, control());
4896 load_offset_runtime = false;
4897 }
4898 }
4899 }
4900
4901 //tty->print_cr("Load hash-offset at runtime: %s", BOOL_TO_STR(load_offset_runtime));
4902
4903 if (load_offset_runtime) {
4904 // We don't know if it is an array or an exact type, figure it out at run-time.
4905 // If not an ordinary instance, then we need to take slow-path.
4906 Node* kind_addr = basic_plus_adr(top(), obj_klass, Klass::kind_offset_in_bytes());
4907 Node* kind = make_load(control(), kind_addr, TypeInt::INT, T_INT, MemNode::unordered);
4908 Node* instance_val = _gvn.intcon(Klass::InstanceKlassKind);
4909 Node* chk_inst = _gvn.transform(new CmpINode(kind, instance_val));
4910 Node* test_inst = _gvn.transform(new BoolNode(chk_inst, BoolTest::ne));
4911 generate_slow_guard(test_inst, slow_region);
4912
4913 // Otherwise it's an instance and we can read the hash_offset from the InstanceKlass.
4914 Node* hash_offset_addr = basic_plus_adr(top(), obj_klass, InstanceKlass::hash_offset_offset_in_bytes());
4915 Node* hash_offset = make_load(control(), hash_offset_addr, TypeInt::INT, T_INT, MemNode::unordered);
4916 // hash_offset->dump();
4917 Node* hash_addr = basic_plus_adr(obj, ConvI2X(hash_offset));
4918 Compile::current()->set_has_unsafe_access(true);
4919 Node* loaded_hash = make_load(control(), hash_addr, TypeInt::INT, T_INT, MemNode::unordered);
4920 result_val->init_req(_fast_path2, loaded_hash);
4921 result_reg->init_req(_fast_path2, control());
4922 }
4923
4924 // Hashed-only path: recompute hash-code from object address.
4925 set_control(if_false);
4926 if (hashCode == 6) {
4927 // Our constants.
4928 Node* M = _gvn.intcon(0x337954D5);
4929 Node* A = _gvn.intcon(0xAAAAAAAA);
4930 // Split object address into lo and hi 32 bits.
4931 // Pin the address materialization to the current control (the post-check,
4932 // post-safepoint branch). With a null control input this CastP2X (and the
4933 // pure FastHash arithmetic that consumes it) is free-floating, so Global
4934 // Code Motion may hoist it above an intervening GC safepoint. If the GC
4935 // relocates the object, the oop reference is updated but the already
4936 // materialized raw address is not, and the recomputed hash would be based
4937 // on the stale pre-relocation address - violating identity-hash stability.
4938 Node* obj_addr = _gvn.transform(new CastP2XNode(control(), obj));
4939 Node* x = _gvn.transform(new ConvL2INode(obj_addr));
4940 Node* upper_addr = _gvn.transform(new URShiftLNode(obj_addr, _gvn.intcon(32)));
4941 Node* y = _gvn.transform(new ConvL2INode(upper_addr));
4942
4943 Node* H0 = _gvn.transform(new XorINode(x, y));
4944 Node* L0 = _gvn.transform(new XorINode(x, A));
4945
4946 // Full multiplication of two 32 bit values L0 and M into a hi/lo result in two 32 bit values V0 and U0.
4947 Node* L0_64 = _gvn.transform(new ConvI2LNode(L0));
4948 L0_64 = _gvn.transform(new AndLNode(L0_64, _gvn.longcon(0xFFFFFFFF)));
4949 Node* M_64 = _gvn.transform(new ConvI2LNode(M));
4950 // M_64 = _gvn.transform(new AndLNode(M_64, _gvn.longcon(0xFFFFFFFF)));
4951 Node* prod64 = _gvn.transform(new MulLNode(L0_64, M_64));
4952 Node* V0 = _gvn.transform(new ConvL2INode(prod64));
4953 Node* prod_upper = _gvn.transform(new URShiftLNode(prod64, _gvn.intcon(32)));
4954 Node* U0 = _gvn.transform(new ConvL2INode(prod_upper));
4955
4956 Node* Q0 = _gvn.transform(new MulINode(H0, M));
4957 Node* L1 = _gvn.transform(new XorINode(Q0, U0));
4958
4959 // Full multiplication of two 32 bit values L1 and M into a hi/lo result in two 32 bit values V1 and U1.
4960 Node* L1_64 = _gvn.transform(new ConvI2LNode(L1));
4961 L1_64 = _gvn.transform(new AndLNode(L1_64, _gvn.longcon(0xFFFFFFFF)));
4962 prod64 = _gvn.transform(new MulLNode(L1_64, M_64));
4963 Node* V1 = _gvn.transform(new ConvL2INode(prod64));
4964 prod_upper = _gvn.transform(new URShiftLNode(prod64, _gvn.intcon(32)));
4965 Node* U1 = _gvn.transform(new ConvL2INode(prod_upper));
4966
4967 Node* P1 = _gvn.transform(new XorINode(V0, M));
4968
4969 // Right rotate P1 by distance L1.
4970 Node* distance = _gvn.transform(new AndINode(L1, _gvn.intcon(32 - 1)));
4971 Node* inverse_distance = _gvn.transform(new SubINode(_gvn.intcon(32), distance));
4972 Node* ror_part1 = _gvn.transform(new URShiftINode(P1, distance));
4973 Node* ror_part2 = _gvn.transform(new LShiftINode(P1, inverse_distance));
4974 Node* Q1 = _gvn.transform(new OrINode(ror_part1, ror_part2));
4975
4976 Node* L2 = _gvn.transform(new XorINode(Q1, U1));
4977 Node* hash = _gvn.transform(new XorINode(V1, L2));
4978 Node* hash_truncated = _gvn.transform(new AndINode(hash, _gvn.intcon(markWord::hash_mask)));
4979
4980 result_val->init_req(_fast_path, hash_truncated);
4981 } else if (hashCode == 2) {
4982 result_val->init_req(_fast_path, _gvn.intcon(1));
4983 }
4984 } else {
4985 // Get the header out of the object, use LoadMarkNode when available
4986 Node* header_addr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes());
4987 // The control of the load must be null. Otherwise, the load can move before
4988 // the null check after castPP removal.
4989 Node* no_ctrl = nullptr;
4990 Node* header = make_load(no_ctrl, header_addr, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
4991
4992 if (!UseObjectMonitorTable) {
4993 // Test the header to see if it is safe to read w.r.t. locking.
4994 Node *lock_mask = _gvn.MakeConX(markWord::lock_mask_in_place);
4995 Node *lmasked_header = _gvn.transform(new AndXNode(header, lock_mask));
4996 Node *monitor_val = _gvn.MakeConX(markWord::monitor_value);
4997 Node *chk_monitor = _gvn.transform(new CmpXNode(lmasked_header, monitor_val));
4998 Node *test_monitor = _gvn.transform(new BoolNode(chk_monitor, BoolTest::eq));
4999
5000 generate_slow_guard(test_monitor, slow_region);
5001 }
5002
5003 // Get the hash value and check to see that it has been properly assigned.
5004 // We depend on hash_mask being at most 32 bits and avoid the use of
5005 // hash_mask_in_place because it could be larger than 32 bits in a 64-bit
5006 // vm: see markWord.hpp.
5007 Node *hash_mask = _gvn.intcon(markWord::hash_mask);
5008 Node *hash_shift = _gvn.intcon(markWord::hash_shift);
5009 Node *hshifted_header= _gvn.transform(new URShiftXNode(header, hash_shift));
5010 // This hack lets the hash bits live anywhere in the mark object now, as long
5011 // as the shift drops the relevant bits into the low 32 bits. Note that
5012 // Java spec says that HashCode is an int so there's no point in capturing
5013 // an 'X'-sized hashcode (32 in 32-bit build or 64 in 64-bit build).
5014 hshifted_header = ConvX2I(hshifted_header);
5015 Node *hash_val = _gvn.transform(new AndINode(hshifted_header, hash_mask));
5016
5017 Node *no_hash_val = _gvn.intcon(markWord::no_hash);
5018 Node *chk_assigned = _gvn.transform(new CmpINode( hash_val, no_hash_val));
5019 Node *test_assigned = _gvn.transform(new BoolNode( chk_assigned, BoolTest::eq));
5020
5021 generate_slow_guard(test_assigned, slow_region);
5022
5023 result_val->init_req(_fast_path, hash_val);
5024
5025 // _fast_path2 is not used here.
5026 result_val->del_req(_fast_path2);
5027 result_reg->del_req(_fast_path2);
5028 result_io->del_req(_fast_path2);
5029 result_mem->del_req(_fast_path2);
5030 }
5031
5032 Node* init_mem = reset_memory();
5033 // fill in the rest of the null path:
5034 result_io ->init_req(_null_path, i_o());
5035 result_mem->init_req(_null_path, init_mem);
5036
5037 result_reg->init_req(_fast_path, control());
5038 result_io ->init_req(_fast_path, i_o());
5039 result_mem->init_req(_fast_path, init_mem);
5040
5041 if (UseCompactObjectHeaders) {
5042 result_io->init_req(_fast_path2, i_o());
5043 result_mem->init_req(_fast_path2, init_mem);
5044 }
5045
5046 // Generate code for the slow case. We make a call to hashCode().
5047 assert(slow_region != nullptr, "must have slow_region");
5048 set_control(_gvn.transform(slow_region));
5049 if (!stopped()) {
5050 // No need for PreserveJVMState, because we're using up the present state.
5051 set_all_memory(init_mem);
5052 vmIntrinsics::ID hashCode_id = is_static ? vmIntrinsics::_identityHashCode : vmIntrinsics::_hashCode;
5053 CallJavaNode* slow_call = generate_method_call(hashCode_id, is_virtual, is_static, false);
5054 Node* slow_result = set_results_for_java_call(slow_call);
5055 // this->control() comes from set_results_for_java_call
5056 result_reg->init_req(_slow_path, control());
5057 result_val->init_req(_slow_path, slow_result);
5058 result_io ->set_req(_slow_path, i_o());
5059 result_mem ->set_req(_slow_path, reset_memory());
5060 }
5061
5062 // Return the combined state.
5063 set_i_o( _gvn.transform(result_io) );
5064 set_all_memory( _gvn.transform(result_mem));
5065
5066 set_result(result_reg, result_val);
5067 return true;
5800 _gvn.hash_delete(alloc);
5801 alloc->set_req(TypeFunc::Control, control());
5802 alloc->set_req(TypeFunc::I_O, i_o());
5803 Node *mem = reset_memory();
5804 set_all_memory(mem);
5805 alloc->set_req(TypeFunc::Memory, mem);
5806 set_control(init->proj_out_or_null(TypeFunc::Control));
5807 set_i_o(callprojs.fallthrough_ioproj);
5808
5809 // Update memory as done in GraphKit::set_output_for_allocation()
5810 const TypeInt* length_type = _gvn.find_int_type(alloc->in(AllocateNode::ALength));
5811 const TypeOopPtr* ary_type = _gvn.type(alloc->in(AllocateNode::KlassNode))->is_klassptr()->as_instance_type();
5812 if (ary_type->isa_aryptr() && length_type != nullptr) {
5813 ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
5814 }
5815 const TypePtr* telemref = ary_type->add_offset(Type::OffsetBot);
5816 int elemidx = C->get_alias_index(telemref);
5817 // Need to properly move every memory projection for the Initialize
5818 #ifdef ASSERT
5819 int mark_idx = C->get_alias_index(ary_type->add_offset(oopDesc::mark_offset_in_bytes()));
5820 int klass_idx = C->get_alias_index(ary_type->add_offset(Type::klass_offset()));
5821 #endif
5822 auto move_proj = [&](ProjNode* proj) {
5823 int alias_idx = C->get_alias_index(proj->adr_type());
5824 assert(alias_idx == Compile::AliasIdxRaw ||
5825 alias_idx == elemidx ||
5826 alias_idx == mark_idx ||
5827 alias_idx == klass_idx, "should be raw memory or array element type");
5828 set_memory(proj, alias_idx);
5829 };
5830 init->for_each_proj(move_proj, TypeFunc::Memory);
5831
5832 Node* allocx = _gvn.transform(alloc);
5833 assert(allocx == alloc, "where has the allocation gone?");
5834 assert(dest->is_CheckCastPP(), "not an allocation result?");
5835
5836 _gvn.hash_delete(dest);
5837 dest->set_req(0, control());
5838 Node* destx = _gvn.transform(dest);
5839 assert(destx == dest, "where has the allocation result gone?");
5840
|