< prev index next >
src/share/vm/opto/library_call.cpp
Print this page
rev 11803 : 8159611: C2: ArrayCopy elimination skips required parameter checks
*** 5041,5050 ****
--- 5041,5058 ----
// (8) dest_offset + length must not exceed length of dest.
generate_limit_guard(dest_offset, length,
load_array_length(dest),
slow_region);
+ // (6) length must not be negative.
+ // This is also checked in generate_arraycopy() during macro expansion, but
+ // we also have to check it here for the case where the ArrayCopyNode will
+ // be eliminated by Escape Analysis.
+ if (EliminateAllocations) {
+ generate_negative_guard(length, slow_region);
+ }
+
// (9) each element of an oop array must be assignable
Node* src_klass = load_object_klass(src);
Node* dest_klass = load_object_klass(dest);
Node* not_subtype_ctrl = gen_subtype_check(src_klass, dest_klass);
< prev index next >