< prev index next >

src/hotspot/share/oops/objArrayKlass.cpp

Print this page
rev 48688 : [mq]: arraycopy-access-barriers.patch


 250   }
 251 
 252   // Check is all offsets and lengths are non negative
 253   if (src_pos < 0 || dst_pos < 0 || length < 0) {
 254     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
 255   }
 256   // Check if the ranges are valid
 257   if  ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length())
 258      || (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) {
 259     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
 260   }
 261 
 262   // Special case. Boundary cases must be checked first
 263   // This allows the following call: copy_array(s, s.length(), d.length(), 0).
 264   // This is correct, since the position is supposed to be an 'in between point', i.e., s.length(),
 265   // points to the right of the last element.
 266   if (length==0) {
 267     return;
 268   }
 269 
 270   s = arrayOop(BarrierSet::barrier_set()->read_barrier(s));
 271   d = arrayOop(BarrierSet::barrier_set()->write_barrier(d));
 272 
 273   if (UseCompressedOops) {
 274     narrowOop* const src = objArrayOop(s)->obj_at_addr<narrowOop>(src_pos);
 275     narrowOop* const dst = objArrayOop(d)->obj_at_addr<narrowOop>(dst_pos);
 276     do_copy<narrowOop>(s, src, d, dst, length, CHECK);
 277   } else {
 278     oop* const src = objArrayOop(s)->obj_at_addr<oop>(src_pos);
 279     oop* const dst = objArrayOop(d)->obj_at_addr<oop>(dst_pos);
 280     do_copy<oop> (s, src, d, dst, length, CHECK);
 281   }
 282 }
 283 
 284 
 285 Klass* ObjArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
 286 
 287   assert(dimension() <= n, "check order of chain");
 288   int dim = dimension();
 289   if (dim == n) return this;
 290 
 291   // lock-free read needs acquire semantics
 292   if (higher_dimension_acquire() == NULL) {




 250   }
 251 
 252   // Check is all offsets and lengths are non negative
 253   if (src_pos < 0 || dst_pos < 0 || length < 0) {
 254     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
 255   }
 256   // Check if the ranges are valid
 257   if  ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length())
 258      || (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) {
 259     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
 260   }
 261 
 262   // Special case. Boundary cases must be checked first
 263   // This allows the following call: copy_array(s, s.length(), d.length(), 0).
 264   // This is correct, since the position is supposed to be an 'in between point', i.e., s.length(),
 265   // points to the right of the last element.
 266   if (length==0) {
 267     return;
 268   }
 269 



 270   if (UseCompressedOops) {
 271     narrowOop* const src = objArrayOop(s)->obj_at_addr<narrowOop>(src_pos);
 272     narrowOop* const dst = objArrayOop(d)->obj_at_addr<narrowOop>(dst_pos);
 273     do_copy<narrowOop>(s, src, d, dst, length, CHECK);
 274   } else {
 275     oop* const src = objArrayOop(s)->obj_at_addr<oop>(src_pos);
 276     oop* const dst = objArrayOop(d)->obj_at_addr<oop>(dst_pos);
 277     do_copy<oop> (s, src, d, dst, length, CHECK);
 278   }
 279 }
 280 
 281 
 282 Klass* ObjArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
 283 
 284   assert(dimension() <= n, "check order of chain");
 285   int dim = dimension();
 286   if (dim == n) return this;
 287 
 288   // lock-free read needs acquire semantics
 289   if (higher_dimension_acquire() == NULL) {


< prev index next >