src/hotspot/share/oops/objArrayKlass.cpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54847 59ea39bb2809
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
   210 }
   210 }
   211 
   211 
   212 // Either oop or narrowOop depending on UseCompressedOops.
   212 // Either oop or narrowOop depending on UseCompressedOops.
   213 void ObjArrayKlass::do_copy(arrayOop s, size_t src_offset,
   213 void ObjArrayKlass::do_copy(arrayOop s, size_t src_offset,
   214                             arrayOop d, size_t dst_offset, int length, TRAPS) {
   214                             arrayOop d, size_t dst_offset, int length, TRAPS) {
   215   if (oopDesc::equals(s, d)) {
   215   if (s == d) {
   216     // since source and destination are equal we do not need conversion checks.
   216     // since source and destination are equal we do not need conversion checks.
   217     assert(length > 0, "sanity check");
   217     assert(length > 0, "sanity check");
   218     ArrayAccess<>::oop_arraycopy(s, src_offset, d, dst_offset, length);
   218     ArrayAccess<>::oop_arraycopy(s, src_offset, d, dst_offset, length);
   219   } else {
   219   } else {
   220     // We have to make sure all elements conform to the destination array
   220     // We have to make sure all elements conform to the destination array
   326   int dim = dimension();
   326   int dim = dimension();
   327   if (dim == n) return this;
   327   if (dim == n) return this;
   328 
   328 
   329   // lock-free read needs acquire semantics
   329   // lock-free read needs acquire semantics
   330   if (higher_dimension_acquire() == NULL) {
   330   if (higher_dimension_acquire() == NULL) {
   331     if (or_null)  return NULL;
   331     if (or_null) return NULL;
   332 
   332 
   333     ResourceMark rm;
   333     ResourceMark rm;
   334     JavaThread *jt = (JavaThread *)THREAD;
   334     JavaThread *jt = (JavaThread *)THREAD;
   335     {
   335     {
   336       // Ensure atomic creation of higher dimensions
   336       // Ensure atomic creation of higher dimensions
   347         // use 'release' to pair with lock-free load
   347         // use 'release' to pair with lock-free load
   348         release_set_higher_dimension(ak);
   348         release_set_higher_dimension(ak);
   349         assert(ak->is_objArray_klass(), "incorrect initialization of ObjArrayKlass");
   349         assert(ak->is_objArray_klass(), "incorrect initialization of ObjArrayKlass");
   350       }
   350       }
   351     }
   351     }
   352   } else {
       
   353     CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
       
   354   }
   352   }
   355 
   353 
   356   ObjArrayKlass *ak = ObjArrayKlass::cast(higher_dimension());
   354   ObjArrayKlass *ak = ObjArrayKlass::cast(higher_dimension());
   357   if (or_null) {
   355   if (or_null) {
   358     return ak->array_klass_or_null(n);
   356     return ak->array_klass_or_null(n);
   359   }
   357   }
       
   358   THREAD->check_possible_safepoint();
   360   return ak->array_klass(n, THREAD);
   359   return ak->array_klass(n, THREAD);
   361 }
   360 }
   362 
   361 
   363 Klass* ObjArrayKlass::array_klass_impl(bool or_null, TRAPS) {
   362 Klass* ObjArrayKlass::array_klass_impl(bool or_null, TRAPS) {
   364   return array_klass_impl(or_null, dimension() +  1, THREAD);
   363   return array_klass_impl(or_null, dimension() +  1, THREAD);