< prev index next >

src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp

Print this page

316     initialize_body(obj, t1, t2, con_size_in_bytes, hdr_size_in_bytes);
317   }
318 
319   if (CURRENT_ENV->dtrace_alloc_probes()) {
320     Unimplemented();
321 //    assert(obj == O0, "must be");
322 //    call(CAST_FROM_FN_PTR(address, Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)),
323 //         relocInfo::runtime_call_type);
324   }
325 
326   verify_oop(obj, FILE_AND_LINE);
327 }
328 
329 
330 void C1_MacroAssembler::allocate_array(
331   Register obj,                        // result: pointer to array after successful allocation
332   Register len,                        // array length
333   Register t1,                         // temp register
334   Register t2,                         // temp register
335   Register t3,                         // temp register
336   int      hdr_size,                   // object header size in words
337   int      elt_size,                   // element size in bytes
338   Register klass,                      // object klass
339   Label&   slow_case                   // continuation point if fast allocation fails
340 ) {
341   assert_different_registers(obj, len, t1, t2, t3, klass);
342 
343   // Determine alignment mask.
344   assert(!(BytesPerWord & 1), "must be a multiple of 2 for masking code to work");
345   int log2_elt_size = exact_log2(elt_size);
346 
347   // Check for negative or excessive length.
348   size_t max_length = max_array_allocation_length >> log2_elt_size;
349   if (UseTLAB) {
350     size_t max_tlab = align_up(ThreadLocalAllocBuffer::max_size() >> log2_elt_size, 64*K);
351     if (max_tlab < max_length) { max_length = max_tlab; }
352   }
353   load_const_optimized(t1, max_length);
354   cmpld(CCR0, len, t1);
355   bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CCR0, Assembler::greater), slow_case);
356 
357   // compute array size
358   // note: If 0 <= len <= max_length, len*elt_size + header + alignment is
359   //       smaller or equal to the largest integer; also, since top is always
360   //       aligned, we can do the alignment here instead of at the end address
361   //       computation.
362   const Register arr_size = t1;
363   Register arr_len_in_bytes = len;
364   if (elt_size != 1) {
365     sldi(t1, len, log2_elt_size);
366     arr_len_in_bytes = t1;
367   }
368   addi(arr_size, arr_len_in_bytes, hdr_size * wordSize + MinObjAlignmentInBytesMask); // Add space for header & alignment.
369   clrrdi(arr_size, arr_size, LogMinObjAlignmentInBytes);                              // Align array size.
370 
371   // Allocate space & initialize header.
372   try_allocate(obj, arr_size, 0, t2, t3, slow_case);
373   initialize_header(obj, klass, len, t2, t3);
374 
375   // Initialize body.
376   const Register base  = t2;
377   const Register index = t3;
378   addi(base, obj, hdr_size * wordSize);               // compute address of first element
379   addi(index, arr_size, -(hdr_size * wordSize));      // compute index = number of bytes to clear










380   initialize_body(base, index);
381 
382   if (CURRENT_ENV->dtrace_alloc_probes()) {
383     Unimplemented();
384     //assert(obj == O0, "must be");
385     //call(CAST_FROM_FN_PTR(address, Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)),
386     //     relocInfo::runtime_call_type);
387   }
388 
389   verify_oop(obj, FILE_AND_LINE);
390 }
391 
392 
393 #ifndef PRODUCT
394 
395 void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
396   verify_oop_addr((RegisterOrConstant)stack_offset, R1_SP, "broken oop in stack slot");
397 }
398 
399 void C1_MacroAssembler::verify_not_null_oop(Register r) {

316     initialize_body(obj, t1, t2, con_size_in_bytes, hdr_size_in_bytes);
317   }
318 
319   if (CURRENT_ENV->dtrace_alloc_probes()) {
320     Unimplemented();
321 //    assert(obj == O0, "must be");
322 //    call(CAST_FROM_FN_PTR(address, Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)),
323 //         relocInfo::runtime_call_type);
324   }
325 
326   verify_oop(obj, FILE_AND_LINE);
327 }
328 
329 
330 void C1_MacroAssembler::allocate_array(
331   Register obj,                        // result: pointer to array after successful allocation
332   Register len,                        // array length
333   Register t1,                         // temp register
334   Register t2,                         // temp register
335   Register t3,                         // temp register
336   int      base_offset_in_bytes,       // elements offset in bytes
337   int      elt_size,                   // element size in bytes
338   Register klass,                      // object klass
339   Label&   slow_case                   // continuation point if fast allocation fails
340 ) {
341   assert_different_registers(obj, len, t1, t2, t3, klass);
342 
343   // Determine alignment mask.
344   assert(!(BytesPerWord & 1), "must be a multiple of 2 for masking code to work");
345   int log2_elt_size = exact_log2(elt_size);
346 
347   // Check for negative or excessive length.
348   size_t max_length = max_array_allocation_length >> log2_elt_size;
349   if (UseTLAB) {
350     size_t max_tlab = align_up(ThreadLocalAllocBuffer::max_size() >> log2_elt_size, 64*K);
351     if (max_tlab < max_length) { max_length = max_tlab; }
352   }
353   load_const_optimized(t1, max_length);
354   cmpld(CCR0, len, t1);
355   bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CCR0, Assembler::greater), slow_case);
356 
357   // compute array size
358   // note: If 0 <= len <= max_length, len*elt_size + header + alignment is
359   //       smaller or equal to the largest integer; also, since top is always
360   //       aligned, we can do the alignment here instead of at the end address
361   //       computation.
362   const Register arr_size = t1;
363   Register arr_len_in_bytes = len;
364   if (elt_size != 1) {
365     sldi(t1, len, log2_elt_size);
366     arr_len_in_bytes = t1;
367   }
368   addi(arr_size, arr_len_in_bytes, base_offset_in_bytes + MinObjAlignmentInBytesMask); // Add space for header & alignment.
369   clrrdi(arr_size, arr_size, LogMinObjAlignmentInBytes);                              // Align array size.
370 
371   // Allocate space & initialize header.
372   try_allocate(obj, arr_size, 0, t2, t3, slow_case);
373   initialize_header(obj, klass, len, t2, t3);
374 
375   // Initialize body.
376   const Register base  = t2;
377   const Register index = t3;
378   addi(base, obj, base_offset_in_bytes);               // compute address of first element
379   addi(index, arr_size, -(base_offset_in_bytes));      // compute index = number of bytes to clear
380 
381   // Zero first 4 bytes, if start offset is not word aligned.
382   if (!is_aligned(base_offset_in_bytes, BytesPerWord)) {
383     assert(is_aligned(base_offset_in_bytes, BytesPerInt), "must be 4-byte aligned");
384     li(t1, 0);
385     stw(t1, 0, base);
386     addi(base, base, BytesPerInt);
387     // Note: initialize_body will align index down, no need to correct it here.
388   }
389 
390   initialize_body(base, index);
391 
392   if (CURRENT_ENV->dtrace_alloc_probes()) {
393     Unimplemented();
394     //assert(obj == O0, "must be");
395     //call(CAST_FROM_FN_PTR(address, Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)),
396     //     relocInfo::runtime_call_type);
397   }
398 
399   verify_oop(obj, FILE_AND_LINE);
400 }
401 
402 
403 #ifndef PRODUCT
404 
405 void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
406   verify_oop_addr((RegisterOrConstant)stack_offset, R1_SP, "broken oop in stack slot");
407 }
408 
409 void C1_MacroAssembler::verify_not_null_oop(Register r) {
< prev index next >