< prev index next >

src/hotspot/cpu/aarch64/templateTable_aarch64.cpp

Print this page

3551 
3552   // Allocate the instance:
3553   //  If TLAB is enabled:
3554   //    Try to allocate in the TLAB.
3555   //    If fails, go to the slow path.
3556   //    Initialize the allocation.
3557   //    Exit.
3558   //
3559   //  Go to slow path.
3560 
3561   if (UseTLAB) {
3562     __ tlab_allocate(r0, r3, 0, noreg, r1, slow_case);
3563 
3564     if (ZeroTLAB) {
3565       // the fields have been already cleared
3566       __ b(initialize_header);
3567     }
3568 
3569     // The object is initialized before the header.  If the object size is
3570     // zero, go directly to the header initialization.
3571     __ sub(r3, r3, sizeof(oopDesc));





3572     __ cbz(r3, initialize_header);
3573 
3574     // Initialize object fields
3575     {
3576       __ add(r2, r0, sizeof(oopDesc));





3577       Label loop;
3578       __ bind(loop);
3579       __ str(zr, Address(__ post(r2, BytesPerLong)));
3580       __ sub(r3, r3, BytesPerLong);
3581       __ cbnz(r3, loop);
3582     }
3583 
3584     // initialize object header only.
3585     __ bind(initialize_header);
3586     __ mov(rscratch1, (intptr_t)markWord::prototype().value());
3587     __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
3588     __ store_klass_gap(r0, zr);  // zero klass gap for compressed oops
3589     __ store_klass(r0, r4);      // store klass last
3590 




3591     {
3592       SkipIfEqual skip(_masm, &DTraceAllocProbes, false);
3593       // Trigger dtrace event for fastpath
3594       __ push(atos); // save the return value
3595       __ call_VM_leaf(
3596            CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), r0);
3597       __ pop(atos); // restore the return value
3598 
3599     }
3600     __ b(done);
3601   }
3602 
3603   // slow case
3604   __ bind(slow_case);
3605   __ get_constant_pool(c_rarg1);
3606   __ get_unsigned_2_byte_index_at_bcp(c_rarg2, 1);
3607   call_VM(r0, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), c_rarg1, c_rarg2);
3608   __ verify_oop(r0);
3609 
3610   // continue

3551 
3552   // Allocate the instance:
3553   //  If TLAB is enabled:
3554   //    Try to allocate in the TLAB.
3555   //    If fails, go to the slow path.
3556   //    Initialize the allocation.
3557   //    Exit.
3558   //
3559   //  Go to slow path.
3560 
3561   if (UseTLAB) {
3562     __ tlab_allocate(r0, r3, 0, noreg, r1, slow_case);
3563 
3564     if (ZeroTLAB) {
3565       // the fields have been already cleared
3566       __ b(initialize_header);
3567     }
3568 
3569     // The object is initialized before the header.  If the object size is
3570     // zero, go directly to the header initialization.
3571     if (UseCompactObjectHeaders) {
3572       assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned");
3573       __ sub(r3, r3, oopDesc::base_offset_in_bytes());
3574     } else {
3575       __ sub(r3, r3, sizeof(oopDesc));
3576     }
3577     __ cbz(r3, initialize_header);
3578 
3579     // Initialize object fields
3580     {
3581       if (UseCompactObjectHeaders) {
3582         assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned");
3583         __ add(r2, r0, oopDesc::base_offset_in_bytes());
3584       } else {
3585         __ add(r2, r0, sizeof(oopDesc));
3586       }
3587       Label loop;
3588       __ bind(loop);
3589       __ str(zr, Address(__ post(r2, BytesPerLong)));
3590       __ sub(r3, r3, BytesPerLong);
3591       __ cbnz(r3, loop);
3592     }
3593 
3594     // initialize object header only.
3595     __ bind(initialize_header);
3596     if (UseCompactObjectHeaders) {
3597       __ ldr(rscratch1, Address(r4, Klass::prototype_header_offset()));
3598       __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
3599     } else {
3600       __ mov(rscratch1, (intptr_t)markWord::prototype().value());
3601       __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
3602       __ store_klass_gap(r0, zr);  // zero klass gap for compressed oops
3603       __ store_klass(r0, r4);      // store klass last
3604     }
3605     {
3606       SkipIfEqual skip(_masm, &DTraceAllocProbes, false);
3607       // Trigger dtrace event for fastpath
3608       __ push(atos); // save the return value
3609       __ call_VM_leaf(
3610            CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), r0);
3611       __ pop(atos); // restore the return value
3612 
3613     }
3614     __ b(done);
3615   }
3616 
3617   // slow case
3618   __ bind(slow_case);
3619   __ get_constant_pool(c_rarg1);
3620   __ get_unsigned_2_byte_index_at_bcp(c_rarg2, 1);
3621   call_VM(r0, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), c_rarg1, c_rarg2);
3622   __ verify_oop(r0);
3623 
3624   // continue
< prev index next >