4473 const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM; |
4473 const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM; |
4474 |
4474 |
4475 ArrayCopyNode* ac = ArrayCopyNode::make(this, false, src, NULL, dest, NULL, countx, false); |
4475 ArrayCopyNode* ac = ArrayCopyNode::make(this, false, src, NULL, dest, NULL, countx, false); |
4476 ac->set_clonebasic(); |
4476 ac->set_clonebasic(); |
4477 Node* n = _gvn.transform(ac); |
4477 Node* n = _gvn.transform(ac); |
4478 assert(n == ac, "cannot disappear"); |
4478 if (n == ac) { |
4479 set_predefined_output_for_runtime_call(ac, ac->in(TypeFunc::Memory), raw_adr_type); |
4479 set_predefined_output_for_runtime_call(ac, ac->in(TypeFunc::Memory), raw_adr_type); |
|
4480 } else { |
|
4481 set_all_memory(n); |
|
4482 } |
4480 |
4483 |
4481 // If necessary, emit some card marks afterwards. (Non-arrays only.) |
4484 // If necessary, emit some card marks afterwards. (Non-arrays only.) |
4482 if (card_mark) { |
4485 if (card_mark) { |
4483 assert(!is_array, ""); |
4486 assert(!is_array, ""); |
4484 // Put in store barrier for any and all oops we are sticking |
4487 // Put in store barrier for any and all oops we are sticking |
4539 jvms()->set_should_reexecute(true); |
4542 jvms()->set_should_reexecute(true); |
4540 |
4543 |
4541 Node* obj = null_check_receiver(); |
4544 Node* obj = null_check_receiver(); |
4542 if (stopped()) return true; |
4545 if (stopped()) return true; |
4543 |
4546 |
|
4547 const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr(); |
|
4548 |
|
4549 // If we are going to clone an instance, we need its exact type to |
|
4550 // know the number and types of fields to convert the clone to |
|
4551 // loads/stores. Maybe a speculative type can help us. |
|
4552 if (!obj_type->klass_is_exact() && |
|
4553 obj_type->speculative_type() != NULL && |
|
4554 obj_type->speculative_type()->is_instance_klass()) { |
|
4555 ciInstanceKlass* spec_ik = obj_type->speculative_type()->as_instance_klass(); |
|
4556 if (spec_ik->nof_nonstatic_fields() <= ArrayCopyLoadStoreMaxElem && |
|
4557 !spec_ik->has_injected_fields()) { |
|
4558 ciKlass* k = obj_type->klass(); |
|
4559 if (!k->is_instance_klass() || |
|
4560 k->as_instance_klass()->is_interface() || |
|
4561 k->as_instance_klass()->has_subklass()) { |
|
4562 obj = maybe_cast_profiled_obj(obj, obj_type->speculative_type(), false); |
|
4563 } |
|
4564 } |
|
4565 } |
|
4566 |
4544 Node* obj_klass = load_object_klass(obj); |
4567 Node* obj_klass = load_object_klass(obj); |
4545 const TypeKlassPtr* tklass = _gvn.type(obj_klass)->isa_klassptr(); |
4568 const TypeKlassPtr* tklass = _gvn.type(obj_klass)->isa_klassptr(); |
4546 const TypeOopPtr* toop = ((tklass != NULL) |
4569 const TypeOopPtr* toop = ((tklass != NULL) |
4547 ? tklass->as_instance_type() |
4570 ? tklass->as_instance_type() |
4548 : TypeInstPtr::NOTNULL); |
4571 : TypeInstPtr::NOTNULL); |
4741 |
4764 |
4742 sfpt->set_i_o(map()->i_o()); |
4765 sfpt->set_i_o(map()->i_o()); |
4743 sfpt->set_memory(map()->memory()); |
4766 sfpt->set_memory(map()->memory()); |
4744 } |
4767 } |
4745 |
4768 |
4746 bool notest = false; |
4769 bool validated = false; |
4747 |
4770 |
4748 const Type* src_type = _gvn.type(src); |
4771 const Type* src_type = _gvn.type(src); |
4749 const Type* dest_type = _gvn.type(dest); |
4772 const Type* dest_type = _gvn.type(dest); |
4750 const TypeAryPtr* top_src = src_type->isa_aryptr(); |
4773 const TypeAryPtr* top_src = src_type->isa_aryptr(); |
4751 const TypeAryPtr* top_dest = dest_type->isa_aryptr(); |
4774 const TypeAryPtr* top_dest = dest_type->isa_aryptr(); |
4845 } |
4868 } |
4846 } |
4869 } |
4847 |
4870 |
4848 if (!too_many_traps(Deoptimization::Reason_intrinsic) && !src->is_top() && !dest->is_top()) { |
4871 if (!too_many_traps(Deoptimization::Reason_intrinsic) && !src->is_top() && !dest->is_top()) { |
4849 // validate arguments: enables transformation the ArrayCopyNode |
4872 // validate arguments: enables transformation the ArrayCopyNode |
4850 notest = true; |
4873 validated = true; |
4851 |
4874 |
4852 RegionNode* slow_region = new RegionNode(1); |
4875 RegionNode* slow_region = new RegionNode(1); |
4853 record_for_igvn(slow_region); |
4876 record_for_igvn(slow_region); |
4854 |
4877 |
4855 // (1) src and dest are arrays. |
4878 // (1) src and dest are arrays. |
4920 // so the compiler has a chance to eliminate them: during macro expansion, |
4943 // so the compiler has a chance to eliminate them: during macro expansion, |
4921 // we have to set their control (CastPP nodes are eliminated). |
4944 // we have to set their control (CastPP nodes are eliminated). |
4922 load_object_klass(src), load_object_klass(dest), |
4945 load_object_klass(src), load_object_klass(dest), |
4923 load_array_length(src), load_array_length(dest)); |
4946 load_array_length(src), load_array_length(dest)); |
4924 |
4947 |
4925 if (notest) { |
4948 ac->set_arraycopy(validated); |
4926 ac->set_arraycopy_notest(); |
|
4927 } |
|
4928 |
4949 |
4929 Node* n = _gvn.transform(ac); |
4950 Node* n = _gvn.transform(ac); |
4930 assert(n == ac, "cannot disappear"); |
4951 if (n == ac) { |
4931 ac->connect_outputs(this); |
4952 ac->connect_outputs(this); |
|
4953 } else { |
|
4954 assert(validated, "shouldn't transform if all arguments not validated"); |
|
4955 set_all_memory(n); |
|
4956 } |
4932 |
4957 |
4933 return true; |
4958 return true; |
4934 } |
4959 } |
4935 |
4960 |
4936 |
4961 |