src/hotspot/cpu/aarch64/templateTable_aarch64.cpp
changeset 48718 d68d95009bdb
parent 48701 48ce4b11bc17
parent 48652 7c03f19d38a7
child 48953 67aa88701d46
child 56095 97689d6b0494
equal deleted inserted replaced
48717:7a5835a47adf 48718:d68d95009bdb
  3419   __ get_unsigned_2_byte_index_at_bcp(r3, 1);
  3419   __ get_unsigned_2_byte_index_at_bcp(r3, 1);
  3420   Label slow_case;
  3420   Label slow_case;
  3421   Label done;
  3421   Label done;
  3422   Label initialize_header;
  3422   Label initialize_header;
  3423   Label initialize_object; // including clearing the fields
  3423   Label initialize_object; // including clearing the fields
  3424   Label allocate_shared;
       
  3425 
  3424 
  3426   __ get_cpool_and_tags(r4, r0);
  3425   __ get_cpool_and_tags(r4, r0);
  3427   // Make sure the class we're about to instantiate has been resolved.
  3426   // Make sure the class we're about to instantiate has been resolved.
  3428   // This is done before loading InstanceKlass to be consistent with the order
  3427   // This is done before loading InstanceKlass to be consistent with the order
  3429   // how Constant Pool is updated (see ConstantPool::klass_at_put)
  3428   // how Constant Pool is updated (see ConstantPool::klass_at_put)
  3448           Address(r4,
  3447           Address(r4,
  3449                   Klass::layout_helper_offset()));
  3448                   Klass::layout_helper_offset()));
  3450   // test to see if it has a finalizer or is malformed in some way
  3449   // test to see if it has a finalizer or is malformed in some way
  3451   __ tbnz(r3, exact_log2(Klass::_lh_instance_slow_path_bit), slow_case);
  3450   __ tbnz(r3, exact_log2(Klass::_lh_instance_slow_path_bit), slow_case);
  3452 
  3451 
  3453   // Allocate the instance
  3452   // Allocate the instance:
  3454   // 1) Try to allocate in the TLAB
  3453   //  If TLAB is enabled:
  3455   // 2) if fail and the object is large allocate in the shared Eden
  3454   //    Try to allocate in the TLAB.
  3456   // 3) if the above fails (or is not applicable), go to a slow case
  3455   //    If fails, go to the slow path.
  3457   // (creates a new TLAB, etc.)
  3456   //  Else If inline contiguous allocations are enabled:
  3458 
  3457   //    Try to allocate in eden.
       
  3458   //    If fails due to heap end, go to slow path.
       
  3459   //
       
  3460   //  If TLAB is enabled OR inline contiguous is enabled:
       
  3461   //    Initialize the allocation.
       
  3462   //    Exit.
       
  3463   //
       
  3464   //  Go to slow path.
  3459   const bool allow_shared_alloc =
  3465   const bool allow_shared_alloc =
  3460     Universe::heap()->supports_inline_contig_alloc();
  3466     Universe::heap()->supports_inline_contig_alloc();
  3461 
  3467 
  3462   if (UseTLAB) {
  3468   if (UseTLAB) {
  3463     __ tlab_allocate(r0, r3, 0, noreg, r1,
  3469     __ tlab_allocate(r0, r3, 0, noreg, r1, slow_case);
  3464                      allow_shared_alloc ? allocate_shared : slow_case);
       
  3465 
  3470 
  3466     if (ZeroTLAB) {
  3471     if (ZeroTLAB) {
  3467       // the fields have been already cleared
  3472       // the fields have been already cleared
  3468       __ b(initialize_header);
  3473       __ b(initialize_header);
  3469     } else {
  3474     } else {
  3470       // initialize both the header and fields
  3475       // initialize both the header and fields
  3471       __ b(initialize_object);
  3476       __ b(initialize_object);
  3472     }
  3477     }
  3473   }
  3478   } else {
  3474 
  3479     // Allocation in the shared Eden, if allowed.
  3475   // Allocation in the shared Eden, if allowed.
  3480     //
  3476   //
  3481     // r3: instance size in bytes
  3477   // r3: instance size in bytes
  3482     if (allow_shared_alloc) {
  3478   if (allow_shared_alloc) {
  3483       __ eden_allocate(r0, r3, 0, r10, slow_case);
  3479     __ bind(allocate_shared);
  3484       __ incr_allocated_bytes(rthread, r3, 0, rscratch1);
  3480 
  3485     }
  3481     __ eden_allocate(r0, r3, 0, r10, slow_case);
  3486   }
  3482     __ incr_allocated_bytes(rthread, r3, 0, rscratch1);
  3487 
  3483   }
  3488   // If UseTLAB or allow_shared_alloc are true, the object is created above and
  3484 
  3489   // there is an initialize need. Otherwise, skip and go to the slow path.
  3485   if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
  3490   if (UseTLAB || allow_shared_alloc) {
  3486     // The object is initialized before the header.  If the object size is
  3491     // The object is initialized before the header.  If the object size is
  3487     // zero, go directly to the header initialization.
  3492     // zero, go directly to the header initialization.
  3488     __ bind(initialize_object);
  3493     __ bind(initialize_object);
  3489     __ sub(r3, r3, sizeof(oopDesc));
  3494     __ sub(r3, r3, sizeof(oopDesc));
  3490     __ cbz(r3, initialize_header);
  3495     __ cbz(r3, initialize_header);