3590
3591 // Allocate the instance:
3592 // If TLAB is enabled:
3593 // Try to allocate in the TLAB.
3594 // If fails, go to the slow path.
3595 // Initialize the allocation.
3596 // Exit.
3597 //
3598 // Go to slow path.
3599
3600 if (UseTLAB) {
3601 __ tlab_allocate(r0, r3, 0, noreg, r1, slow_case);
3602
3603 if (ZeroTLAB) {
3604 // the fields have been already cleared
3605 __ b(initialize_header);
3606 }
3607
3608 // The object is initialized before the header. If the object size is
3609 // zero, go directly to the header initialization.
3610 __ sub(r3, r3, sizeof(oopDesc));
3611 __ cbz(r3, initialize_header);
3612
3613 // Initialize object fields
3614 {
3615 __ add(r2, r0, sizeof(oopDesc));
3616 Label loop;
3617 __ bind(loop);
3618 __ str(zr, Address(__ post(r2, BytesPerLong)));
3619 __ sub(r3, r3, BytesPerLong);
3620 __ cbnz(r3, loop);
3621 }
3622
3623 // initialize object header only.
3624 __ bind(initialize_header);
3625 __ mov(rscratch1, (intptr_t)markWord::prototype().value());
3626 __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
3627 __ store_klass_gap(r0, zr); // zero klass gap for compressed oops
3628 __ store_klass(r0, r4); // store klass last
3629
3630 {
3631 SkipIfEqual skip(_masm, &DTraceAllocProbes, false);
3632 // Trigger dtrace event for fastpath
3633 __ push(atos); // save the return value
3634 __ call_VM_leaf(
3635 CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), r0);
3636 __ pop(atos); // restore the return value
3637
3638 }
3639 __ b(done);
3640 }
3641
3642 // slow case
3643 __ bind(slow_case);
3644 __ get_constant_pool(c_rarg1);
3645 __ get_unsigned_2_byte_index_at_bcp(c_rarg2, 1);
3646 call_VM(r0, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), c_rarg1, c_rarg2);
3647 __ verify_oop(r0);
3648
3649 // continue
|
3590
3591 // Allocate the instance:
3592 // If TLAB is enabled:
3593 // Try to allocate in the TLAB.
3594 // If fails, go to the slow path.
3595 // Initialize the allocation.
3596 // Exit.
3597 //
3598 // Go to slow path.
3599
3600 if (UseTLAB) {
3601 __ tlab_allocate(r0, r3, 0, noreg, r1, slow_case);
3602
3603 if (ZeroTLAB) {
3604 // the fields have been already cleared
3605 __ b(initialize_header);
3606 }
3607
3608 // The object is initialized before the header. If the object size is
3609 // zero, go directly to the header initialization.
3610 __ sub(r3, r3, oopDesc::base_offset_in_bytes());
3611 __ cbz(r3, initialize_header);
3612
3613 // Initialize object fields
3614 {
3615 __ add(r2, r0, oopDesc::base_offset_in_bytes());
3616 if (!is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong)) {
3617 __ strw(zr, Address(__ post(r2, BytesPerInt)));
3618 __ sub(r3, r3, BytesPerInt);
3619 __ cbz(r3, initialize_header);
3620 }
3621 Label loop;
3622 __ bind(loop);
3623 __ str(zr, Address(__ post(r2, BytesPerLong)));
3624 __ sub(r3, r3, BytesPerLong);
3625 __ cbnz(r3, loop);
3626 }
3627
3628 // initialize object header only.
3629 __ bind(initialize_header);
3630 if (UseCompactObjectHeaders) {
3631 __ ldr(rscratch1, Address(r4, Klass::prototype_header_offset()));
3632 __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
3633 } else {
3634 __ mov(rscratch1, (intptr_t)markWord::prototype().value());
3635 __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
3636 __ store_klass(r0, r4); // store klass last
3637 }
3638 {
3639 SkipIfEqual skip(_masm, &DTraceAllocProbes, false);
3640 // Trigger dtrace event for fastpath
3641 __ push(atos); // save the return value
3642 __ call_VM_leaf(
3643 CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), r0);
3644 __ pop(atos); // restore the return value
3645
3646 }
3647 __ b(done);
3648 }
3649
3650 // slow case
3651 __ bind(slow_case);
3652 __ get_constant_pool(c_rarg1);
3653 __ get_unsigned_2_byte_index_at_bcp(c_rarg2, 1);
3654 call_VM(r0, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), c_rarg1, c_rarg2);
3655 __ verify_oop(r0);
3656
3657 // continue
|