src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
changeset 48608 1dab70e20292
parent 48585 d9fcb7ba8133
parent 48476 ca9489245872
child 48965 be873d8c0114
child 56095 97689d6b0494
--- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp	Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp	Thu Jan 18 18:58:46 2018 +0000
@@ -3637,10 +3637,7 @@
   transition(vtos, atos);
 
   Label Lslow_case,
-        Ldone,
-        Linitialize_header,
-        Lallocate_shared,
-        Linitialize_object;  // Including clearing the fields.
+        Ldone;
 
   const Register RallocatedObject = R17_tos,
                  RinstanceKlass   = R9_ARG7,
@@ -3651,8 +3648,6 @@
                  Rtags            = R3_ARG1,
                  Rindex           = R5_ARG3;
 
-  const bool allow_shared_alloc = Universe::heap()->supports_inline_contig_alloc();
-
   // --------------------------------------------------------------------------
   // Check if fast case is possible.
 
@@ -3661,6 +3656,8 @@
   // Load index of constant pool entry.
   __ get_2_byte_integer_at_bcp(1, Rindex, InterpreterMacroAssembler::Unsigned);
 
+  // Note: compared to other architectures, PPC's implementation always goes
+  // to the slow path if TLAB is used and fails.
   if (UseTLAB) {
     // Make sure the class we're about to instantiate has been resolved
     // This is done before loading instanceKlass to be consistent with the order
@@ -3690,8 +3687,7 @@
     // Fast case:
     // Allocate the instance.
     // 1) Try to allocate in the TLAB.
-    // 2) If fail, and the TLAB is not full enough to discard, allocate in the shared Eden.
-    // 3) If the above fails (or is not applicable), go to a slow case (creates a new TLAB, etc.).
+    // 2) If the above fails (or is not applicable), go to a slow case (creates a new TLAB, etc.).
 
     Register RoldTopValue = RallocatedObject; // Object will be allocated here if it fits.
     Register RnewTopValue = R6_ARG4;
@@ -3705,53 +3701,13 @@
 
     // If there is enough space, we do not CAS and do not clear.
     __ cmpld(CCR0, RnewTopValue, RendValue);
-    __ bgt(CCR0, allow_shared_alloc ? Lallocate_shared : Lslow_case);
+    __ bgt(CCR0, Lslow_case);
 
     __ std(RnewTopValue, in_bytes(JavaThread::tlab_top_offset()), R16_thread);
 
-    if (ZeroTLAB) {
-      // The fields have already been cleared.
-      __ b(Linitialize_header);
-    } else {
-      // Initialize both the header and fields.
-      __ b(Linitialize_object);
-    }
-
-    // Fall through: TLAB was too small.
-    if (allow_shared_alloc) {
-      Register RtlabWasteLimitValue = R10_ARG8;
-      Register RfreeValue = RnewTopValue;
-
-      __ bind(Lallocate_shared);
-      // Check if tlab should be discarded (refill_waste_limit >= free).
-      __ ld(RtlabWasteLimitValue, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), R16_thread);
-      __ subf(RfreeValue, RoldTopValue, RendValue);
-      __ srdi(RfreeValue, RfreeValue, LogHeapWordSize); // in dwords
-      __ cmpld(CCR0, RtlabWasteLimitValue, RfreeValue);
-      __ bge(CCR0, Lslow_case);
-
-      // Increment waste limit to prevent getting stuck on this slow path.
-      __ add_const_optimized(RtlabWasteLimitValue, RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment());
-      __ std(RtlabWasteLimitValue, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), R16_thread);
-    }
-    // else: No allocation in the shared eden. // fallthru: __ b(Lslow_case);
-  }
-  // else: Always go the slow path.
-
-  // --------------------------------------------------------------------------
-  // slow case
-  __ bind(Lslow_case);
-  call_VM(R17_tos, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), Rcpool, Rindex);
-
-  if (UseTLAB) {
-    __ b(Ldone);
-    // --------------------------------------------------------------------------
-    // Init1: Zero out newly allocated memory.
-
-    if (!ZeroTLAB || allow_shared_alloc) {
-      // Clear object fields.
-      __ bind(Linitialize_object);
-
+    if (!ZeroTLAB) {
+      // --------------------------------------------------------------------------
+      // Init1: Zero out newly allocated memory.
       // Initialize remaining object fields.
       Register Rbase = Rtags;
       __ addi(Rinstance_size, Rinstance_size, 7 - (int)sizeof(oopDesc));
@@ -3760,13 +3716,10 @@
 
       // Clear out object skipping header. Takes also care of the zero length case.
       __ clear_memory_doubleword(Rbase, Rinstance_size);
-      // fallthru: __ b(Linitialize_header);
     }
 
     // --------------------------------------------------------------------------
     // Init2: Initialize the header: mark, klass
-    __ bind(Linitialize_header);
-
     // Init mark.
     if (UseBiasedLocking) {
       __ ld(Rscratch, in_bytes(Klass::prototype_header_offset()), RinstanceKlass);
@@ -3780,14 +3733,19 @@
     __ store_klass(RallocatedObject, RinstanceKlass, Rscratch); // klass (last for cms)
 
     // Check and trigger dtrace event.
-    {
-      SkipIfEqualZero skip_if(_masm, Rscratch, &DTraceAllocProbes);
-      __ push(atos);
-      __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc));
-      __ pop(atos);
-    }
+    SkipIfEqualZero::skip_to_label_if_equal_zero(_masm, Rscratch, &DTraceAllocProbes, Ldone);
+    __ push(atos);
+    __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc));
+    __ pop(atos);
+
+    __ b(Ldone);
   }
 
+  // --------------------------------------------------------------------------
+  // slow case
+  __ bind(Lslow_case);
+  call_VM(R17_tos, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), Rcpool, Rindex);
+
   // continue
   __ bind(Ldone);