< prev index next >

src/hotspot/share/opto/runtime.cpp

Print this page

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

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