< prev index next >

src/hotspot/share/opto/runtime.cpp

Print this page

 333   // The oopFactory likes to work with the element type.
 334   BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
 335   result = oopFactory::new_typeArray_nozero(elem_type, len, THREAD);
 336 
 337   // Pass oops back through thread local storage.  Our apparent type to Java
 338   // is that we return an oop, but we can block on exit from this routine and
 339   // a GC can trash the oop in C's return register.  The generated stub will
 340   // fetch the oop from TLS after any possible GC.
 341   deoptimize_caller_frame(current, HAS_PENDING_EXCEPTION);
 342   current->set_vm_result(result);
 343   JRT_BLOCK_END;
 344 
 345 
 346   // inform GC that we won't do card marks for initializing writes.
 347   SharedRuntime::on_slowpath_allocation_exit(current);
 348 
 349   oop result = current->vm_result();
 350   if ((len > 0) && (result != nullptr) &&
 351       is_deoptimized_caller_frame(current)) {
 352     // Zero array here if the caller is deoptimized.
 353     const size_t size = TypeArrayKlass::cast(array_type)->oop_size(result);
 354     BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
 355     size_t hs_bytes = arrayOopDesc::base_offset_in_bytes(elem_type);
 356     assert(is_aligned(hs_bytes, BytesPerInt), "must be 4 byte aligned");
 357     HeapWord* obj = cast_from_oop<HeapWord*>(result);
 358     if (!is_aligned(hs_bytes, BytesPerLong)) {
 359       *reinterpret_cast<jint*>(reinterpret_cast<char*>(obj) + hs_bytes) = 0;
 360       hs_bytes += BytesPerInt;
 361     }
 362 
 363     // Optimized zeroing.
 364     assert(is_aligned(hs_bytes, BytesPerLong), "must be 8-byte aligned");
 365     const size_t aligned_hs = hs_bytes / BytesPerLong;
 366     Copy::fill_to_aligned_words(obj+aligned_hs, size-aligned_hs);
 367   }
 368 
 369 JRT_END
 370 
 371 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array.
 372 
 373 // multianewarray for 2 dimensions

 333   // The oopFactory likes to work with the element type.
 334   BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
 335   result = oopFactory::new_typeArray_nozero(elem_type, len, THREAD);
 336 
 337   // Pass oops back through thread local storage.  Our apparent type to Java
 338   // is that we return an oop, but we can block on exit from this routine and
 339   // a GC can trash the oop in C's return register.  The generated stub will
 340   // fetch the oop from TLS after any possible GC.
 341   deoptimize_caller_frame(current, HAS_PENDING_EXCEPTION);
 342   current->set_vm_result(result);
 343   JRT_BLOCK_END;
 344 
 345 
 346   // inform GC that we won't do card marks for initializing writes.
 347   SharedRuntime::on_slowpath_allocation_exit(current);
 348 
 349   oop result = current->vm_result();
 350   if ((len > 0) && (result != nullptr) &&
 351       is_deoptimized_caller_frame(current)) {
 352     // Zero array here if the caller is deoptimized.
 353     const size_t size = TypeArrayKlass::cast(array_type)->oop_size(result, result->mark());
 354     BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
 355     size_t hs_bytes = arrayOopDesc::base_offset_in_bytes(elem_type);
 356     assert(is_aligned(hs_bytes, BytesPerInt), "must be 4 byte aligned");
 357     HeapWord* obj = cast_from_oop<HeapWord*>(result);
 358     if (!is_aligned(hs_bytes, BytesPerLong)) {
 359       *reinterpret_cast<jint*>(reinterpret_cast<char*>(obj) + hs_bytes) = 0;
 360       hs_bytes += BytesPerInt;
 361     }
 362 
 363     // Optimized zeroing.
 364     assert(is_aligned(hs_bytes, BytesPerLong), "must be 8-byte aligned");
 365     const size_t aligned_hs = hs_bytes / BytesPerLong;
 366     Copy::fill_to_aligned_words(obj+aligned_hs, size-aligned_hs);
 367   }
 368 
 369 JRT_END
 370 
 371 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array.
 372 
 373 // multianewarray for 2 dimensions
< prev index next >