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