< prev index next >

src/hotspot/share/oops/typeArrayKlass.cpp

Print this page

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

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

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