< prev index next >

src/hotspot/share/oops/typeArrayKlass.cpp

Print this page

156                (unsigned int) length + (unsigned int) src_pos,
157                type2name_tab[ArrayKlass::cast(s->klass())->element_type()], s->length());
158     } else {
159       ss.print("arraycopy: last destination index %u out of bounds for %s[%d]",
160                (unsigned int) length + (unsigned int) dst_pos,
161                type2name_tab[ArrayKlass::cast(d->klass())->element_type()], d->length());
162     }
163     THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
164   }
165   // Check zero copy
166   if (length == 0)
167     return;
168 
169   // This is an attempt to make the copy_array fast.
170   int l2es = log2_element_size();
171   size_t src_offset = arrayOopDesc::base_offset_in_bytes(element_type()) + ((size_t)src_pos << l2es);
172   size_t dst_offset = arrayOopDesc::base_offset_in_bytes(element_type()) + ((size_t)dst_pos << l2es);
173   ArrayAccess<ARRAYCOPY_ATOMIC>::arraycopy<void>(s, src_offset, d, dst_offset, (size_t)length << l2es);
174 }
175 
176 size_t TypeArrayKlass::oop_size(oop obj) const {
177   // In this assert, we cannot safely access the Klass* with compact headers.
178   assert(UseCompactObjectHeaders || obj->is_typeArray(),"must be a type array");
179   typeArrayOop t = typeArrayOop(obj);
180   return t->object_size(this);

181 }
182 
183 void TypeArrayKlass::initialize(TRAPS) {
184   // Nothing to do. Having this function is handy since objArrayKlasses can be
185   // initialized by calling initialize on their bottom_klass, see ObjArrayKlass::initialize
186 }
187 
188 const char* TypeArrayKlass::external_name(BasicType type) {
189   switch (type) {
190     case T_BOOLEAN: return "[Z";
191     case T_CHAR:    return "[C";
192     case T_FLOAT:   return "[F";
193     case T_DOUBLE:  return "[D";
194     case T_BYTE:    return "[B";
195     case T_SHORT:   return "[S";
196     case T_INT:     return "[I";
197     case T_LONG:    return "[J";
198     default: ShouldNotReachHere();
199   }
200   return nullptr;

156                (unsigned int) length + (unsigned int) src_pos,
157                type2name_tab[ArrayKlass::cast(s->klass())->element_type()], s->length());
158     } else {
159       ss.print("arraycopy: last destination index %u out of bounds for %s[%d]",
160                (unsigned int) length + (unsigned int) dst_pos,
161                type2name_tab[ArrayKlass::cast(d->klass())->element_type()], d->length());
162     }
163     THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
164   }
165   // Check zero copy
166   if (length == 0)
167     return;
168 
169   // This is an attempt to make the copy_array fast.
170   int l2es = log2_element_size();
171   size_t src_offset = arrayOopDesc::base_offset_in_bytes(element_type()) + ((size_t)src_pos << l2es);
172   size_t dst_offset = arrayOopDesc::base_offset_in_bytes(element_type()) + ((size_t)dst_pos << l2es);
173   ArrayAccess<ARRAYCOPY_ATOMIC>::arraycopy<void>(s, src_offset, d, dst_offset, (size_t)length << l2es);
174 }
175 
176 size_t TypeArrayKlass::oop_size(oop obj, markWord mark) const {
177   // In this assert, we cannot safely access the Klass* with compact headers.
178   assert(UseCompactObjectHeaders || obj->is_typeArray(),"must be a type array");
179   typeArrayOop t = typeArrayOop(obj);
180   int length = LP64_ONLY(UseCompactObjectHeaders ? mark.array_length() :) t->length();
181   return t->object_size(this, length);
182 }
183 
184 void TypeArrayKlass::initialize(TRAPS) {
185   // Nothing to do. Having this function is handy since objArrayKlasses can be
186   // initialized by calling initialize on their bottom_klass, see ObjArrayKlass::initialize
187 }
188 
189 const char* TypeArrayKlass::external_name(BasicType type) {
190   switch (type) {
191     case T_BOOLEAN: return "[Z";
192     case T_CHAR:    return "[C";
193     case T_FLOAT:   return "[F";
194     case T_DOUBLE:  return "[D";
195     case T_BYTE:    return "[B";
196     case T_SHORT:   return "[S";
197     case T_INT:     return "[I";
198     case T_LONG:    return "[J";
199     default: ShouldNotReachHere();
200   }
201   return nullptr;
< prev index next >