8029858: Enhance array copies
Summary: Just read the source element once
Reviewed-by: coleenp, ahgross
--- a/hotspot/src/share/vm/oops/objArrayKlass.cpp Thu Feb 20 13:11:23 2014 -0500
+++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp Fri Jan 10 15:58:40 2014 +0100
@@ -269,7 +269,7 @@
if (element_is_null ||
(new_val->klass())->is_subtype_of(bound)) {
bs->write_ref_field_pre(p, new_val);
- *p = *from;
+ *p = element;
} else {
// We must do a barrier to cover the partial copy.
const size_t pd = pointer_delta(p, dst, (size_t)heapOopSize);