414 // The oopFactory likes to work with the element type.
415 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
416 result = oopFactory::new_typeArray_nozero(elem_type, len, THREAD);
417
418 // Pass oops back through thread local storage. Our apparent type to Java
419 // is that we return an oop, but we can block on exit from this routine and
420 // a GC can trash the oop in C's return register. The generated stub will
421 // fetch the oop from TLS after any possible GC.
422 deoptimize_caller_frame(current, HAS_PENDING_EXCEPTION);
423 current->set_vm_result_oop(result);
424 JRT_BLOCK_END;
425
426
427 // inform GC that we won't do card marks for initializing writes.
428 SharedRuntime::on_slowpath_allocation_exit(current);
429
430 oop result = current->vm_result_oop();
431 if ((len > 0) && (result != nullptr) &&
432 is_deoptimized_caller_frame(current)) {
433 // Zero array here if the caller is deoptimized.
434 const size_t size = TypeArrayKlass::cast(array_type)->oop_size(result);
435 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
436 size_t hs_bytes = arrayOopDesc::base_offset_in_bytes(elem_type);
437 assert(is_aligned(hs_bytes, BytesPerInt), "must be 4 byte aligned");
438 HeapWord* obj = cast_from_oop<HeapWord*>(result);
439 if (!is_aligned(hs_bytes, BytesPerLong)) {
440 *reinterpret_cast<jint*>(reinterpret_cast<char*>(obj) + hs_bytes) = 0;
441 hs_bytes += BytesPerInt;
442 }
443
444 // Optimized zeroing.
445 assert(is_aligned(hs_bytes, BytesPerLong), "must be 8-byte aligned");
446 const size_t aligned_hs = hs_bytes / BytesPerLong;
447 Copy::fill_to_aligned_words(obj+aligned_hs, size-aligned_hs);
448 }
449
450 JRT_END
451
452 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array.
453
454 // multianewarray for 2 dimensions
|
414 // The oopFactory likes to work with the element type.
415 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
416 result = oopFactory::new_typeArray_nozero(elem_type, len, THREAD);
417
418 // Pass oops back through thread local storage. Our apparent type to Java
419 // is that we return an oop, but we can block on exit from this routine and
420 // a GC can trash the oop in C's return register. The generated stub will
421 // fetch the oop from TLS after any possible GC.
422 deoptimize_caller_frame(current, HAS_PENDING_EXCEPTION);
423 current->set_vm_result_oop(result);
424 JRT_BLOCK_END;
425
426
427 // inform GC that we won't do card marks for initializing writes.
428 SharedRuntime::on_slowpath_allocation_exit(current);
429
430 oop result = current->vm_result_oop();
431 if ((len > 0) && (result != nullptr) &&
432 is_deoptimized_caller_frame(current)) {
433 // Zero array here if the caller is deoptimized.
434 const size_t size = TypeArrayKlass::cast(array_type)->oop_size(result, result->mark());
435 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
436 size_t hs_bytes = arrayOopDesc::base_offset_in_bytes(elem_type);
437 assert(is_aligned(hs_bytes, BytesPerInt), "must be 4 byte aligned");
438 HeapWord* obj = cast_from_oop<HeapWord*>(result);
439 if (!is_aligned(hs_bytes, BytesPerLong)) {
440 *reinterpret_cast<jint*>(reinterpret_cast<char*>(obj) + hs_bytes) = 0;
441 hs_bytes += BytesPerInt;
442 }
443
444 // Optimized zeroing.
445 assert(is_aligned(hs_bytes, BytesPerLong), "must be 8-byte aligned");
446 const size_t aligned_hs = hs_bytes / BytesPerLong;
447 Copy::fill_to_aligned_words(obj+aligned_hs, size-aligned_hs);
448 }
449
450 JRT_END
451
452 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array.
453
454 // multianewarray for 2 dimensions
|