4641 bool has_src = (top_src != NULL && top_src->klass() != NULL);
4642 // Do we have the type of dest?
4643 bool has_dest = (top_dest != NULL && top_dest->klass() != NULL);
4644 // Is the type for src from speculation?
4645 bool src_spec = false;
4646 // Is the type for dest from speculation?
4647 bool dest_spec = false;
4648
4649 if (!has_src || !has_dest) {
4650 // We don't have sufficient type information, let's see if
4651 // speculative types can help. We need to have types for both src
4652 // and dest so that it pays off.
4653
4654 // Do we already have or could we have type information for src
4655 bool could_have_src = has_src;
4656 // Do we already have or could we have type information for dest
4657 bool could_have_dest = has_dest;
4658
4659 ciKlass* src_k = NULL;
4660 if (!has_src) {
4661 src_k = src_type->speculative_type();
4662 if (src_k != NULL && src_k->is_array_klass()) {
4663 could_have_src = true;
4664 }
4665 }
4666
4667 ciKlass* dest_k = NULL;
4668 if (!has_dest) {
4669 dest_k = dest_type->speculative_type();
4670 if (dest_k != NULL && dest_k->is_array_klass()) {
4671 could_have_dest = true;
4672 }
4673 }
4674
4675 if (could_have_src && could_have_dest) {
4676 // This is going to pay off so emit the required guards
4677 if (!has_src) {
4678 src = maybe_cast_profiled_obj(src, src_k);
4679 src_type = _gvn.type(src);
4680 top_src = src_type->isa_aryptr();
4681 has_src = (top_src != NULL && top_src->klass() != NULL);
4682 src_spec = true;
4683 }
4684 if (!has_dest) {
4685 dest = maybe_cast_profiled_obj(dest, dest_k);
4686 dest_type = _gvn.type(dest);
4687 top_dest = dest_type->isa_aryptr();
4688 has_dest = (top_dest != NULL && top_dest->klass() != NULL);
4689 dest_spec = true;
4721 // The component types are not the same or are not recognized. Punt.
4722 // (But, avoid the native method wrapper to JVM_ArrayCopy.)
4723 generate_slow_arraycopy(TypePtr::BOTTOM,
4724 src, src_offset, dest, dest_offset, length,
4725 /*dest_uninitialized*/false);
4726 return true;
4727 }
4728
4729 if (src_elem == T_OBJECT) {
4730 // If both arrays are object arrays then having the exact types
4731 // for both will remove the need for a subtype check at runtime
4732 // before the call and may make it possible to pick a faster copy
4733 // routine (without a subtype check on every element)
4734 // Do we have the exact type of src?
4735 bool could_have_src = src_spec;
4736 // Do we have the exact type of dest?
4737 bool could_have_dest = dest_spec;
4738 ciKlass* src_k = top_src->klass();
4739 ciKlass* dest_k = top_dest->klass();
4740 if (!src_spec) {
4741 src_k = src_type->speculative_type();
4742 if (src_k != NULL && src_k->is_array_klass()) {
4743 could_have_src = true;
4744 }
4745 }
4746 if (!dest_spec) {
4747 dest_k = dest_type->speculative_type();
4748 if (dest_k != NULL && dest_k->is_array_klass()) {
4749 could_have_dest = true;
4750 }
4751 }
4752 if (could_have_src && could_have_dest) {
4753 // If we can have both exact types, emit the missing guards
4754 if (could_have_src && !src_spec) {
4755 src = maybe_cast_profiled_obj(src, src_k);
4756 }
4757 if (could_have_dest && !dest_spec) {
4758 dest = maybe_cast_profiled_obj(dest, dest_k);
4759 }
4760 }
4761 }
4762
4763 //---------------------------------------------------------------------------
4764 // We will make a fast path for this call to arraycopy.
4765
4766 // We have the following tests left to perform:
4767 //
|
4641 bool has_src = (top_src != NULL && top_src->klass() != NULL);
4642 // Do we have the type of dest?
4643 bool has_dest = (top_dest != NULL && top_dest->klass() != NULL);
4644 // Is the type for src from speculation?
4645 bool src_spec = false;
4646 // Is the type for dest from speculation?
4647 bool dest_spec = false;
4648
4649 if (!has_src || !has_dest) {
4650 // We don't have sufficient type information, let's see if
4651 // speculative types can help. We need to have types for both src
4652 // and dest so that it pays off.
4653
4654 // Do we already have or could we have type information for src
4655 bool could_have_src = has_src;
4656 // Do we already have or could we have type information for dest
4657 bool could_have_dest = has_dest;
4658
4659 ciKlass* src_k = NULL;
4660 if (!has_src) {
4661 src_k = src_type->speculative_type_not_null();
4662 if (src_k != NULL && src_k->is_array_klass()) {
4663 could_have_src = true;
4664 }
4665 }
4666
4667 ciKlass* dest_k = NULL;
4668 if (!has_dest) {
4669 dest_k = dest_type->speculative_type_not_null();
4670 if (dest_k != NULL && dest_k->is_array_klass()) {
4671 could_have_dest = true;
4672 }
4673 }
4674
4675 if (could_have_src && could_have_dest) {
4676 // This is going to pay off so emit the required guards
4677 if (!has_src) {
4678 src = maybe_cast_profiled_obj(src, src_k);
4679 src_type = _gvn.type(src);
4680 top_src = src_type->isa_aryptr();
4681 has_src = (top_src != NULL && top_src->klass() != NULL);
4682 src_spec = true;
4683 }
4684 if (!has_dest) {
4685 dest = maybe_cast_profiled_obj(dest, dest_k);
4686 dest_type = _gvn.type(dest);
4687 top_dest = dest_type->isa_aryptr();
4688 has_dest = (top_dest != NULL && top_dest->klass() != NULL);
4689 dest_spec = true;
4721 // The component types are not the same or are not recognized. Punt.
4722 // (But, avoid the native method wrapper to JVM_ArrayCopy.)
4723 generate_slow_arraycopy(TypePtr::BOTTOM,
4724 src, src_offset, dest, dest_offset, length,
4725 /*dest_uninitialized*/false);
4726 return true;
4727 }
4728
4729 if (src_elem == T_OBJECT) {
4730 // If both arrays are object arrays then having the exact types
4731 // for both will remove the need for a subtype check at runtime
4732 // before the call and may make it possible to pick a faster copy
4733 // routine (without a subtype check on every element)
4734 // Do we have the exact type of src?
4735 bool could_have_src = src_spec;
4736 // Do we have the exact type of dest?
4737 bool could_have_dest = dest_spec;
4738 ciKlass* src_k = top_src->klass();
4739 ciKlass* dest_k = top_dest->klass();
4740 if (!src_spec) {
4741 src_k = src_type->speculative_type_not_null();
4742 if (src_k != NULL && src_k->is_array_klass()) {
4743 could_have_src = true;
4744 }
4745 }
4746 if (!dest_spec) {
4747 dest_k = dest_type->speculative_type_not_null();
4748 if (dest_k != NULL && dest_k->is_array_klass()) {
4749 could_have_dest = true;
4750 }
4751 }
4752 if (could_have_src && could_have_dest) {
4753 // If we can have both exact types, emit the missing guards
4754 if (could_have_src && !src_spec) {
4755 src = maybe_cast_profiled_obj(src, src_k);
4756 }
4757 if (could_have_dest && !dest_spec) {
4758 dest = maybe_cast_profiled_obj(dest, dest_k);
4759 }
4760 }
4761 }
4762
4763 //---------------------------------------------------------------------------
4764 // We will make a fast path for this call to arraycopy.
4765
4766 // We have the following tests left to perform:
4767 //
|