< prev index next >

src/cpu/ppc/vm/c1_MacroAssembler_ppc.cpp

Print this page




 323 void C1_MacroAssembler::allocate_array(
 324   Register obj,                        // result: pointer to array after successful allocation
 325   Register len,                        // array length
 326   Register t1,                         // temp register
 327   Register t2,                         // temp register
 328   Register t3,                         // temp register
 329   int      hdr_size,                   // object header size in words
 330   int      elt_size,                   // element size in bytes
 331   Register klass,                      // object klass
 332   Label&   slow_case                   // continuation point if fast allocation fails
 333 ) {
 334   assert_different_registers(obj, len, t1, t2, t3, klass);
 335 
 336   // Determine alignment mask.
 337   assert(!(BytesPerWord & 1), "must be a multiple of 2 for masking code to work");
 338   int log2_elt_size = exact_log2(elt_size);
 339 
 340   // Check for negative or excessive length.
 341   size_t max_length = max_array_allocation_length >> log2_elt_size;
 342   if (UseTLAB) {
 343     size_t max_tlab = align_size_up(ThreadLocalAllocBuffer::max_size() >> log2_elt_size, 64*K);
 344     if (max_tlab < max_length) { max_length = max_tlab; }
 345   }
 346   load_const_optimized(t1, max_length);
 347   cmpld(CCR0, len, t1);
 348   bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CCR0, Assembler::greater), slow_case);
 349 
 350   // compute array size
 351   // note: If 0 <= len <= max_length, len*elt_size + header + alignment is
 352   //       smaller or equal to the largest integer; also, since top is always
 353   //       aligned, we can do the alignment here instead of at the end address
 354   //       computation.
 355   const Register arr_size = t1;
 356   Register arr_len_in_bytes = len;
 357   if (elt_size != 1) {
 358     sldi(t1, len, log2_elt_size);
 359     arr_len_in_bytes = t1;
 360   }
 361   addi(arr_size, arr_len_in_bytes, hdr_size * wordSize + MinObjAlignmentInBytesMask); // Add space for header & alignment.
 362   clrrdi(arr_size, arr_size, LogMinObjAlignmentInBytes);                              // Align array size.
 363 




 323 void C1_MacroAssembler::allocate_array(
 324   Register obj,                        // result: pointer to array after successful allocation
 325   Register len,                        // array length
 326   Register t1,                         // temp register
 327   Register t2,                         // temp register
 328   Register t3,                         // temp register
 329   int      hdr_size,                   // object header size in words
 330   int      elt_size,                   // element size in bytes
 331   Register klass,                      // object klass
 332   Label&   slow_case                   // continuation point if fast allocation fails
 333 ) {
 334   assert_different_registers(obj, len, t1, t2, t3, klass);
 335 
 336   // Determine alignment mask.
 337   assert(!(BytesPerWord & 1), "must be a multiple of 2 for masking code to work");
 338   int log2_elt_size = exact_log2(elt_size);
 339 
 340   // Check for negative or excessive length.
 341   size_t max_length = max_array_allocation_length >> log2_elt_size;
 342   if (UseTLAB) {
 343     size_t max_tlab = align_up(ThreadLocalAllocBuffer::max_size() >> log2_elt_size, 64*K);
 344     if (max_tlab < max_length) { max_length = max_tlab; }
 345   }
 346   load_const_optimized(t1, max_length);
 347   cmpld(CCR0, len, t1);
 348   bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CCR0, Assembler::greater), slow_case);
 349 
 350   // compute array size
 351   // note: If 0 <= len <= max_length, len*elt_size + header + alignment is
 352   //       smaller or equal to the largest integer; also, since top is always
 353   //       aligned, we can do the alignment here instead of at the end address
 354   //       computation.
 355   const Register arr_size = t1;
 356   Register arr_len_in_bytes = len;
 357   if (elt_size != 1) {
 358     sldi(t1, len, log2_elt_size);
 359     arr_len_in_bytes = t1;
 360   }
 361   addi(arr_size, arr_len_in_bytes, hdr_size * wordSize + MinObjAlignmentInBytesMask); // Add space for header & alignment.
 362   clrrdi(arr_size, arr_size, LogMinObjAlignmentInBytes);                              // Align array size.
 363 


< prev index next >