< prev index next >

src/hotspot/share/opto/library_call.cpp

Print this page




3990     if (stopped())  return true;
3991 
3992     Node* orig_length = load_array_length(original);
3993 
3994     Node* klass_node = load_klass_from_mirror(array_type_mirror, false, NULL, 0);
3995     klass_node = null_check(klass_node);
3996 
3997     RegionNode* bailout = new RegionNode(1);
3998     record_for_igvn(bailout);
3999 
4000     // Despite the generic type of Arrays.copyOf, the mirror might be int, int[], etc.
4001     // Bail out if that is so.
4002     // Value type array may have object field that would require a
4003     // write barrier. Conservatively, go to slow path.
4004     BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
4005     Node* not_objArray = !bs->array_copy_requires_gc_barriers(false, T_OBJECT, false, BarrierSetC2::Parsing) ?
4006         generate_typeArray_guard(klass_node, bailout) : generate_non_objArray_guard(klass_node, bailout);
4007     if (not_objArray != NULL) {
4008       // Improve the klass node's type from the new optimistic assumption:
4009       ciKlass* ak = ciArrayKlass::make(env()->Object_klass());
4010       const Type* akls = TypeKlassPtr::make(TypePtr::NotNull, ak, Type::Offset(0));
4011       Node* cast = new CastPPNode(klass_node, akls);
4012       cast->init_req(0, control());
4013       klass_node = _gvn.transform(cast);
4014     }
4015 
4016     Node* original_kls = load_object_klass(original);
4017     // ArrayCopyNode:Ideal may transform the ArrayCopyNode to
4018     // loads/stores but it is legal only if we're sure the
4019     // Arrays.copyOf would succeed. So we need all input arguments
4020     // to the copyOf to be validated, including that the copy to the
4021     // new array won't trigger an ArrayStoreException. That subtype
4022     // check can be optimized if we know something on the type of
4023     // the input array from type speculation.
4024     if (_gvn.type(klass_node)->singleton() && !stopped()) {
4025       ciKlass* subk   = _gvn.type(original_kls)->is_klassptr()->klass();
4026       ciKlass* superk = _gvn.type(klass_node)->is_klassptr()->klass();
4027 
4028       int test = C->static_subtype_check(superk, subk);
4029       if (test != Compile::SSC_always_true && test != Compile::SSC_always_false) {
4030         const TypeOopPtr* t_original = _gvn.type(original)->is_oopptr();




3990     if (stopped())  return true;
3991 
3992     Node* orig_length = load_array_length(original);
3993 
3994     Node* klass_node = load_klass_from_mirror(array_type_mirror, false, NULL, 0);
3995     klass_node = null_check(klass_node);
3996 
3997     RegionNode* bailout = new RegionNode(1);
3998     record_for_igvn(bailout);
3999 
4000     // Despite the generic type of Arrays.copyOf, the mirror might be int, int[], etc.
4001     // Bail out if that is so.
4002     // Value type array may have object field that would require a
4003     // write barrier. Conservatively, go to slow path.
4004     BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
4005     Node* not_objArray = !bs->array_copy_requires_gc_barriers(false, T_OBJECT, false, BarrierSetC2::Parsing) ?
4006         generate_typeArray_guard(klass_node, bailout) : generate_non_objArray_guard(klass_node, bailout);
4007     if (not_objArray != NULL) {
4008       // Improve the klass node's type from the new optimistic assumption:
4009       ciKlass* ak = ciArrayKlass::make(env()->Object_klass());
4010       const Type* akls = TypeKlassPtr::make(TypePtr::NotNull, ak, Type::Offset(0), false);
4011       Node* cast = new CastPPNode(klass_node, akls);
4012       cast->init_req(0, control());
4013       klass_node = _gvn.transform(cast);
4014     }
4015 
4016     Node* original_kls = load_object_klass(original);
4017     // ArrayCopyNode:Ideal may transform the ArrayCopyNode to
4018     // loads/stores but it is legal only if we're sure the
4019     // Arrays.copyOf would succeed. So we need all input arguments
4020     // to the copyOf to be validated, including that the copy to the
4021     // new array won't trigger an ArrayStoreException. That subtype
4022     // check can be optimized if we know something on the type of
4023     // the input array from type speculation.
4024     if (_gvn.type(klass_node)->singleton() && !stopped()) {
4025       ciKlass* subk   = _gvn.type(original_kls)->is_klassptr()->klass();
4026       ciKlass* superk = _gvn.type(klass_node)->is_klassptr()->klass();
4027 
4028       int test = C->static_subtype_check(superk, subk);
4029       if (test != Compile::SSC_always_true && test != Compile::SSC_always_false) {
4030         const TypeOopPtr* t_original = _gvn.type(original)->is_oopptr();


< prev index next >