< prev index next >

src/share/vm/opto/library_call.cpp

Print this page
rev 11803 : 8159611: C2: ArrayCopy elimination skips required parameter checks


5026 
5027     // (2) src and dest arrays must have elements of the same BasicType
5028     // done at macro expansion or at Ideal transformation time
5029 
5030     // (4) src_offset must not be negative.
5031     generate_negative_guard(src_offset, slow_region);
5032 
5033     // (5) dest_offset must not be negative.
5034     generate_negative_guard(dest_offset, slow_region);
5035 
5036     // (7) src_offset + length must not exceed length of src.
5037     generate_limit_guard(src_offset, length,
5038                          load_array_length(src),
5039                          slow_region);
5040 
5041     // (8) dest_offset + length must not exceed length of dest.
5042     generate_limit_guard(dest_offset, length,
5043                          load_array_length(dest),
5044                          slow_region);
5045 








5046     // (9) each element of an oop array must be assignable
5047     Node* src_klass  = load_object_klass(src);
5048     Node* dest_klass = load_object_klass(dest);
5049     Node* not_subtype_ctrl = gen_subtype_check(src_klass, dest_klass);
5050 
5051     if (not_subtype_ctrl != top()) {
5052       PreserveJVMState pjvms(this);
5053       set_control(not_subtype_ctrl);
5054       uncommon_trap(Deoptimization::Reason_intrinsic,
5055                     Deoptimization::Action_make_not_entrant);
5056       assert(stopped(), "Should be stopped");
5057     }
5058     {
5059       PreserveJVMState pjvms(this);
5060       set_control(_gvn.transform(slow_region));
5061       uncommon_trap(Deoptimization::Reason_intrinsic,
5062                     Deoptimization::Action_make_not_entrant);
5063       assert(stopped(), "Should be stopped");
5064     }
5065   }




5026 
5027     // (2) src and dest arrays must have elements of the same BasicType
5028     // done at macro expansion or at Ideal transformation time
5029 
5030     // (4) src_offset must not be negative.
5031     generate_negative_guard(src_offset, slow_region);
5032 
5033     // (5) dest_offset must not be negative.
5034     generate_negative_guard(dest_offset, slow_region);
5035 
5036     // (7) src_offset + length must not exceed length of src.
5037     generate_limit_guard(src_offset, length,
5038                          load_array_length(src),
5039                          slow_region);
5040 
5041     // (8) dest_offset + length must not exceed length of dest.
5042     generate_limit_guard(dest_offset, length,
5043                          load_array_length(dest),
5044                          slow_region);
5045 
5046     // (6) length must not be negative.
5047     // This is also checked in generate_arraycopy() during macro expansion, but
5048     // we also have to check it here for the case where the ArrayCopyNode will
5049     // be eliminated by Escape Analysis.
5050     if (EliminateAllocations) {
5051       generate_negative_guard(length, slow_region);
5052     }
5053 
5054     // (9) each element of an oop array must be assignable
5055     Node* src_klass  = load_object_klass(src);
5056     Node* dest_klass = load_object_klass(dest);
5057     Node* not_subtype_ctrl = gen_subtype_check(src_klass, dest_klass);
5058 
5059     if (not_subtype_ctrl != top()) {
5060       PreserveJVMState pjvms(this);
5061       set_control(not_subtype_ctrl);
5062       uncommon_trap(Deoptimization::Reason_intrinsic,
5063                     Deoptimization::Action_make_not_entrant);
5064       assert(stopped(), "Should be stopped");
5065     }
5066     {
5067       PreserveJVMState pjvms(this);
5068       set_control(_gvn.transform(slow_region));
5069       uncommon_trap(Deoptimization::Reason_intrinsic,
5070                     Deoptimization::Action_make_not_entrant);
5071       assert(stopped(), "Should be stopped");
5072     }
5073   }


< prev index next >