< prev index next >

src/hotspot/share/oops/objArrayKlass.cpp

Print this page
rev 50331 : 8198285: More consistent Access API for arraycopy
rev 50332 : [mq]: JDK-8203232-2.patch
rev 50333 : [mq]: JDK-8198285-3.patch

*** 221,242 **** template <class T> void ObjArrayKlass::do_copy(arrayOop s, size_t src_offset, arrayOop d, size_t dst_offset, int length, TRAPS) { if (oopDesc::equals(s, d)) { // since source and destination are equal we do not need conversion checks. assert(length > 0, "sanity check"); ! ArrayAccess<>::oop_arraycopy<T>(s, src_offset, d, dst_offset, length); } else { // We have to make sure all elements conform to the destination array Klass* bound = ObjArrayKlass::cast(d->klass())->element_klass(); Klass* stype = ObjArrayKlass::cast(s->klass())->element_klass(); if (stype == bound || stype->is_subtype_of(bound)) { // elements are guaranteed to be subtypes, so no check necessary ! ArrayAccess<ARRAYCOPY_DISJOINT>::oop_arraycopy<T>(s, src_offset, d, dst_offset, length); } else { // slow case: need individual subtype checks // note: don't use obj_at_put below because it includes a redundant store check ! if (!ArrayAccess<ARRAYCOPY_DISJOINT | ARRAYCOPY_CHECKCAST>::oop_arraycopy<T>(s, src_offset, d, dst_offset, length)) { THROW(vmSymbols::java_lang_ArrayStoreException()); } } } } --- 221,242 ---- template <class T> void ObjArrayKlass::do_copy(arrayOop s, size_t src_offset, arrayOop d, size_t dst_offset, int length, TRAPS) { if (oopDesc::equals(s, d)) { // since source and destination are equal we do not need conversion checks. assert(length > 0, "sanity check"); ! ArrayAccess<>::template oop_arraycopy<T>(s, src_offset, d, dst_offset, length); } else { // We have to make sure all elements conform to the destination array Klass* bound = ObjArrayKlass::cast(d->klass())->element_klass(); Klass* stype = ObjArrayKlass::cast(s->klass())->element_klass(); if (stype == bound || stype->is_subtype_of(bound)) { // elements are guaranteed to be subtypes, so no check necessary ! ArrayAccess<ARRAYCOPY_DISJOINT>::template oop_arraycopy<T>(s, src_offset, d, dst_offset, length); } else { // slow case: need individual subtype checks // note: don't use obj_at_put below because it includes a redundant store check ! if (!ArrayAccess<ARRAYCOPY_DISJOINT | ARRAYCOPY_CHECKCAST>::template oop_arraycopy<T>(s, src_offset, d, dst_offset, length)) { THROW(vmSymbols::java_lang_ArrayStoreException()); } } } }
< prev index next >