< prev index next >

src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp

Print this page

279     Register len_in_bytes  = Z_R1_scratch;
280     z_la(object_fields, hdr_size_in_bytes, obj);
281     load_const_optimized(len_in_bytes, con_size_in_bytes - hdr_size_in_bytes);
282     initialize_body(object_fields, len_in_bytes, Rzero);
283   }
284 
285   // Dtrace support is unimplemented.
286   //  if (CURRENT_ENV->dtrace_alloc_probes()) {
287   //    assert(obj == rax, "must be");
288   //    call(RuntimeAddress(Runtime1::entry_for (Runtime1::dtrace_object_alloc_id)));
289   //  }
290 
291   verify_oop(obj, FILE_AND_LINE);
292 }
293 
294 void C1_MacroAssembler::allocate_array(
295   Register obj,                        // result: Pointer to array after successful allocation.
296   Register len,                        // array length
297   Register t1,                         // temp register
298   Register t2,                         // temp register
299   int      hdr_size,                   // object header size in words
300   int      elt_size,                   // element size in bytes
301   Register klass,                      // object klass
302   Label&   slow_case                   // Continuation point if fast allocation fails.
303 ) {
304   assert_different_registers(obj, len, t1, t2, klass);
305 
306   // Determine alignment mask.
307   assert(!(BytesPerWord & 1), "must be a multiple of 2 for masking code to work");
308 
309   // Check for negative or excessive length.
310   compareU64_and_branch(len, (int32_t)max_array_allocation_length, bcondHigh, slow_case);
311 
312   // Compute array size.
313   // Note: If 0 <= len <= max_length, len*elt_size + header + alignment is
314   // smaller or equal to the largest integer. Also, since top is always
315   // aligned, we can do the alignment here instead of at the end address
316   // computation.
317   const Register arr_size = t2;
318   switch (elt_size) {
319     case  1: lgr_if_needed(arr_size, len); break;
320     case  2: z_sllg(arr_size, len, 1); break;
321     case  4: z_sllg(arr_size, len, 2); break;
322     case  8: z_sllg(arr_size, len, 3); break;
323     default: ShouldNotReachHere();
324   }
325   add2reg(arr_size, hdr_size * wordSize + MinObjAlignmentInBytesMask); // Add space for header & alignment.
326   z_nill(arr_size, (~MinObjAlignmentInBytesMask) & 0xffff);            // Align array size.
327 
328   try_allocate(obj, arr_size, 0, t1, slow_case);
329 
330   initialize_header(obj, klass, len, noreg, t1);
331 
332   // Clear rest of allocated space.
333   Label done;
334   Register object_fields = t1;
335   Register Rzero = Z_R1_scratch;
336   z_aghi(arr_size, -(hdr_size * BytesPerWord));
337   z_bre(done); // Jump if size of fields is zero.
338   z_la(object_fields, hdr_size * BytesPerWord, obj);
339   z_xgr(Rzero, Rzero);
340   initialize_body(object_fields, arr_size, Rzero);
341   bind(done);
342 
343   // Dtrace support is unimplemented.
344   // if (CURRENT_ENV->dtrace_alloc_probes()) {
345   //   assert(obj == rax, "must be");
346   //   call(RuntimeAddress(Runtime1::entry_for (Runtime1::dtrace_object_alloc_id)));
347   // }
348 
349   verify_oop(obj, FILE_AND_LINE);
350 }
351 
352 
353 #ifndef PRODUCT
354 
355 void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
356   if (!VerifyOops) return;
357   verify_oop_addr(Address(Z_SP, stack_offset), FILE_AND_LINE);
358 }

279     Register len_in_bytes  = Z_R1_scratch;
280     z_la(object_fields, hdr_size_in_bytes, obj);
281     load_const_optimized(len_in_bytes, con_size_in_bytes - hdr_size_in_bytes);
282     initialize_body(object_fields, len_in_bytes, Rzero);
283   }
284 
285   // Dtrace support is unimplemented.
286   //  if (CURRENT_ENV->dtrace_alloc_probes()) {
287   //    assert(obj == rax, "must be");
288   //    call(RuntimeAddress(Runtime1::entry_for (Runtime1::dtrace_object_alloc_id)));
289   //  }
290 
291   verify_oop(obj, FILE_AND_LINE);
292 }
293 
294 void C1_MacroAssembler::allocate_array(
295   Register obj,                        // result: Pointer to array after successful allocation.
296   Register len,                        // array length
297   Register t1,                         // temp register
298   Register t2,                         // temp register
299   int      base_offset_in_bytes,       // elements offset in bytes
300   int      elt_size,                   // element size in bytes
301   Register klass,                      // object klass
302   Label&   slow_case                   // Continuation point if fast allocation fails.
303 ) {
304   assert_different_registers(obj, len, t1, t2, klass);
305 
306   // Determine alignment mask.
307   assert(!(BytesPerWord & 1), "must be a multiple of 2 for masking code to work");
308 
309   // Check for negative or excessive length.
310   compareU64_and_branch(len, (int32_t)max_array_allocation_length, bcondHigh, slow_case);
311 
312   // Compute array size.
313   // Note: If 0 <= len <= max_length, len*elt_size + header + alignment is
314   // smaller or equal to the largest integer. Also, since top is always
315   // aligned, we can do the alignment here instead of at the end address
316   // computation.
317   const Register arr_size = t2;
318   switch (elt_size) {
319     case  1: lgr_if_needed(arr_size, len); break;
320     case  2: z_sllg(arr_size, len, 1); break;
321     case  4: z_sllg(arr_size, len, 2); break;
322     case  8: z_sllg(arr_size, len, 3); break;
323     default: ShouldNotReachHere();
324   }
325   add2reg(arr_size, base_offset_in_bytes + MinObjAlignmentInBytesMask); // Add space for header & alignment.
326   z_nill(arr_size, (~MinObjAlignmentInBytesMask) & 0xffff);             // Align array size.
327 
328   try_allocate(obj, arr_size, 0, t1, slow_case);
329 
330   initialize_header(obj, klass, len, noreg, t1);
331 
332   // Clear rest of allocated space.
333   Label done;
334   Register object_fields = t1;
335   Register Rzero = Z_R1_scratch;
336   z_aghi(arr_size, -base_offset_in_bytes);
337   z_bre(done); // Jump if size of fields is zero.
338   z_la(object_fields, base_offset_in_bytes, obj);
339   z_xgr(Rzero, Rzero);
340   initialize_body(object_fields, arr_size, Rzero);
341   bind(done);
342 
343   // Dtrace support is unimplemented.
344   // if (CURRENT_ENV->dtrace_alloc_probes()) {
345   //   assert(obj == rax, "must be");
346   //   call(RuntimeAddress(Runtime1::entry_for (Runtime1::dtrace_object_alloc_id)));
347   // }
348 
349   verify_oop(obj, FILE_AND_LINE);
350 }
351 
352 
353 #ifndef PRODUCT
354 
355 void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
356   if (!VerifyOops) return;
357   verify_oop_addr(Address(Z_SP, stack_offset), FILE_AND_LINE);
358 }
< prev index next >