4712 // and skip a call to MH.linkTo*/invokeBasic adapter, additional information
4713 // about the method being invoked should be attached to the call site to
4714 // make resolution logic work (see SharedRuntime::resolve_{virtual,opt_virtual}_call_C).
4715 slow_call->set_override_symbolic_info(true);
4716 }
4717 set_arguments_for_java_call(slow_call);
4718 set_edges_for_java_call(slow_call);
4719 return slow_call;
4720 }
4721
4722
4723 /**
4724 * Build special case code for calls to hashCode on an object. This call may
4725 * be virtual (invokevirtual) or bound (invokespecial). For each case we generate
4726 * slightly different code.
4727 */
4728 bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) {
4729 assert(is_static == callee()->is_static(), "correct intrinsic selection");
4730 assert(!(is_virtual && is_static), "either virtual, special, or static");
4731
4732 enum { _slow_path = 1, _fast_path, _null_path, PATH_LIMIT };
4733
4734 RegionNode* result_reg = new RegionNode(PATH_LIMIT);
4735 PhiNode* result_val = new PhiNode(result_reg, TypeInt::INT);
4736 PhiNode* result_io = new PhiNode(result_reg, Type::ABIO);
4737 PhiNode* result_mem = new PhiNode(result_reg, Type::MEMORY, TypePtr::BOTTOM);
4738 Node* obj = nullptr;
4739 if (!is_static) {
4740 // Check for hashing null object
4741 obj = null_check_receiver();
4742 if (stopped()) return true; // unconditionally null
4743 result_reg->init_req(_null_path, top());
4744 result_val->init_req(_null_path, top());
4745 } else {
4746 // Do a null check, and return zero if null.
4747 // System.identityHashCode(null) == 0
4748 obj = argument(0);
4749 Node* null_ctl = top();
4750 obj = null_check_oop(obj, &null_ctl);
4751 result_reg->init_req(_null_path, null_ctl);
4752 result_val->init_req(_null_path, _gvn.intcon(0));
4760 return true;
4761 }
4762
4763 // We only go to the fast case code if we pass a number of guards. The
4764 // paths which do not pass are accumulated in the slow_region.
4765 RegionNode* slow_region = new RegionNode(1);
4766 record_for_igvn(slow_region);
4767
4768 // If this is a virtual call, we generate a funny guard. We pull out
4769 // the vtable entry corresponding to hashCode() from the target object.
4770 // If the target method which we are calling happens to be the native
4771 // Object hashCode() method, we pass the guard. We do not need this
4772 // guard for non-virtual calls -- the caller is known to be the native
4773 // Object hashCode().
4774 if (is_virtual) {
4775 // After null check, get the object's klass.
4776 Node* obj_klass = load_object_klass(obj);
4777 generate_virtual_guard(obj_klass, slow_region);
4778 }
4779
4780 // Get the header out of the object, use LoadMarkNode when available
4781 Node* header_addr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes());
4782 // The control of the load must be null. Otherwise, the load can move before
4783 // the null check after castPP removal.
4784 Node* no_ctrl = nullptr;
4785 Node* header = make_load(no_ctrl, header_addr, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
4786
4787 if (!UseObjectMonitorTable) {
4788 // Test the header to see if it is safe to read w.r.t. locking.
4789 Node *lock_mask = _gvn.MakeConX(markWord::lock_mask_in_place);
4790 Node *lmasked_header = _gvn.transform(new AndXNode(header, lock_mask));
4791 Node *monitor_val = _gvn.MakeConX(markWord::monitor_value);
4792 Node *chk_monitor = _gvn.transform(new CmpXNode(lmasked_header, monitor_val));
4793 Node *test_monitor = _gvn.transform(new BoolNode(chk_monitor, BoolTest::eq));
4794
4795 generate_slow_guard(test_monitor, slow_region);
4796 }
4797
4798 // Get the hash value and check to see that it has been properly assigned.
4799 // We depend on hash_mask being at most 32 bits and avoid the use of
4800 // hash_mask_in_place because it could be larger than 32 bits in a 64-bit
4801 // vm: see markWord.hpp.
4802 Node *hash_mask = _gvn.intcon(markWord::hash_mask);
4803 Node *hash_shift = _gvn.intcon(markWord::hash_shift);
4804 Node *hshifted_header= _gvn.transform(new URShiftXNode(header, hash_shift));
4805 // This hack lets the hash bits live anywhere in the mark object now, as long
4806 // as the shift drops the relevant bits into the low 32 bits. Note that
4807 // Java spec says that HashCode is an int so there's no point in capturing
4808 // an 'X'-sized hashcode (32 in 32-bit build or 64 in 64-bit build).
4809 hshifted_header = ConvX2I(hshifted_header);
4810 Node *hash_val = _gvn.transform(new AndINode(hshifted_header, hash_mask));
4811
4812 Node *no_hash_val = _gvn.intcon(markWord::no_hash);
4813 Node *chk_assigned = _gvn.transform(new CmpINode( hash_val, no_hash_val));
4814 Node *test_assigned = _gvn.transform(new BoolNode( chk_assigned, BoolTest::eq));
4815
4816 generate_slow_guard(test_assigned, slow_region);
4817
4818 Node* init_mem = reset_memory();
4819 // fill in the rest of the null path:
4820 result_io ->init_req(_null_path, i_o());
4821 result_mem->init_req(_null_path, init_mem);
4822
4823 result_val->init_req(_fast_path, hash_val);
4824 result_reg->init_req(_fast_path, control());
4825 result_io ->init_req(_fast_path, i_o());
4826 result_mem->init_req(_fast_path, init_mem);
4827
4828 // Generate code for the slow case. We make a call to hashCode().
4829 set_control(_gvn.transform(slow_region));
4830 if (!stopped()) {
4831 // No need for PreserveJVMState, because we're using up the present state.
4832 set_all_memory(init_mem);
4833 vmIntrinsics::ID hashCode_id = is_static ? vmIntrinsics::_identityHashCode : vmIntrinsics::_hashCode;
4834 CallJavaNode* slow_call = generate_method_call(hashCode_id, is_virtual, is_static, false);
4835 Node* slow_result = set_results_for_java_call(slow_call);
4836 // this->control() comes from set_results_for_java_call
4837 result_reg->init_req(_slow_path, control());
4838 result_val->init_req(_slow_path, slow_result);
4839 result_io ->set_req(_slow_path, i_o());
4840 result_mem ->set_req(_slow_path, reset_memory());
4841 }
4842
4843 // Return the combined state.
4844 set_i_o( _gvn.transform(result_io) );
4845 set_all_memory( _gvn.transform(result_mem));
4846
4847 set_result(result_reg, result_val);
4848 return true;
5581 _gvn.hash_delete(alloc);
5582 alloc->set_req(TypeFunc::Control, control());
5583 alloc->set_req(TypeFunc::I_O, i_o());
5584 Node *mem = reset_memory();
5585 set_all_memory(mem);
5586 alloc->set_req(TypeFunc::Memory, mem);
5587 set_control(init->proj_out_or_null(TypeFunc::Control));
5588 set_i_o(callprojs.fallthrough_ioproj);
5589
5590 // Update memory as done in GraphKit::set_output_for_allocation()
5591 const TypeInt* length_type = _gvn.find_int_type(alloc->in(AllocateNode::ALength));
5592 const TypeOopPtr* ary_type = _gvn.type(alloc->in(AllocateNode::KlassNode))->is_klassptr()->as_instance_type();
5593 if (ary_type->isa_aryptr() && length_type != nullptr) {
5594 ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
5595 }
5596 const TypePtr* telemref = ary_type->add_offset(Type::OffsetBot);
5597 int elemidx = C->get_alias_index(telemref);
5598 // Need to properly move every memory projection for the Initialize
5599 #ifdef ASSERT
5600 int mark_idx = C->get_alias_index(ary_type->add_offset(oopDesc::mark_offset_in_bytes()));
5601 int klass_idx = C->get_alias_index(ary_type->add_offset(oopDesc::klass_offset_in_bytes()));
5602 #endif
5603 auto move_proj = [&](ProjNode* proj) {
5604 int alias_idx = C->get_alias_index(proj->adr_type());
5605 assert(alias_idx == Compile::AliasIdxRaw ||
5606 alias_idx == elemidx ||
5607 alias_idx == mark_idx ||
5608 alias_idx == klass_idx, "should be raw memory or array element type");
5609 set_memory(proj, alias_idx);
5610 };
5611 init->for_each_proj(move_proj, TypeFunc::Memory);
5612
5613 Node* allocx = _gvn.transform(alloc);
5614 assert(allocx == alloc, "where has the allocation gone?");
5615 assert(dest->is_CheckCastPP(), "not an allocation result?");
5616
5617 _gvn.hash_delete(dest);
5618 dest->set_req(0, control());
5619 Node* destx = _gvn.transform(dest);
5620 assert(destx == dest, "where has the allocation result gone?");
5621
|
4712 // and skip a call to MH.linkTo*/invokeBasic adapter, additional information
4713 // about the method being invoked should be attached to the call site to
4714 // make resolution logic work (see SharedRuntime::resolve_{virtual,opt_virtual}_call_C).
4715 slow_call->set_override_symbolic_info(true);
4716 }
4717 set_arguments_for_java_call(slow_call);
4718 set_edges_for_java_call(slow_call);
4719 return slow_call;
4720 }
4721
4722
4723 /**
4724 * Build special case code for calls to hashCode on an object. This call may
4725 * be virtual (invokevirtual) or bound (invokespecial). For each case we generate
4726 * slightly different code.
4727 */
4728 bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) {
4729 assert(is_static == callee()->is_static(), "correct intrinsic selection");
4730 assert(!(is_virtual && is_static), "either virtual, special, or static");
4731
4732 enum { _slow_path = 1, _null_path, _fast_path, _fast_path2, PATH_LIMIT };
4733
4734 RegionNode* result_reg = new RegionNode(PATH_LIMIT);
4735 PhiNode* result_val = new PhiNode(result_reg, TypeInt::INT);
4736 PhiNode* result_io = new PhiNode(result_reg, Type::ABIO);
4737 PhiNode* result_mem = new PhiNode(result_reg, Type::MEMORY, TypePtr::BOTTOM);
4738 Node* obj = nullptr;
4739 if (!is_static) {
4740 // Check for hashing null object
4741 obj = null_check_receiver();
4742 if (stopped()) return true; // unconditionally null
4743 result_reg->init_req(_null_path, top());
4744 result_val->init_req(_null_path, top());
4745 } else {
4746 // Do a null check, and return zero if null.
4747 // System.identityHashCode(null) == 0
4748 obj = argument(0);
4749 Node* null_ctl = top();
4750 obj = null_check_oop(obj, &null_ctl);
4751 result_reg->init_req(_null_path, null_ctl);
4752 result_val->init_req(_null_path, _gvn.intcon(0));
4760 return true;
4761 }
4762
4763 // We only go to the fast case code if we pass a number of guards. The
4764 // paths which do not pass are accumulated in the slow_region.
4765 RegionNode* slow_region = new RegionNode(1);
4766 record_for_igvn(slow_region);
4767
4768 // If this is a virtual call, we generate a funny guard. We pull out
4769 // the vtable entry corresponding to hashCode() from the target object.
4770 // If the target method which we are calling happens to be the native
4771 // Object hashCode() method, we pass the guard. We do not need this
4772 // guard for non-virtual calls -- the caller is known to be the native
4773 // Object hashCode().
4774 if (is_virtual) {
4775 // After null check, get the object's klass.
4776 Node* obj_klass = load_object_klass(obj);
4777 generate_virtual_guard(obj_klass, slow_region);
4778 }
4779
4780 if (UseCompactObjectHeaders) {
4781 // Get the header out of the object.
4782 Node* header_addr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes());
4783 // The control of the load must be null. Otherwise, the load can move before
4784 // the null check after castPP removal.
4785 Node* no_ctrl = nullptr;
4786 Node* header = make_load(no_ctrl, header_addr, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
4787
4788 // Test the header to see if the object is in hashed or copied state.
4789 Node* hashctrl_mask = _gvn.MakeConX(markWord::hashctrl_mask_in_place);
4790 Node* masked_header = _gvn.transform(new AndXNode(header, hashctrl_mask));
4791
4792 // Take slow-path when the object has not been hashed.
4793 Node* not_hashed_val = _gvn.MakeConX(0);
4794 Node* chk_hashed = _gvn.transform(new CmpXNode(masked_header, not_hashed_val));
4795 Node* test_hashed = _gvn.transform(new BoolNode(chk_hashed, BoolTest::eq));
4796
4797 generate_slow_guard(test_hashed, slow_region);
4798
4799 // Test whether the object is hashed or hashed&copied.
4800 Node* hashed_copied = _gvn.MakeConX(markWord::hashctrl_expanded_mask_in_place | markWord::hashctrl_hashed_mask_in_place);
4801 Node* chk_copied = _gvn.transform(new CmpXNode(masked_header, hashed_copied));
4802 // If true, then object has been hashed&copied, otherwise it's only hashed.
4803 Node* test_copied = _gvn.transform(new BoolNode(chk_copied, BoolTest::eq));
4804 IfNode* if_copied = create_and_map_if(control(), test_copied, PROB_FAIR, COUNT_UNKNOWN);
4805 Node* if_true = _gvn.transform(new IfTrueNode(if_copied));
4806 Node* if_false = _gvn.transform(new IfFalseNode(if_copied));
4807
4808 // Hashed&Copied path: read hash-code out of the object.
4809 set_control(if_true);
4810 // result_val->del_req(_fast_path2);
4811 // result_reg->del_req(_fast_path2);
4812 // result_io->del_req(_fast_path2);
4813 // result_mem->del_req(_fast_path2);
4814
4815 Node* obj_klass = load_object_klass(obj);
4816 Node* hash_addr;
4817 const TypeKlassPtr* klass_t = _gvn.type(obj_klass)->isa_klassptr();
4818 bool load_offset_runtime = true;
4819
4820 if (klass_t != nullptr) {
4821 if (klass_t->klass_is_exact() && klass_t->isa_instklassptr()) {
4822 ciInstanceKlass* ciKlass = reinterpret_cast<ciInstanceKlass*>(klass_t->is_instklassptr()->exact_klass());
4823 if (!ciKlass->is_mirror_instance_klass() && !ciKlass->is_reference_instance_klass()) {
4824 // We know the InstanceKlass, load hash_offset from there at compile-time.
4825 int hash_offset = ciKlass->hash_offset_in_bytes();
4826 hash_addr = basic_plus_adr(obj, hash_offset);
4827 Node* loaded_hash = make_load(control(), hash_addr, TypeInt::INT, T_INT, MemNode::unordered);
4828 result_val->init_req(_fast_path2, loaded_hash);
4829 result_reg->init_req(_fast_path2, control());
4830 load_offset_runtime = false;
4831 }
4832 }
4833 }
4834
4835 //tty->print_cr("Load hash-offset at runtime: %s", BOOL_TO_STR(load_offset_runtime));
4836
4837 if (load_offset_runtime) {
4838 // We don't know if it is an array or an exact type, figure it out at run-time.
4839 // If not an ordinary instance, then we need to take slow-path.
4840 Node* kind_addr = basic_plus_adr(obj_klass, Klass::kind_offset_in_bytes());
4841 Node* kind = make_load(control(), kind_addr, TypeInt::INT, T_INT, MemNode::unordered);
4842 Node* instance_val = _gvn.intcon(Klass::InstanceKlassKind);
4843 Node* chk_inst = _gvn.transform(new CmpINode(kind, instance_val));
4844 Node* test_inst = _gvn.transform(new BoolNode(chk_inst, BoolTest::ne));
4845 generate_slow_guard(test_inst, slow_region);
4846
4847 // Otherwise it's an instance and we can read the hash_offset from the InstanceKlass.
4848 Node* hash_offset_addr = basic_plus_adr(obj_klass, InstanceKlass::hash_offset_offset_in_bytes());
4849 Node* hash_offset = make_load(control(), hash_offset_addr, TypeInt::INT, T_INT, MemNode::unordered);
4850 // hash_offset->dump();
4851 Node* hash_addr = basic_plus_adr(obj, ConvI2X(hash_offset));
4852 Compile::current()->set_has_unsafe_access(true);
4853 Node* loaded_hash = make_load(control(), hash_addr, TypeInt::INT, T_INT, MemNode::unordered);
4854 result_val->init_req(_fast_path2, loaded_hash);
4855 result_reg->init_req(_fast_path2, control());
4856 }
4857
4858 // Hashed-only path: recompute hash-code from object address.
4859 set_control(if_false);
4860 if (hashCode == 6) {
4861 // Our constants.
4862 Node* M = _gvn.intcon(0x337954D5);
4863 Node* A = _gvn.intcon(0xAAAAAAAA);
4864 // Split object address into lo and hi 32 bits.
4865 Node* obj_addr = _gvn.transform(new CastP2XNode(nullptr, obj));
4866 Node* x = _gvn.transform(new ConvL2INode(obj_addr));
4867 Node* upper_addr = _gvn.transform(new URShiftLNode(obj_addr, _gvn.intcon(32)));
4868 Node* y = _gvn.transform(new ConvL2INode(upper_addr));
4869
4870 Node* H0 = _gvn.transform(new XorINode(x, y));
4871 Node* L0 = _gvn.transform(new XorINode(x, A));
4872
4873 // Full multiplication of two 32 bit values L0 and M into a hi/lo result in two 32 bit values V0 and U0.
4874 Node* L0_64 = _gvn.transform(new ConvI2LNode(L0));
4875 L0_64 = _gvn.transform(new AndLNode(L0_64, _gvn.longcon(0xFFFFFFFF)));
4876 Node* M_64 = _gvn.transform(new ConvI2LNode(M));
4877 // M_64 = _gvn.transform(new AndLNode(M_64, _gvn.longcon(0xFFFFFFFF)));
4878 Node* prod64 = _gvn.transform(new MulLNode(L0_64, M_64));
4879 Node* V0 = _gvn.transform(new ConvL2INode(prod64));
4880 Node* prod_upper = _gvn.transform(new URShiftLNode(prod64, _gvn.intcon(32)));
4881 Node* U0 = _gvn.transform(new ConvL2INode(prod_upper));
4882
4883 Node* Q0 = _gvn.transform(new MulINode(H0, M));
4884 Node* L1 = _gvn.transform(new XorINode(Q0, U0));
4885
4886 // Full multiplication of two 32 bit values L1 and M into a hi/lo result in two 32 bit values V1 and U1.
4887 Node* L1_64 = _gvn.transform(new ConvI2LNode(L1));
4888 L1_64 = _gvn.transform(new AndLNode(L1_64, _gvn.longcon(0xFFFFFFFF)));
4889 prod64 = _gvn.transform(new MulLNode(L1_64, M_64));
4890 Node* V1 = _gvn.transform(new ConvL2INode(prod64));
4891 prod_upper = _gvn.transform(new URShiftLNode(prod64, _gvn.intcon(32)));
4892 Node* U1 = _gvn.transform(new ConvL2INode(prod_upper));
4893
4894 Node* P1 = _gvn.transform(new XorINode(V0, M));
4895
4896 // Right rotate P1 by distance L1.
4897 Node* distance = _gvn.transform(new AndINode(L1, _gvn.intcon(32 - 1)));
4898 Node* inverse_distance = _gvn.transform(new SubINode(_gvn.intcon(32), distance));
4899 Node* ror_part1 = _gvn.transform(new URShiftINode(P1, distance));
4900 Node* ror_part2 = _gvn.transform(new LShiftINode(P1, inverse_distance));
4901 Node* Q1 = _gvn.transform(new OrINode(ror_part1, ror_part2));
4902
4903 Node* L2 = _gvn.transform(new XorINode(Q1, U1));
4904 Node* hash = _gvn.transform(new XorINode(V1, L2));
4905 Node* hash_truncated = _gvn.transform(new AndINode(hash, _gvn.intcon(markWord::hash_mask)));
4906
4907 result_val->init_req(_fast_path, hash_truncated);
4908 } else if (hashCode == 2) {
4909 result_val->init_req(_fast_path, _gvn.intcon(1));
4910 }
4911 } else {
4912 // Get the header out of the object, use LoadMarkNode when available
4913 Node* header_addr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes());
4914 // The control of the load must be null. Otherwise, the load can move before
4915 // the null check after castPP removal.
4916 Node* no_ctrl = nullptr;
4917 Node* header = make_load(no_ctrl, header_addr, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
4918
4919 if (!UseObjectMonitorTable) {
4920 // Test the header to see if it is safe to read w.r.t. locking.
4921 Node *lock_mask = _gvn.MakeConX(markWord::lock_mask_in_place);
4922 Node *lmasked_header = _gvn.transform(new AndXNode(header, lock_mask));
4923 Node *monitor_val = _gvn.MakeConX(markWord::monitor_value);
4924 Node *chk_monitor = _gvn.transform(new CmpXNode(lmasked_header, monitor_val));
4925 Node *test_monitor = _gvn.transform(new BoolNode(chk_monitor, BoolTest::eq));
4926
4927 generate_slow_guard(test_monitor, slow_region);
4928 }
4929
4930 // Get the hash value and check to see that it has been properly assigned.
4931 // We depend on hash_mask being at most 32 bits and avoid the use of
4932 // hash_mask_in_place because it could be larger than 32 bits in a 64-bit
4933 // vm: see markWord.hpp.
4934 Node *hash_mask = _gvn.intcon(markWord::hash_mask);
4935 Node *hash_shift = _gvn.intcon(markWord::hash_shift);
4936 Node *hshifted_header= _gvn.transform(new URShiftXNode(header, hash_shift));
4937 // This hack lets the hash bits live anywhere in the mark object now, as long
4938 // as the shift drops the relevant bits into the low 32 bits. Note that
4939 // Java spec says that HashCode is an int so there's no point in capturing
4940 // an 'X'-sized hashcode (32 in 32-bit build or 64 in 64-bit build).
4941 hshifted_header = ConvX2I(hshifted_header);
4942 Node *hash_val = _gvn.transform(new AndINode(hshifted_header, hash_mask));
4943
4944 Node *no_hash_val = _gvn.intcon(markWord::no_hash);
4945 Node *chk_assigned = _gvn.transform(new CmpINode( hash_val, no_hash_val));
4946 Node *test_assigned = _gvn.transform(new BoolNode( chk_assigned, BoolTest::eq));
4947
4948 generate_slow_guard(test_assigned, slow_region);
4949
4950 result_val->init_req(_fast_path, hash_val);
4951
4952 // _fast_path2 is not used here.
4953 result_val->del_req(_fast_path2);
4954 result_reg->del_req(_fast_path2);
4955 result_io->del_req(_fast_path2);
4956 result_mem->del_req(_fast_path2);
4957 }
4958
4959 Node* init_mem = reset_memory();
4960 // fill in the rest of the null path:
4961 result_io ->init_req(_null_path, i_o());
4962 result_mem->init_req(_null_path, init_mem);
4963
4964 result_reg->init_req(_fast_path, control());
4965 result_io ->init_req(_fast_path, i_o());
4966 result_mem->init_req(_fast_path, init_mem);
4967
4968 if (UseCompactObjectHeaders) {
4969 result_io->init_req(_fast_path2, i_o());
4970 result_mem->init_req(_fast_path2, init_mem);
4971 }
4972
4973 // Generate code for the slow case. We make a call to hashCode().
4974 assert(slow_region != nullptr, "must have slow_region");
4975 set_control(_gvn.transform(slow_region));
4976 if (!stopped()) {
4977 // No need for PreserveJVMState, because we're using up the present state.
4978 set_all_memory(init_mem);
4979 vmIntrinsics::ID hashCode_id = is_static ? vmIntrinsics::_identityHashCode : vmIntrinsics::_hashCode;
4980 CallJavaNode* slow_call = generate_method_call(hashCode_id, is_virtual, is_static, false);
4981 Node* slow_result = set_results_for_java_call(slow_call);
4982 // this->control() comes from set_results_for_java_call
4983 result_reg->init_req(_slow_path, control());
4984 result_val->init_req(_slow_path, slow_result);
4985 result_io ->set_req(_slow_path, i_o());
4986 result_mem ->set_req(_slow_path, reset_memory());
4987 }
4988
4989 // Return the combined state.
4990 set_i_o( _gvn.transform(result_io) );
4991 set_all_memory( _gvn.transform(result_mem));
4992
4993 set_result(result_reg, result_val);
4994 return true;
5727 _gvn.hash_delete(alloc);
5728 alloc->set_req(TypeFunc::Control, control());
5729 alloc->set_req(TypeFunc::I_O, i_o());
5730 Node *mem = reset_memory();
5731 set_all_memory(mem);
5732 alloc->set_req(TypeFunc::Memory, mem);
5733 set_control(init->proj_out_or_null(TypeFunc::Control));
5734 set_i_o(callprojs.fallthrough_ioproj);
5735
5736 // Update memory as done in GraphKit::set_output_for_allocation()
5737 const TypeInt* length_type = _gvn.find_int_type(alloc->in(AllocateNode::ALength));
5738 const TypeOopPtr* ary_type = _gvn.type(alloc->in(AllocateNode::KlassNode))->is_klassptr()->as_instance_type();
5739 if (ary_type->isa_aryptr() && length_type != nullptr) {
5740 ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
5741 }
5742 const TypePtr* telemref = ary_type->add_offset(Type::OffsetBot);
5743 int elemidx = C->get_alias_index(telemref);
5744 // Need to properly move every memory projection for the Initialize
5745 #ifdef ASSERT
5746 int mark_idx = C->get_alias_index(ary_type->add_offset(oopDesc::mark_offset_in_bytes()));
5747 int klass_idx = C->get_alias_index(ary_type->add_offset(Type::klass_offset()));
5748 #endif
5749 auto move_proj = [&](ProjNode* proj) {
5750 int alias_idx = C->get_alias_index(proj->adr_type());
5751 assert(alias_idx == Compile::AliasIdxRaw ||
5752 alias_idx == elemidx ||
5753 alias_idx == mark_idx ||
5754 alias_idx == klass_idx, "should be raw memory or array element type");
5755 set_memory(proj, alias_idx);
5756 };
5757 init->for_each_proj(move_proj, TypeFunc::Memory);
5758
5759 Node* allocx = _gvn.transform(alloc);
5760 assert(allocx == alloc, "where has the allocation gone?");
5761 assert(dest->is_CheckCastPP(), "not an allocation result?");
5762
5763 _gvn.hash_delete(dest);
5764 dest->set_req(0, control());
5765 Node* destx = _gvn.transform(dest);
5766 assert(destx == dest, "where has the allocation result gone?");
5767
|