src/hotspot/cpu/aarch64/templateTable_aarch64.cpp
changeset 48482 4aed7c563f7e
parent 48127 efc459cf351e
child 48652 7c03f19d38a7
child 56021 864ee22719af
equal deleted inserted replaced
48481:b97818fba2b0 48482:4aed7c563f7e
  3402   __ get_unsigned_2_byte_index_at_bcp(r3, 1);
  3402   __ get_unsigned_2_byte_index_at_bcp(r3, 1);
  3403   Label slow_case;
  3403   Label slow_case;
  3404   Label done;
  3404   Label done;
  3405   Label initialize_header;
  3405   Label initialize_header;
  3406   Label initialize_object; // including clearing the fields
  3406   Label initialize_object; // including clearing the fields
  3407   Label allocate_shared;
       
  3408 
  3407 
  3409   __ get_cpool_and_tags(r4, r0);
  3408   __ get_cpool_and_tags(r4, r0);
  3410   // Make sure the class we're about to instantiate has been resolved.
  3409   // Make sure the class we're about to instantiate has been resolved.
  3411   // This is done before loading InstanceKlass to be consistent with the order
  3410   // This is done before loading InstanceKlass to be consistent with the order
  3412   // how Constant Pool is updated (see ConstantPool::klass_at_put)
  3411   // how Constant Pool is updated (see ConstantPool::klass_at_put)
  3431           Address(r4,
  3430           Address(r4,
  3432                   Klass::layout_helper_offset()));
  3431                   Klass::layout_helper_offset()));
  3433   // test to see if it has a finalizer or is malformed in some way
  3432   // test to see if it has a finalizer or is malformed in some way
  3434   __ tbnz(r3, exact_log2(Klass::_lh_instance_slow_path_bit), slow_case);
  3433   __ tbnz(r3, exact_log2(Klass::_lh_instance_slow_path_bit), slow_case);
  3435 
  3434 
  3436   // Allocate the instance
  3435   // Allocate the instance:
  3437   // 1) Try to allocate in the TLAB
  3436   //  If TLAB is enabled:
  3438   // 2) if fail and the object is large allocate in the shared Eden
  3437   //    Try to allocate in the TLAB.
  3439   // 3) if the above fails (or is not applicable), go to a slow case
  3438   //    If fails, go to the slow path.
  3440   // (creates a new TLAB, etc.)
  3439   //  Else If inline contiguous allocations are enabled:
  3441 
  3440   //    Try to allocate in eden.
       
  3441   //    If fails due to heap end, go to slow path.
       
  3442   //
       
  3443   //  If TLAB is enabled OR inline contiguous is enabled:
       
  3444   //    Initialize the allocation.
       
  3445   //    Exit.
       
  3446   //
       
  3447   //  Go to slow path.
  3442   const bool allow_shared_alloc =
  3448   const bool allow_shared_alloc =
  3443     Universe::heap()->supports_inline_contig_alloc();
  3449     Universe::heap()->supports_inline_contig_alloc();
  3444 
  3450 
  3445   if (UseTLAB) {
  3451   if (UseTLAB) {
  3446     __ tlab_allocate(r0, r3, 0, noreg, r1,
  3452     __ tlab_allocate(r0, r3, 0, noreg, r1, slow_case);
  3447                      allow_shared_alloc ? allocate_shared : slow_case);
       
  3448 
  3453 
  3449     if (ZeroTLAB) {
  3454     if (ZeroTLAB) {
  3450       // the fields have been already cleared
  3455       // the fields have been already cleared
  3451       __ b(initialize_header);
  3456       __ b(initialize_header);
  3452     } else {
  3457     } else {
  3453       // initialize both the header and fields
  3458       // initialize both the header and fields
  3454       __ b(initialize_object);
  3459       __ b(initialize_object);
  3455     }
  3460     }
  3456   }
  3461   } else {
  3457 
  3462     // Allocation in the shared Eden, if allowed.
  3458   // Allocation in the shared Eden, if allowed.
  3463     //
  3459   //
  3464     // r3: instance size in bytes
  3460   // r3: instance size in bytes
  3465     if (allow_shared_alloc) {
  3461   if (allow_shared_alloc) {
  3466       __ eden_allocate(r0, r3, 0, r10, slow_case);
  3462     __ bind(allocate_shared);
  3467       __ incr_allocated_bytes(rthread, r3, 0, rscratch1);
  3463 
  3468     }
  3464     __ eden_allocate(r0, r3, 0, r10, slow_case);
  3469   }
  3465     __ incr_allocated_bytes(rthread, r3, 0, rscratch1);
  3470 
  3466   }
  3471   // If UseTLAB or allow_shared_alloc are true, the object is created above and
  3467 
  3472   // there is an initialize need. Otherwise, skip and go to the slow path.
  3468   if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
  3473   if (UseTLAB || allow_shared_alloc) {
  3469     // The object is initialized before the header.  If the object size is
  3474     // The object is initialized before the header.  If the object size is
  3470     // zero, go directly to the header initialization.
  3475     // zero, go directly to the header initialization.
  3471     __ bind(initialize_object);
  3476     __ bind(initialize_object);
  3472     __ sub(r3, r3, sizeof(oopDesc));
  3477     __ sub(r3, r3, sizeof(oopDesc));
  3473     __ cbz(r3, initialize_header);
  3478     __ cbz(r3, initialize_header);