209 }
210 } else {
211 // Since this array dimension has zero length, nothing will be
212 // allocated, however the lower dimension values must be checked
213 // for illegal values.
214 for (int i = 0; i < rank - 1; ++i) {
215 sizes += 1;
216 if (*sizes < 0) {
217 THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
218 }
219 }
220 }
221 }
222 return h_array();
223 }
224
225 // Either oop or narrowOop depending on UseCompressedOops.
226 template <class T> void ObjArrayKlass::do_copy(arrayOop s, T* src,
227 arrayOop d, T* dst, int length, TRAPS) {
228
229 BarrierSet* bs = Universe::heap()->barrier_set();
230 // For performance reasons, we assume we are that the write barrier we
231 // are using has optimized modes for arrays of references. At least one
232 // of the asserts below will fail if this is not the case.
233 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt");
234 assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well.");
235
236 if (s == d) {
237 // since source and destination are equal we do not need conversion checks.
238 assert(length > 0, "sanity check");
239 bs->write_ref_array_pre(dst, length);
240 Copy::conjoint_oops_atomic(src, dst, length);
241 } else {
242 // We have to make sure all elements conform to the destination array
243 Klass* bound = ObjArrayKlass::cast(d->klass())->element_klass();
244 Klass* stype = ObjArrayKlass::cast(s->klass())->element_klass();
245 if (stype == bound || stype->is_subtype_of(bound)) {
246 // elements are guaranteed to be subtypes, so no check necessary
247 bs->write_ref_array_pre(dst, length);
248 Copy::conjoint_oops_atomic(src, dst, length);
249 } else {
|
209 }
210 } else {
211 // Since this array dimension has zero length, nothing will be
212 // allocated, however the lower dimension values must be checked
213 // for illegal values.
214 for (int i = 0; i < rank - 1; ++i) {
215 sizes += 1;
216 if (*sizes < 0) {
217 THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
218 }
219 }
220 }
221 }
222 return h_array();
223 }
224
225 // Either oop or narrowOop depending on UseCompressedOops.
226 template <class T> void ObjArrayKlass::do_copy(arrayOop s, T* src,
227 arrayOop d, T* dst, int length, TRAPS) {
228
229 BarrierSet* bs = GC::gc()->heap()->barrier_set();
230 // For performance reasons, we assume we are that the write barrier we
231 // are using has optimized modes for arrays of references. At least one
232 // of the asserts below will fail if this is not the case.
233 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt");
234 assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well.");
235
236 if (s == d) {
237 // since source and destination are equal we do not need conversion checks.
238 assert(length > 0, "sanity check");
239 bs->write_ref_array_pre(dst, length);
240 Copy::conjoint_oops_atomic(src, dst, length);
241 } else {
242 // We have to make sure all elements conform to the destination array
243 Klass* bound = ObjArrayKlass::cast(d->klass())->element_klass();
244 Klass* stype = ObjArrayKlass::cast(s->klass())->element_klass();
245 if (stype == bound || stype->is_subtype_of(bound)) {
246 // elements are guaranteed to be subtypes, so no check necessary
247 bs->write_ref_array_pre(dst, length);
248 Copy::conjoint_oops_atomic(src, dst, length);
249 } else {
|