3561
3562 // Allocate the instance:
3563 // If TLAB is enabled:
3564 // Try to allocate in the TLAB.
3565 // If fails, go to the slow path.
3566 // Initialize the allocation.
3567 // Exit.
3568 //
3569 // Go to slow path.
3570
3571 if (UseTLAB) {
3572 __ tlab_allocate(rax, rdx, 0, rcx, rbx, slow_case);
3573 if (ZeroTLAB) {
3574 // the fields have been already cleared
3575 __ jmp(initialize_header);
3576 }
3577
3578 // The object is initialized before the header. If the object size is
3579 // zero, go directly to the header initialization.
3580 if (UseCompactObjectHeaders) {
3581 assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned");
3582 __ decrement(rdx, oopDesc::base_offset_in_bytes());
3583 } else {
3584 __ decrement(rdx, sizeof(oopDesc));
3585 }
3586 __ jcc(Assembler::zero, initialize_header);
3587
3588 // Initialize topmost object field, divide rdx by 8, check if odd and
3589 // test if zero.
3590 __ xorl(rcx, rcx); // use zero reg to clear memory (shorter code)
3591 __ shrl(rdx, LogBytesPerLong); // divide by 2*oopSize and set carry flag if odd
3592
3593 // rdx must have been multiple of 8
3594 #ifdef ASSERT
3595 // make sure rdx was multiple of 8
3596 Label L;
3597 // Ignore partial flag stall after shrl() since it is debug VM
3598 __ jcc(Assembler::carryClear, L);
3599 __ stop("object size is not multiple of 2 - adjust this code");
3600 __ bind(L);
3601 // rdx must be > 0, no extra check needed here
3602 #endif
|
3561
3562 // Allocate the instance:
3563 // If TLAB is enabled:
3564 // Try to allocate in the TLAB.
3565 // If fails, go to the slow path.
3566 // Initialize the allocation.
3567 // Exit.
3568 //
3569 // Go to slow path.
3570
3571 if (UseTLAB) {
3572 __ tlab_allocate(rax, rdx, 0, rcx, rbx, slow_case);
3573 if (ZeroTLAB) {
3574 // the fields have been already cleared
3575 __ jmp(initialize_header);
3576 }
3577
3578 // The object is initialized before the header. If the object size is
3579 // zero, go directly to the header initialization.
3580 if (UseCompactObjectHeaders) {
3581 __ decrement(rdx, align_up(oopDesc::base_offset_in_bytes(), BytesPerLong));
3582 } else {
3583 __ decrement(rdx, sizeof(oopDesc));
3584 }
3585 __ jcc(Assembler::zero, initialize_header);
3586
3587 // Initialize topmost object field, divide rdx by 8, check if odd and
3588 // test if zero.
3589 __ xorl(rcx, rcx); // use zero reg to clear memory (shorter code)
3590 __ shrl(rdx, LogBytesPerLong); // divide by 2*oopSize and set carry flag if odd
3591
3592 // rdx must have been multiple of 8
3593 #ifdef ASSERT
3594 // make sure rdx was multiple of 8
3595 Label L;
3596 // Ignore partial flag stall after shrl() since it is debug VM
3597 __ jcc(Assembler::carryClear, L);
3598 __ stop("object size is not multiple of 2 - adjust this code");
3599 __ bind(L);
3600 // rdx must be > 0, no extra check needed here
3601 #endif
|