< prev index next >

src/share/vm/oops/objArrayKlass.cpp

Print this page
rev 8961 : [mq]: diff-shenandoah.patch


 281     THROW(vmSymbols::java_lang_ArrayStoreException());
 282   }
 283 
 284   // Check is all offsets and lengths are non negative
 285   if (src_pos < 0 || dst_pos < 0 || length < 0) {
 286     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
 287   }
 288   // Check if the ranges are valid
 289   if  ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length())
 290      || (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) {
 291     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
 292   }
 293 
 294   // Special case. Boundary cases must be checked first
 295   // This allows the following call: copy_array(s, s.length(), d.length(), 0).
 296   // This is correct, since the position is supposed to be an 'in between point', i.e., s.length(),
 297   // points to the right of the last element.
 298   if (length==0) {
 299     return;
 300   }




 301   if (UseCompressedOops) {
 302     narrowOop* const src = objArrayOop(s)->obj_at_addr<narrowOop>(src_pos);
 303     narrowOop* const dst = objArrayOop(d)->obj_at_addr<narrowOop>(dst_pos);
 304     do_copy<narrowOop>(s, src, d, dst, length, CHECK);
 305   } else {
 306     oop* const src = objArrayOop(s)->obj_at_addr<oop>(src_pos);
 307     oop* const dst = objArrayOop(d)->obj_at_addr<oop>(dst_pos);
 308     do_copy<oop> (s, src, d, dst, length, CHECK);
 309   }
 310 }
 311 
 312 
 313 Klass* ObjArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
 314 
 315   assert(dimension() <= n, "check order of chain");
 316   int dim = dimension();
 317   if (dim == n) return this;
 318 
 319   if (higher_dimension() == NULL) {
 320     if (or_null)  return NULL;




 281     THROW(vmSymbols::java_lang_ArrayStoreException());
 282   }
 283 
 284   // Check is all offsets and lengths are non negative
 285   if (src_pos < 0 || dst_pos < 0 || length < 0) {
 286     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
 287   }
 288   // Check if the ranges are valid
 289   if  ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length())
 290      || (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) {
 291     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
 292   }
 293 
 294   // Special case. Boundary cases must be checked first
 295   // This allows the following call: copy_array(s, s.length(), d.length(), 0).
 296   // This is correct, since the position is supposed to be an 'in between point', i.e., s.length(),
 297   // points to the right of the last element.
 298   if (length==0) {
 299     return;
 300   }
 301 
 302   s = arrayOop(oopDesc::bs()->resolve_oop(s));
 303   d = arrayOop(oopDesc::bs()->resolve_and_maybe_copy_oop(d));
 304 
 305   if (UseCompressedOops) {
 306     narrowOop* const src = objArrayOop(s)->obj_at_addr<narrowOop>(src_pos);
 307     narrowOop* const dst = objArrayOop(d)->obj_at_addr<narrowOop>(dst_pos);
 308     do_copy<narrowOop>(s, src, d, dst, length, CHECK);
 309   } else {
 310     oop* const src = objArrayOop(s)->obj_at_addr<oop>(src_pos);
 311     oop* const dst = objArrayOop(d)->obj_at_addr<oop>(dst_pos);
 312     do_copy<oop> (s, src, d, dst, length, CHECK);
 313   }
 314 }
 315 
 316 
 317 Klass* ObjArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
 318 
 319   assert(dimension() <= n, "check order of chain");
 320   int dim = dimension();
 321   if (dim == n) return this;
 322 
 323   if (higher_dimension() == NULL) {
 324     if (or_null)  return NULL;


< prev index next >