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