< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp

Print this page
@@ -1,7 +1,8 @@
  /*
   * Copyright (c) 2018, 2022, Red Hat, Inc. All rights reserved.
+  * Copyright Amazon.com Inc. 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
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -26,10 +27,11 @@
  #include "gc/shared/gcArguments.hpp"
  #include "gc/shared/tlab_globals.hpp"
  #include "gc/shared/workerPolicy.hpp"
  #include "gc/shenandoah/shenandoahArguments.hpp"
  #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
+ #include "gc/shenandoah/shenandoahGenerationalHeap.hpp"
  #include "gc/shenandoah/shenandoahHeap.inline.hpp"
  #include "gc/shenandoah/shenandoahHeapRegion.hpp"
  #include "runtime/globals_extension.hpp"
  #include "runtime/java.hpp"
  #include "utilities/defaultStream.hpp"

@@ -48,10 +50,11 @@
  
    FLAG_SET_DEFAULT(ShenandoahSATBBarrier,            false);
    FLAG_SET_DEFAULT(ShenandoahLoadRefBarrier,         false);
    FLAG_SET_DEFAULT(ShenandoahIUBarrier,              false);
    FLAG_SET_DEFAULT(ShenandoahCASBarrier,             false);
+   FLAG_SET_DEFAULT(ShenandoahCardBarrier,            false);
    FLAG_SET_DEFAULT(ShenandoahCloneBarrier,           false);
  
    FLAG_SET_DEFAULT(ShenandoahVerifyOptoBarriers,     false);
  #endif
    if (UseLargePages) {

@@ -67,10 +70,17 @@
    // storage allocation code NUMA-aware.
    if (FLAG_IS_DEFAULT(UseNUMA)) {
      FLAG_SET_DEFAULT(UseNUMA, true);
    }
  
+   // We use this as the time period for tracking minimum mutator utilization (MMU).
+   // In generational mode, the MMU is used as a signal to adjust the size of the
+   // young generation.
+   if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) {
+     FLAG_SET_DEFAULT(GCPauseIntervalMillis, 5000);
+   }
+ 
    // Set up default number of concurrent threads. We want to have cycles complete fast
    // enough, but we also do not want to steal too much CPU from the concurrently running
    // application. Using 1/4 of available threads for concurrent GC seems a good
    // compromise here.
    bool ergo_conc = FLAG_IS_DEFAULT(ConcGCThreads);

@@ -142,10 +152,14 @@
  #else
    guarantee(!ShenandoahVerifyOptoBarriers, "Should be disabled");
  #endif // ASSERT
  #endif // COMPILER2
  
+   if (ShenandoahIUBarrier) {
+     assert(strcmp(ShenandoahGCMode, "generational"), "Generational mode does not support IU barrier");
+   }
+ 
    // Record more information about previous cycles for improved debugging pleasure
    if (FLAG_IS_DEFAULT(LogEventsBufferEntries)) {
      FLAG_SET_DEFAULT(LogEventsBufferEntries, 250);
    }
  

@@ -176,10 +190,12 @@
    }
    return align;
  }
  
  void ShenandoahArguments::initialize_alignments() {
+   CardTable::initialize_card_size();
+ 
    // Need to setup sizes early to get correct alignments.
    MaxHeapSize = ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
  
    // This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
    size_t align = ShenandoahHeapRegion::region_size_bytes();

@@ -189,7 +205,10 @@
    SpaceAlignment = align;
    HeapAlignment = align;
  }
  
  CollectedHeap* ShenandoahArguments::create_heap() {
+   if (strcmp(ShenandoahGCMode, "generational") == 0) {
+     return new ShenandoahGenerationalHeap(new ShenandoahCollectorPolicy());
+   }
    return new ShenandoahHeap(new ShenandoahCollectorPolicy());
  }
< prev index next >