4054 if (stopped()) return true;
4055
4056 Node* orig_length = load_array_length(original);
4057
4058 Node* klass_node = load_klass_from_mirror(array_type_mirror, false, NULL, 0);
4059 klass_node = null_check(klass_node);
4060
4061 RegionNode* bailout = new RegionNode(1);
4062 record_for_igvn(bailout);
4063
4064 // Despite the generic type of Arrays.copyOf, the mirror might be int, int[], etc.
4065 // Bail out if that is so.
4066 // Value type array may have object field that would require a
4067 // write barrier. Conservatively, go to slow path.
4068 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
4069 Node* not_objArray = !bs->array_copy_requires_gc_barriers(false, T_OBJECT, false, BarrierSetC2::Parsing) ?
4070 generate_typeArray_guard(klass_node, bailout) : generate_non_objArray_guard(klass_node, bailout);
4071 if (not_objArray != NULL) {
4072 // Improve the klass node's type from the new optimistic assumption:
4073 ciKlass* ak = ciArrayKlass::make(env()->Object_klass());
4074 const Type* akls = TypeKlassPtr::make(TypePtr::NotNull, ak, Type::Offset(0));
4075 Node* cast = new CastPPNode(klass_node, akls);
4076 cast->init_req(0, control());
4077 klass_node = _gvn.transform(cast);
4078 }
4079
4080 Node* original_kls = load_object_klass(original);
4081 // ArrayCopyNode:Ideal may transform the ArrayCopyNode to
4082 // loads/stores but it is legal only if we're sure the
4083 // Arrays.copyOf would succeed. So we need all input arguments
4084 // to the copyOf to be validated, including that the copy to the
4085 // new array won't trigger an ArrayStoreException. That subtype
4086 // check can be optimized if we know something on the type of
4087 // the input array from type speculation.
4088 if (_gvn.type(klass_node)->singleton() && !stopped()) {
4089 ciKlass* subk = _gvn.type(original_kls)->is_klassptr()->klass();
4090 ciKlass* superk = _gvn.type(klass_node)->is_klassptr()->klass();
4091
4092 int test = C->static_subtype_check(superk, subk);
4093 if (test != Compile::SSC_always_true && test != Compile::SSC_always_false) {
4094 const TypeOopPtr* t_original = _gvn.type(original)->is_oopptr();
|
4054 if (stopped()) return true;
4055
4056 Node* orig_length = load_array_length(original);
4057
4058 Node* klass_node = load_klass_from_mirror(array_type_mirror, false, NULL, 0);
4059 klass_node = null_check(klass_node);
4060
4061 RegionNode* bailout = new RegionNode(1);
4062 record_for_igvn(bailout);
4063
4064 // Despite the generic type of Arrays.copyOf, the mirror might be int, int[], etc.
4065 // Bail out if that is so.
4066 // Value type array may have object field that would require a
4067 // write barrier. Conservatively, go to slow path.
4068 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
4069 Node* not_objArray = !bs->array_copy_requires_gc_barriers(false, T_OBJECT, false, BarrierSetC2::Parsing) ?
4070 generate_typeArray_guard(klass_node, bailout) : generate_non_objArray_guard(klass_node, bailout);
4071 if (not_objArray != NULL) {
4072 // Improve the klass node's type from the new optimistic assumption:
4073 ciKlass* ak = ciArrayKlass::make(env()->Object_klass());
4074 const Type* akls = TypeKlassPtr::make(TypePtr::NotNull, ak, Type::Offset(0), false);
4075 Node* cast = new CastPPNode(klass_node, akls);
4076 cast->init_req(0, control());
4077 klass_node = _gvn.transform(cast);
4078 }
4079
4080 Node* original_kls = load_object_klass(original);
4081 // ArrayCopyNode:Ideal may transform the ArrayCopyNode to
4082 // loads/stores but it is legal only if we're sure the
4083 // Arrays.copyOf would succeed. So we need all input arguments
4084 // to the copyOf to be validated, including that the copy to the
4085 // new array won't trigger an ArrayStoreException. That subtype
4086 // check can be optimized if we know something on the type of
4087 // the input array from type speculation.
4088 if (_gvn.type(klass_node)->singleton() && !stopped()) {
4089 ciKlass* subk = _gvn.type(original_kls)->is_klassptr()->klass();
4090 ciKlass* superk = _gvn.type(klass_node)->is_klassptr()->klass();
4091
4092 int test = C->static_subtype_check(superk, subk);
4093 if (test != Compile::SSC_always_true && test != Compile::SSC_always_false) {
4094 const TypeOopPtr* t_original = _gvn.type(original)->is_oopptr();
|