< prev index next >

src/hotspot/share/gc/epsilon/epsilonHeap.cpp

Print this page
rev 59459 : 8245718: Epsilon: improve configuration logging
Reviewed-by: XXX


   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/epsilon/epsilonHeap.hpp"

  27 #include "gc/epsilon/epsilonMemoryPool.hpp"
  28 #include "gc/epsilon/epsilonThreadLocalData.hpp"
  29 #include "gc/shared/gcArguments.hpp"
  30 #include "gc/shared/locationPrinter.inline.hpp"
  31 #include "memory/allocation.hpp"
  32 #include "memory/allocation.inline.hpp"
  33 #include "memory/resourceArea.hpp"
  34 #include "memory/universe.hpp"
  35 #include "runtime/atomic.hpp"
  36 #include "runtime/globals.hpp"
  37 
  38 jint EpsilonHeap::initialize() {
  39   size_t align = HeapAlignment;
  40   size_t init_byte_size = align_up(InitialHeapSize, align);
  41   size_t max_byte_size  = align_up(MaxHeapSize, align);
  42 
  43   // Initialize backing storage
  44   ReservedHeapSpace heap_rs = Universe::reserve_heap(max_byte_size, align);
  45   _virtual_space.initialize(heap_rs, init_byte_size);
  46 


  50   initialize_reserved_region(heap_rs);
  51 
  52   _space = new ContiguousSpace();
  53   _space->initialize(committed_region, /* clear_space = */ true, /* mangle_space = */ true);
  54 
  55   // Precompute hot fields
  56   _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), align_object_size(EpsilonMaxTLABSize / HeapWordSize));
  57   _step_counter_update = MIN2<size_t>(max_byte_size / 16, EpsilonUpdateCountersStep);
  58   _step_heap_print = (EpsilonPrintHeapSteps == 0) ? SIZE_MAX : (max_byte_size / EpsilonPrintHeapSteps);
  59   _decay_time_ns = (int64_t) EpsilonTLABDecayTime * NANOSECS_PER_MILLISEC;
  60 
  61   // Enable monitoring
  62   _monitoring_support = new EpsilonMonitoringSupport(this);
  63   _last_counter_update = 0;
  64   _last_heap_print = 0;
  65 
  66   // Install barrier set
  67   BarrierSet::set_barrier_set(new EpsilonBarrierSet());
  68 
  69   // All done, print out the configuration
  70   if (init_byte_size != max_byte_size) {
  71     log_info(gc)("Resizeable heap; starting at " SIZE_FORMAT "M, max: " SIZE_FORMAT "M, step: " SIZE_FORMAT "M",
  72                  init_byte_size / M, max_byte_size / M, EpsilonMinHeapExpand / M);
  73   } else {
  74     log_info(gc)("Non-resizeable heap; start/max: " SIZE_FORMAT "M", init_byte_size / M);
  75   }
  76 
  77   if (UseTLAB) {
  78     log_info(gc)("Using TLAB allocation; max: " SIZE_FORMAT "K", _max_tlab_size * HeapWordSize / K);
  79     if (EpsilonElasticTLAB) {
  80       log_info(gc)("Elastic TLABs enabled; elasticity: %.2fx", EpsilonTLABElasticity);
  81     }
  82     if (EpsilonElasticTLABDecay) {
  83       log_info(gc)("Elastic TLABs decay enabled; decay time: " SIZE_FORMAT "ms", EpsilonTLABDecayTime);
  84     }
  85   } else {
  86     log_info(gc)("Not using TLAB allocation");
  87   }
  88 
  89   return JNI_OK;
  90 }
  91 
  92 void EpsilonHeap::post_initialize() {
  93   CollectedHeap::post_initialize();
  94 }
  95 
  96 void EpsilonHeap::initialize_serviceability() {
  97   _pool = new EpsilonMemoryPool(this);
  98   _memory_manager.add_pool(_pool);
  99 }
 100 
 101 GrowableArray<GCMemoryManager*> EpsilonHeap::memory_managers() {
 102   GrowableArray<GCMemoryManager*> memory_managers(1);
 103   memory_managers.append(&_memory_manager);
 104   return memory_managers;
 105 }
 106 
 107 GrowableArray<MemoryPool*> EpsilonHeap::memory_pools() {




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/epsilon/epsilonHeap.hpp"
  27 #include "gc/epsilon/epsilonInitLogger.hpp"
  28 #include "gc/epsilon/epsilonMemoryPool.hpp"
  29 #include "gc/epsilon/epsilonThreadLocalData.hpp"
  30 #include "gc/shared/gcArguments.hpp"
  31 #include "gc/shared/locationPrinter.inline.hpp"
  32 #include "memory/allocation.hpp"
  33 #include "memory/allocation.inline.hpp"
  34 #include "memory/resourceArea.hpp"
  35 #include "memory/universe.hpp"
  36 #include "runtime/atomic.hpp"
  37 #include "runtime/globals.hpp"
  38 
  39 jint EpsilonHeap::initialize() {
  40   size_t align = HeapAlignment;
  41   size_t init_byte_size = align_up(InitialHeapSize, align);
  42   size_t max_byte_size  = align_up(MaxHeapSize, align);
  43 
  44   // Initialize backing storage
  45   ReservedHeapSpace heap_rs = Universe::reserve_heap(max_byte_size, align);
  46   _virtual_space.initialize(heap_rs, init_byte_size);
  47 


  51   initialize_reserved_region(heap_rs);
  52 
  53   _space = new ContiguousSpace();
  54   _space->initialize(committed_region, /* clear_space = */ true, /* mangle_space = */ true);
  55 
  56   // Precompute hot fields
  57   _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), align_object_size(EpsilonMaxTLABSize / HeapWordSize));
  58   _step_counter_update = MIN2<size_t>(max_byte_size / 16, EpsilonUpdateCountersStep);
  59   _step_heap_print = (EpsilonPrintHeapSteps == 0) ? SIZE_MAX : (max_byte_size / EpsilonPrintHeapSteps);
  60   _decay_time_ns = (int64_t) EpsilonTLABDecayTime * NANOSECS_PER_MILLISEC;
  61 
  62   // Enable monitoring
  63   _monitoring_support = new EpsilonMonitoringSupport(this);
  64   _last_counter_update = 0;
  65   _last_heap_print = 0;
  66 
  67   // Install barrier set
  68   BarrierSet::set_barrier_set(new EpsilonBarrierSet());
  69 
  70   // All done, print out the configuration
  71   EpsilonInitLogger::print();

















  72 
  73   return JNI_OK;
  74 }
  75 
  76 void EpsilonHeap::post_initialize() {
  77   CollectedHeap::post_initialize();
  78 }
  79 
  80 void EpsilonHeap::initialize_serviceability() {
  81   _pool = new EpsilonMemoryPool(this);
  82   _memory_manager.add_pool(_pool);
  83 }
  84 
  85 GrowableArray<GCMemoryManager*> EpsilonHeap::memory_managers() {
  86   GrowableArray<GCMemoryManager*> memory_managers(1);
  87   memory_managers.append(&_memory_manager);
  88   return memory_managers;
  89 }
  90 
  91 GrowableArray<MemoryPool*> EpsilonHeap::memory_pools() {


< prev index next >