< prev index next >

src/share/vm/oops/typeArrayKlass.cpp

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


 131   assert(s->is_typeArray(), "must be type array");
 132 
 133   // Check destination
 134   if (!d->is_typeArray() || element_type() != TypeArrayKlass::cast(d->klass())->element_type()) {
 135     THROW(vmSymbols::java_lang_ArrayStoreException());
 136   }
 137 
 138   // Check is all offsets and lengths are non negative
 139   if (src_pos < 0 || dst_pos < 0 || length < 0) {
 140     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
 141   }
 142   // Check if the ranges are valid
 143   if  ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length())
 144      || (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) {
 145     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
 146   }
 147   // Check zero copy
 148   if (length == 0)
 149     return;
 150 



 151   // This is an attempt to make the copy_array fast.
 152   int l2es = log2_element_size();
 153   int ihs = array_header_in_bytes() / wordSize;
 154   char* src = (char*) ((oop*)s + ihs) + ((size_t)src_pos << l2es);
 155   char* dst = (char*) ((oop*)d + ihs) + ((size_t)dst_pos << l2es);
 156   Copy::conjoint_memory_atomic(src, dst, (size_t)length << l2es);
 157 }
 158 
 159 
 160 // create a klass of array holding typeArrays
 161 Klass* TypeArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
 162   int dim = dimension();
 163   assert(dim <= n, "check order of chain");
 164     if (dim == n)
 165       return this;
 166 
 167   if (higher_dimension() == NULL) {
 168     if (or_null)  return NULL;
 169 
 170     ResourceMark rm;




 131   assert(s->is_typeArray(), "must be type array");
 132 
 133   // Check destination
 134   if (!d->is_typeArray() || element_type() != TypeArrayKlass::cast(d->klass())->element_type()) {
 135     THROW(vmSymbols::java_lang_ArrayStoreException());
 136   }
 137 
 138   // Check is all offsets and lengths are non negative
 139   if (src_pos < 0 || dst_pos < 0 || length < 0) {
 140     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
 141   }
 142   // Check if the ranges are valid
 143   if  ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length())
 144      || (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) {
 145     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
 146   }
 147   // Check zero copy
 148   if (length == 0)
 149     return;
 150 
 151   s = arrayOop(oopDesc::bs()->resolve_oop(s));
 152   d = arrayOop(oopDesc::bs()->resolve_and_maybe_copy_oop(d));
 153 
 154   // This is an attempt to make the copy_array fast.
 155   int l2es = log2_element_size();
 156   int ihs = array_header_in_bytes() / wordSize;
 157   char* src = (char*) ((oop*)s + ihs) + ((size_t)src_pos << l2es);
 158   char* dst = (char*) ((oop*)d + ihs) + ((size_t)dst_pos << l2es);
 159   Copy::conjoint_memory_atomic(src, dst, (size_t)length << l2es);
 160 }
 161 
 162 
 163 // create a klass of array holding typeArrays
 164 Klass* TypeArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
 165   int dim = dimension();
 166   assert(dim <= n, "check order of chain");
 167     if (dim == n)
 168       return this;
 169 
 170   if (higher_dimension() == NULL) {
 171     if (or_null)  return NULL;
 172 
 173     ResourceMark rm;


< prev index next >