< prev index next >

src/hotspot/cpu/aarch64/templateTable_aarch64.cpp

Print this page

3616 
3617   // Allocate the instance:
3618   //  If TLAB is enabled:
3619   //    Try to allocate in the TLAB.
3620   //    If fails, go to the slow path.
3621   //    Initialize the allocation.
3622   //    Exit.
3623   //
3624   //  Go to slow path.
3625 
3626   if (UseTLAB) {
3627     __ tlab_allocate(r0, r3, 0, noreg, r1, slow_case);
3628 
3629     if (ZeroTLAB) {
3630       // the fields have been already cleared
3631       __ b(initialize_header);
3632     }
3633 
3634     // The object is initialized before the header.  If the object size is
3635     // zero, go directly to the header initialization.
3636     __ sub(r3, r3, sizeof(oopDesc));





3637     __ cbz(r3, initialize_header);
3638 
3639     // Initialize object fields
3640     {
3641       __ add(r2, r0, sizeof(oopDesc));





3642       Label loop;
3643       __ bind(loop);
3644       __ str(zr, Address(__ post(r2, BytesPerLong)));
3645       __ sub(r3, r3, BytesPerLong);
3646       __ cbnz(r3, loop);
3647     }
3648 
3649     // initialize object header only.
3650     __ bind(initialize_header);
3651     __ mov(rscratch1, (intptr_t)markWord::prototype().value());
3652     __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
3653     __ store_klass_gap(r0, zr);  // zero klass gap for compressed oops
3654     __ store_klass(r0, r4);      // store klass last
3655 




3656     {
3657       SkipIfEqual skip(_masm, &DTraceAllocProbes, false);
3658       // Trigger dtrace event for fastpath
3659       __ push(atos); // save the return value
3660       __ call_VM_leaf(
3661            CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), r0);
3662       __ pop(atos); // restore the return value
3663 
3664     }
3665     __ b(done);
3666   }
3667 
3668   // slow case
3669   __ bind(slow_case);
3670   __ get_constant_pool(c_rarg1);
3671   __ get_unsigned_2_byte_index_at_bcp(c_rarg2, 1);
3672   call_VM(r0, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), c_rarg1, c_rarg2);
3673   __ verify_oop(r0);
3674 
3675   // continue

3616 
3617   // Allocate the instance:
3618   //  If TLAB is enabled:
3619   //    Try to allocate in the TLAB.
3620   //    If fails, go to the slow path.
3621   //    Initialize the allocation.
3622   //    Exit.
3623   //
3624   //  Go to slow path.
3625 
3626   if (UseTLAB) {
3627     __ tlab_allocate(r0, r3, 0, noreg, r1, slow_case);
3628 
3629     if (ZeroTLAB) {
3630       // the fields have been already cleared
3631       __ b(initialize_header);
3632     }
3633 
3634     // The object is initialized before the header.  If the object size is
3635     // zero, go directly to the header initialization.
3636     if (UseCompactObjectHeaders) {
3637       assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned");
3638       __ sub(r3, r3, oopDesc::base_offset_in_bytes());
3639     } else {
3640       __ sub(r3, r3, sizeof(oopDesc));
3641     }
3642     __ cbz(r3, initialize_header);
3643 
3644     // Initialize object fields
3645     {
3646       if (UseCompactObjectHeaders) {
3647         assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned");
3648         __ add(r2, r0, oopDesc::base_offset_in_bytes());
3649       } else {
3650         __ add(r2, r0, sizeof(oopDesc));
3651       }
3652       Label loop;
3653       __ bind(loop);
3654       __ str(zr, Address(__ post(r2, BytesPerLong)));
3655       __ sub(r3, r3, BytesPerLong);
3656       __ cbnz(r3, loop);
3657     }
3658 
3659     // initialize object header only.
3660     __ bind(initialize_header);
3661     if (UseCompactObjectHeaders) {
3662       __ ldr(rscratch1, Address(r4, Klass::prototype_header_offset()));
3663       __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
3664     } else {
3665       __ mov(rscratch1, (intptr_t)markWord::prototype().value());
3666       __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
3667       __ store_klass_gap(r0, zr);  // zero klass gap for compressed oops
3668       __ store_klass(r0, r4);      // store klass last
3669     }
3670     {
3671       SkipIfEqual skip(_masm, &DTraceAllocProbes, false);
3672       // Trigger dtrace event for fastpath
3673       __ push(atos); // save the return value
3674       __ call_VM_leaf(
3675            CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), r0);
3676       __ pop(atos); // restore the return value
3677 
3678     }
3679     __ b(done);
3680   }
3681 
3682   // slow case
3683   __ bind(slow_case);
3684   __ get_constant_pool(c_rarg1);
3685   __ get_unsigned_2_byte_index_at_bcp(c_rarg2, 1);
3686   call_VM(r0, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), c_rarg1, c_rarg2);
3687   __ verify_oop(r0);
3688 
3689   // continue
< prev index next >