< prev index next >

src/hotspot/share/oops/objArrayKlass.cpp

Print this page
rev 49250 : [mq]: JDK-8199781.patch


 203         h_array->obj_at_put(index, sub_array);
 204       }
 205     } else {
 206       // Since this array dimension has zero length, nothing will be
 207       // allocated, however the lower dimension values must be checked
 208       // for illegal values.
 209       for (int i = 0; i < rank - 1; ++i) {
 210         sizes += 1;
 211         if (*sizes < 0) {
 212           THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
 213         }
 214       }
 215     }
 216   }
 217   return h_array();
 218 }
 219 
 220 // Either oop or narrowOop depending on UseCompressedOops.
 221 template <class T> void ObjArrayKlass::do_copy(arrayOop s, T* src,
 222                                arrayOop d, T* dst, int length, TRAPS) {
 223   if (s == d) {
 224     // since source and destination are equal we do not need conversion checks.
 225     assert(length > 0, "sanity check");
 226     HeapAccess<>::oop_arraycopy(s, d, src, dst, length);
 227   } else {
 228     // We have to make sure all elements conform to the destination array
 229     Klass* bound = ObjArrayKlass::cast(d->klass())->element_klass();
 230     Klass* stype = ObjArrayKlass::cast(s->klass())->element_klass();
 231     if (stype == bound || stype->is_subtype_of(bound)) {
 232       // elements are guaranteed to be subtypes, so no check necessary
 233       HeapAccess<ARRAYCOPY_DISJOINT>::oop_arraycopy(s, d, src, dst, length);
 234     } else {
 235       // slow case: need individual subtype checks
 236       // note: don't use obj_at_put below because it includes a redundant store check
 237       if (!HeapAccess<ARRAYCOPY_DISJOINT | ARRAYCOPY_CHECKCAST>::oop_arraycopy(s, d, src, dst, length)) {
 238         THROW(vmSymbols::java_lang_ArrayStoreException());
 239       }
 240     }
 241   }
 242 }
 243 




 203         h_array->obj_at_put(index, sub_array);
 204       }
 205     } else {
 206       // Since this array dimension has zero length, nothing will be
 207       // allocated, however the lower dimension values must be checked
 208       // for illegal values.
 209       for (int i = 0; i < rank - 1; ++i) {
 210         sizes += 1;
 211         if (*sizes < 0) {
 212           THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
 213         }
 214       }
 215     }
 216   }
 217   return h_array();
 218 }
 219 
 220 // Either oop or narrowOop depending on UseCompressedOops.
 221 template <class T> void ObjArrayKlass::do_copy(arrayOop s, T* src,
 222                                arrayOop d, T* dst, int length, TRAPS) {
 223   if (oopDesc::equals(s, d)) {
 224     // since source and destination are equal we do not need conversion checks.
 225     assert(length > 0, "sanity check");
 226     HeapAccess<>::oop_arraycopy(s, d, src, dst, length);
 227   } else {
 228     // We have to make sure all elements conform to the destination array
 229     Klass* bound = ObjArrayKlass::cast(d->klass())->element_klass();
 230     Klass* stype = ObjArrayKlass::cast(s->klass())->element_klass();
 231     if (stype == bound || stype->is_subtype_of(bound)) {
 232       // elements are guaranteed to be subtypes, so no check necessary
 233       HeapAccess<ARRAYCOPY_DISJOINT>::oop_arraycopy(s, d, src, dst, length);
 234     } else {
 235       // slow case: need individual subtype checks
 236       // note: don't use obj_at_put below because it includes a redundant store check
 237       if (!HeapAccess<ARRAYCOPY_DISJOINT | ARRAYCOPY_CHECKCAST>::oop_arraycopy(s, d, src, dst, length)) {
 238         THROW(vmSymbols::java_lang_ArrayStoreException());
 239       }
 240     }
 241   }
 242 }
 243 


< prev index next >