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