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