< prev index next >

src/hotspot/cpu/aarch64/templateTable_aarch64.cpp

Print this page

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





3632     __ cbz(r3, initialize_header);
3633 
3634     // Initialize object fields
3635     {
3636       __ add(r2, r0, sizeof(oopDesc));





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




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

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