7127700: G1: Replace G1PLAB with PLAB
authortschatzl
Tue, 13 Feb 2018 16:13:20 +0100
changeset 48963 7e09b699f7b6
parent 48962 88ad6c676c87
child 48964 86143b5899dc
7127700: G1: Replace G1PLAB with PLAB Reviewed-by: sjohanss, kbarrett
src/hotspot/share/gc/g1/g1Allocator.cpp
src/hotspot/share/gc/g1/g1Allocator.hpp
src/hotspot/share/gc/g1/g1Allocator.inline.hpp
src/hotspot/share/gc/g1/g1ParScanThreadState.cpp
src/hotspot/share/gc/shared/plab.hpp
--- a/src/hotspot/share/gc/g1/g1Allocator.cpp	Tue Feb 13 14:10:56 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1Allocator.cpp	Tue Feb 13 16:13:20 2018 +0100
@@ -134,9 +134,6 @@
   _old_is_full = true;
 }
 
-G1PLAB::G1PLAB(size_t gclab_word_size) :
-  PLAB(gclab_word_size), _retired(true) { }
-
 size_t G1Allocator::unsafe_max_tlab_alloc(AllocationContext_t context) {
   // Return the remaining space in the cur alloc region, but not less than
   // the min TLAB size.
@@ -253,7 +250,7 @@
   if ((required_in_plab <= plab_word_size) &&
     may_throw_away_buffer(required_in_plab, plab_word_size)) {
 
-    G1PLAB* alloc_buf = alloc_buffer(dest, context);
+    PLAB* alloc_buf = alloc_buffer(dest, context);
     alloc_buf->retire();
 
     size_t actual_plab_size = 0;
@@ -304,7 +301,7 @@
 
 void G1DefaultPLABAllocator::flush_and_retire_stats() {
   for (uint state = 0; state < InCSetState::Num; state++) {
-    G1PLAB* const buf = _alloc_buffers[state];
+    PLAB* const buf = _alloc_buffers[state];
     if (buf != NULL) {
       G1EvacStats* stats = _g1h->alloc_buffer_stats(state);
       buf->flush_and_retire_stats(stats);
@@ -318,7 +315,7 @@
   wasted = 0;
   undo_wasted = 0;
   for (uint state = 0; state < InCSetState::Num; state++) {
-    G1PLAB * const buf = _alloc_buffers[state];
+    PLAB * const buf = _alloc_buffers[state];
     if (buf != NULL) {
       wasted += buf->waste();
       undo_wasted += buf->undo_waste();
--- a/src/hotspot/share/gc/g1/g1Allocator.hpp	Tue Feb 13 14:10:56 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1Allocator.hpp	Tue Feb 13 16:13:20 2018 +0100
@@ -178,39 +178,6 @@
   }
 };
 
-class G1PLAB: public PLAB {
-private:
-  bool _retired;
-
-public:
-  G1PLAB(size_t gclab_word_size);
-  virtual ~G1PLAB() {
-    guarantee(_retired, "Allocation buffer has not been retired");
-  }
-
-  // The amount of space in words wasted within the PLAB including
-  // waste due to refills and alignment.
-  size_t wasted() const { return _wasted; }
-
-  virtual void set_buf(HeapWord* buf, size_t word_size) {
-    PLAB::set_buf(buf, word_size);
-    _retired = false;
-  }
-
-  virtual void retire() {
-    if (_retired) {
-      return;
-    }
-    PLAB::retire();
-    _retired = true;
-  }
-
-  virtual void flush_and_retire_stats(PLABStats* stats) {
-    PLAB::flush_and_retire_stats(stats);
-    _retired = true;
-  }
-};
-
 // Manages the PLABs used during garbage collection. Interface for allocation from PLABs.
 // Needs to handle multiple contexts, extra alignment in any "survivor" area and some
 // statistics.
@@ -231,7 +198,7 @@
   size_t _direct_allocated[InCSetState::Num];
 
   virtual void flush_and_retire_stats() = 0;
-  virtual G1PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) = 0;
+  virtual PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) = 0;
 
   // Calculate the survivor space object alignment in bytes. Returns that or 0 if
   // there are no restrictions on survivor alignment.
@@ -292,14 +259,14 @@
 // The default PLAB allocator for G1. Keeps the current (single) PLAB for survivor
 // and old generation allocation.
 class G1DefaultPLABAllocator : public G1PLABAllocator {
-  G1PLAB  _surviving_alloc_buffer;
-  G1PLAB  _tenured_alloc_buffer;
-  G1PLAB* _alloc_buffers[InCSetState::Num];
+  PLAB  _surviving_alloc_buffer;
+  PLAB  _tenured_alloc_buffer;
+  PLAB* _alloc_buffers[InCSetState::Num];
 
 public:
   G1DefaultPLABAllocator(G1Allocator* _allocator);
 
-  virtual G1PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) {
+  virtual PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) {
     assert(dest.is_valid(),
            "Allocation buffer index out-of-bounds: " CSETSTATE_FORMAT, dest.value());
     assert(_alloc_buffers[dest.value()] != NULL,
--- a/src/hotspot/share/gc/g1/g1Allocator.inline.hpp	Tue Feb 13 14:10:56 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1Allocator.inline.hpp	Tue Feb 13 16:13:20 2018 +0100
@@ -47,7 +47,7 @@
 inline HeapWord* G1PLABAllocator::plab_allocate(InCSetState dest,
                                                 size_t word_sz,
                                                 AllocationContext_t context) {
-  G1PLAB* buffer = alloc_buffer(dest, context);
+  PLAB* buffer = alloc_buffer(dest, context);
   if (_survivor_alignment_bytes == 0 || !dest.is_young()) {
     return buffer->allocate(word_sz);
   } else {
--- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp	Tue Feb 13 14:10:56 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp	Tue Feb 13 16:13:20 2018 +0100
@@ -206,7 +206,7 @@
                                                   oop const old, size_t word_sz, uint age,
                                                   HeapWord * const obj_ptr,
                                                   const AllocationContext_t context) const {
-  G1PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state, context);
+  PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state, context);
   if (alloc_buf->contains(obj_ptr)) {
     _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz, age,
                                                              dest_state.value() == InCSetState::Old,
--- a/src/hotspot/share/gc/shared/plab.hpp	Tue Feb 13 14:10:56 2018 +0100
+++ b/src/hotspot/share/gc/shared/plab.hpp	Tue Feb 13 16:13:20 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,7 +72,6 @@
   // Initializes the buffer to be empty, but with the given "word_sz".
   // Must get initialized with "set_buf" for an allocation to succeed.
   PLAB(size_t word_sz);
-  virtual ~PLAB() {}
 
   static size_t size_required_for_allocation(size_t word_size) { return word_size + AlignmentReserve; }
 
@@ -120,7 +119,7 @@
   }
 
   // Sets the space of the buffer to be [buf, space+word_sz()).
-  virtual void set_buf(HeapWord* buf, size_t new_word_sz) {
+  void set_buf(HeapWord* buf, size_t new_word_sz) {
     assert(new_word_sz > AlignmentReserve, "Too small");
     _word_sz = new_word_sz;
 
@@ -136,11 +135,11 @@
   // Flush allocation statistics into the given PLABStats supporting ergonomic
   // sizing of PLAB's and retire the current buffer. To be called at the end of
   // GC.
-  virtual void flush_and_retire_stats(PLABStats* stats);
+  void flush_and_retire_stats(PLABStats* stats);
 
   // Fills in the unallocated portion of the buffer with a garbage object and updates
   // statistics. To be called during GC.
-  virtual void retire();
+  void retire();
 };
 
 // PLAB book-keeping.