3618 // Allocate the instance:
3619 // If TLAB is enabled:
3620 // Try to allocate in the TLAB.
3621 // If fails, go to the slow path.
3622 // Initialize the allocation.
3623 // Exit.
3624 //
3625 // Go to slow path.
3626
3627 if (UseTLAB) {
3628 __ tlab_allocate(r0, r3, 0, noreg, r1, slow_case);
3629
3630 if (ZeroTLAB) {
3631 // the fields have been already cleared
3632 __ b(initialize_header);
3633 }
3634
3635 // The object is initialized before the header. If the object size is
3636 // zero, go directly to the header initialization.
3637 int header_size = oopDesc::header_size() * HeapWordSize;
3638 assert(is_aligned(header_size, BytesPerLong), "oop header size must be 8-byte-aligned");
3639 __ sub(r3, r3, header_size);
3640 __ cbz(r3, initialize_header);
3641
3642 // Initialize object fields
3643 {
3644 __ add(r2, r0, header_size);
3645 Label loop;
3646 __ bind(loop);
3647 __ str(zr, Address(__ post(r2, BytesPerLong)));
3648 __ sub(r3, r3, BytesPerLong);
3649 __ cbnz(r3, loop);
3650 }
3651
3652 // initialize object header only.
3653 __ bind(initialize_header);
3654 if (UseCompactObjectHeaders) {
3655 __ ldr(rscratch1, Address(r4, Klass::prototype_header_offset()));
3656 __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
3657 } else {
3658 __ mov(rscratch1, (intptr_t)markWord::prototype().value());
|
3618 // Allocate the instance:
3619 // If TLAB is enabled:
3620 // Try to allocate in the TLAB.
3621 // If fails, go to the slow path.
3622 // Initialize the allocation.
3623 // Exit.
3624 //
3625 // Go to slow path.
3626
3627 if (UseTLAB) {
3628 __ tlab_allocate(r0, r3, 0, noreg, r1, slow_case);
3629
3630 if (ZeroTLAB) {
3631 // the fields have been already cleared
3632 __ b(initialize_header);
3633 }
3634
3635 // The object is initialized before the header. If the object size is
3636 // zero, go directly to the header initialization.
3637 int header_size = oopDesc::header_size() * HeapWordSize;
3638 __ sub(r3, r3, header_size);
3639 __ cbz(r3, initialize_header);
3640
3641 // Initialize object fields
3642 {
3643 __ add(r2, r0, header_size);
3644 Label loop;
3645 __ bind(loop);
3646 __ str(zr, Address(__ post(r2, BytesPerLong)));
3647 __ sub(r3, r3, BytesPerLong);
3648 __ cbnz(r3, loop);
3649 }
3650
3651 // initialize object header only.
3652 __ bind(initialize_header);
3653 if (UseCompactObjectHeaders) {
3654 __ ldr(rscratch1, Address(r4, Klass::prototype_header_offset()));
3655 __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
3656 } else {
3657 __ mov(rscratch1, (intptr_t)markWord::prototype().value());
|