< prev index next >

src/hotspot/share/oops/typeArrayKlass.cpp

Print this page

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

175   typeArrayOop t = typeArrayOop(obj);
176   return t->object_size(this);
177 }
178 
179 void TypeArrayKlass::initialize(TRAPS) {
180   // Nothing to do. Having this function is handy since objArrayKlasses can be
181   // initialized by calling initialize on their bottom_klass, see ObjArrayKlass::initialize
182 }
183 
184 const char* TypeArrayKlass::external_name(BasicType type) {
185   switch (type) {
186     case T_BOOLEAN: return "[Z";
187     case T_CHAR:    return "[C";
188     case T_FLOAT:   return "[F";
189     case T_DOUBLE:  return "[D";
190     case T_BYTE:    return "[B";
191     case T_SHORT:   return "[S";
192     case T_INT:     return "[I";
193     case T_LONG:    return "[J";
194     default: ShouldNotReachHere();

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