roman_version
202 h_array->obj_at_put(index, sub_array);
203 }
204 } else {
205 // Since this array dimension has zero length, nothing will be
206 // allocated, however the lower dimension values must be checked
207 // for illegal values.
208 for (int i = 0; i < rank - 1; ++i) {
209 sizes += 1;
210 if (*sizes < 0) {
211 THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
212 }
213 }
214 }
215 }
216 return h_array();
217 }
218
219 // Either oop or narrowOop depending on UseCompressedOops.
220 template <class T> void ObjArrayKlass::do_copy(arrayOop s, T* src,
221 arrayOop d, T* dst, int length, TRAPS) {
222 if (s == d) {
223 // since source and destination are equal we do not need conversion checks.
224 assert(length > 0, "sanity check");
225 HeapAccess<>::oop_arraycopy(s, d, src, dst, length);
226 } else {
227 // We have to make sure all elements conform to the destination array
228 Klass* bound = ObjArrayKlass::cast(d->klass())->element_klass();
229 Klass* stype = ObjArrayKlass::cast(s->klass())->element_klass();
230 if (stype == bound || stype->is_subtype_of(bound)) {
231 // elements are guaranteed to be subtypes, so no check necessary
232 HeapAccess<ARRAYCOPY_DISJOINT>::oop_arraycopy(s, d, src, dst, length);
233 } else {
234 // slow case: need individual subtype checks
235 // note: don't use obj_at_put below because it includes a redundant store check
236 if (!HeapAccess<ARRAYCOPY_DISJOINT | ARRAYCOPY_CHECKCAST>::oop_arraycopy(s, d, src, dst, length)) {
237 THROW(vmSymbols::java_lang_ArrayStoreException());
238 }
239 }
240 }
241 }
|
202 h_array->obj_at_put(index, sub_array);
203 }
204 } else {
205 // Since this array dimension has zero length, nothing will be
206 // allocated, however the lower dimension values must be checked
207 // for illegal values.
208 for (int i = 0; i < rank - 1; ++i) {
209 sizes += 1;
210 if (*sizes < 0) {
211 THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
212 }
213 }
214 }
215 }
216 return h_array();
217 }
218
219 // Either oop or narrowOop depending on UseCompressedOops.
220 template <class T> void ObjArrayKlass::do_copy(arrayOop s, T* src,
221 arrayOop d, T* dst, int length, TRAPS) {
222 if (oopDesc::equals(s, d)) {
223 // since source and destination are equal we do not need conversion checks.
224 assert(length > 0, "sanity check");
225 HeapAccess<>::oop_arraycopy(s, d, src, dst, length);
226 } else {
227 // We have to make sure all elements conform to the destination array
228 Klass* bound = ObjArrayKlass::cast(d->klass())->element_klass();
229 Klass* stype = ObjArrayKlass::cast(s->klass())->element_klass();
230 if (stype == bound || stype->is_subtype_of(bound)) {
231 // elements are guaranteed to be subtypes, so no check necessary
232 HeapAccess<ARRAYCOPY_DISJOINT>::oop_arraycopy(s, d, src, dst, length);
233 } else {
234 // slow case: need individual subtype checks
235 // note: don't use obj_at_put below because it includes a redundant store check
236 if (!HeapAccess<ARRAYCOPY_DISJOINT | ARRAYCOPY_CHECKCAST>::oop_arraycopy(s, d, src, dst, length)) {
237 THROW(vmSymbols::java_lang_ArrayStoreException());
238 }
239 }
240 }
241 }
|