3582
3583 // Allocate the instance:
3584 // If TLAB is enabled:
3585 // Try to allocate in the TLAB.
3586 // If fails, go to the slow path.
3587 // Initialize the allocation.
3588 // Exit.
3589 //
3590 // Go to slow path.
3591
3592 if (UseTLAB) {
3593 __ tlab_allocate(r15_thread, rax, rdx, 0, rcx, rbx, slow_case);
3594 if (ZeroTLAB) {
3595 // the fields have been already cleared
3596 __ jmp(initialize_header);
3597 }
3598
3599 // The object is initialized before the header. If the object size is
3600 // zero, go directly to the header initialization.
3601 if (UseCompactObjectHeaders) {
3602 assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned");
3603 __ decrement(rdx, oopDesc::base_offset_in_bytes());
3604 } else {
3605 __ decrement(rdx, sizeof(oopDesc));
3606 }
3607 __ jcc(Assembler::zero, initialize_header);
3608
3609 // Initialize topmost object field, divide rdx by 8, check if odd and
3610 // test if zero.
3611 __ xorl(rcx, rcx); // use zero reg to clear memory (shorter code)
3612 __ shrl(rdx, LogBytesPerLong); // divide by 2*oopSize and set carry flag if odd
3613
3614 // rdx must have been multiple of 8
3615 #ifdef ASSERT
3616 // make sure rdx was multiple of 8
3617 Label L;
3618 // Ignore partial flag stall after shrl() since it is debug VM
3619 __ jcc(Assembler::carryClear, L);
3620 __ stop("object size is not multiple of 2 - adjust this code");
3621 __ bind(L);
3622 // rdx must be > 0, no extra check needed here
3623 #endif
|
3582
3583 // Allocate the instance:
3584 // If TLAB is enabled:
3585 // Try to allocate in the TLAB.
3586 // If fails, go to the slow path.
3587 // Initialize the allocation.
3588 // Exit.
3589 //
3590 // Go to slow path.
3591
3592 if (UseTLAB) {
3593 __ tlab_allocate(r15_thread, rax, rdx, 0, rcx, rbx, slow_case);
3594 if (ZeroTLAB) {
3595 // the fields have been already cleared
3596 __ jmp(initialize_header);
3597 }
3598
3599 // The object is initialized before the header. If the object size is
3600 // zero, go directly to the header initialization.
3601 if (UseCompactObjectHeaders) {
3602 __ decrement(rdx, align_up(oopDesc::base_offset_in_bytes(), BytesPerLong));
3603 } else {
3604 __ decrement(rdx, sizeof(oopDesc));
3605 }
3606 __ jcc(Assembler::zero, initialize_header);
3607
3608 // Initialize topmost object field, divide rdx by 8, check if odd and
3609 // test if zero.
3610 __ xorl(rcx, rcx); // use zero reg to clear memory (shorter code)
3611 __ shrl(rdx, LogBytesPerLong); // divide by 2*oopSize and set carry flag if odd
3612
3613 // rdx must have been multiple of 8
3614 #ifdef ASSERT
3615 // make sure rdx was multiple of 8
3616 Label L;
3617 // Ignore partial flag stall after shrl() since it is debug VM
3618 __ jcc(Assembler::carryClear, L);
3619 __ stop("object size is not multiple of 2 - adjust this code");
3620 __ bind(L);
3621 // rdx must be > 0, no extra check needed here
3622 #endif
|