< prev index next >

src/hotspot/share/opto/runtime.cpp

Print this page

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

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