391 // The oopFactory likes to work with the element type.
392 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
393 result = oopFactory::new_typeArray_nozero(elem_type, len, THREAD);
394
395 // Pass oops back through thread local storage. Our apparent type to Java
396 // is that we return an oop, but we can block on exit from this routine and
397 // a GC can trash the oop in C's return register. The generated stub will
398 // fetch the oop from TLS after any possible GC.
399 deoptimize_caller_frame(current, HAS_PENDING_EXCEPTION);
400 current->set_vm_result_oop(result);
401 JRT_BLOCK_END;
402
403
404 // inform GC that we won't do card marks for initializing writes.
405 SharedRuntime::on_slowpath_allocation_exit(current);
406
407 oop result = current->vm_result_oop();
408 if ((len > 0) && (result != nullptr) &&
409 is_deoptimized_caller_frame(current)) {
410 // Zero array here if the caller is deoptimized.
411 const size_t size = TypeArrayKlass::cast(array_type)->oop_size(result);
412 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
413 size_t hs_bytes = arrayOopDesc::base_offset_in_bytes(elem_type);
414 assert(is_aligned(hs_bytes, BytesPerInt), "must be 4 byte aligned");
415 HeapWord* obj = cast_from_oop<HeapWord*>(result);
416 if (!is_aligned(hs_bytes, BytesPerLong)) {
417 *reinterpret_cast<jint*>(reinterpret_cast<char*>(obj) + hs_bytes) = 0;
418 hs_bytes += BytesPerInt;
419 }
420
421 // Optimized zeroing.
422 assert(is_aligned(hs_bytes, BytesPerLong), "must be 8-byte aligned");
423 const size_t aligned_hs = hs_bytes / BytesPerLong;
424 Copy::fill_to_aligned_words(obj+aligned_hs, size-aligned_hs);
425 }
426
427 JRT_END
428
429 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array.
430
431 // multianewarray for 2 dimensions
|
391 // The oopFactory likes to work with the element type.
392 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
393 result = oopFactory::new_typeArray_nozero(elem_type, len, THREAD);
394
395 // Pass oops back through thread local storage. Our apparent type to Java
396 // is that we return an oop, but we can block on exit from this routine and
397 // a GC can trash the oop in C's return register. The generated stub will
398 // fetch the oop from TLS after any possible GC.
399 deoptimize_caller_frame(current, HAS_PENDING_EXCEPTION);
400 current->set_vm_result_oop(result);
401 JRT_BLOCK_END;
402
403
404 // inform GC that we won't do card marks for initializing writes.
405 SharedRuntime::on_slowpath_allocation_exit(current);
406
407 oop result = current->vm_result_oop();
408 if ((len > 0) && (result != nullptr) &&
409 is_deoptimized_caller_frame(current)) {
410 // Zero array here if the caller is deoptimized.
411 const size_t size = TypeArrayKlass::cast(array_type)->oop_size(result, result->mark());
412 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
413 size_t hs_bytes = arrayOopDesc::base_offset_in_bytes(elem_type);
414 assert(is_aligned(hs_bytes, BytesPerInt), "must be 4 byte aligned");
415 HeapWord* obj = cast_from_oop<HeapWord*>(result);
416 if (!is_aligned(hs_bytes, BytesPerLong)) {
417 *reinterpret_cast<jint*>(reinterpret_cast<char*>(obj) + hs_bytes) = 0;
418 hs_bytes += BytesPerInt;
419 }
420
421 // Optimized zeroing.
422 assert(is_aligned(hs_bytes, BytesPerLong), "must be 8-byte aligned");
423 const size_t aligned_hs = hs_bytes / BytesPerLong;
424 Copy::fill_to_aligned_words(obj+aligned_hs, size-aligned_hs);
425 }
426
427 JRT_END
428
429 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array.
430
431 // multianewarray for 2 dimensions
|