8155082: Refactor mutator region restriction
authorsjohanss
Wed, 27 Apr 2016 16:02:02 +0200
changeset 38106 da14ba2f0cd9
parent 38105 639785efc41a
child 38107 aee6db99b6c7
8155082: Refactor mutator region restriction Reviewed-by: mgerdin, tschatzl
hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp
hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp
hotspot/src/share/vm/gc/g1/g1DefaultPolicy.hpp
hotspot/src/share/vm/gc/g1/g1Policy.hpp
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Wed Apr 27 13:50:00 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Wed Apr 27 16:02:02 2016 +0200
@@ -5318,14 +5318,14 @@
   assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
   assert(!force || g1_policy()->can_expand_young_list(),
          "if force is true we should be able to expand the young list");
-  bool young_list_full = g1_policy()->is_young_list_full();
-  if (force || !young_list_full) {
+  bool should_allocate = g1_policy()->should_allocate_mutator_region();
+  if (force || should_allocate) {
     HeapRegion* new_alloc_region = new_region(word_size,
                                               false /* is_old */,
                                               false /* do_expand */);
     if (new_alloc_region != NULL) {
       set_region_short_lived_locked(new_alloc_region);
-      _hr_printer.alloc(new_alloc_region, young_list_full);
+      _hr_printer.alloc(new_alloc_region, !should_allocate);
       _verifier->check_bitmaps("Mutator Region Allocation", new_alloc_region);
       return new_alloc_region;
     }
--- a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp	Wed Apr 27 13:50:00 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp	Wed Apr 27 16:02:02 2016 +0200
@@ -911,10 +911,10 @@
 #endif // PRODUCT
 }
 
-bool G1DefaultPolicy::is_young_list_full() const {
+bool G1DefaultPolicy::should_allocate_mutator_region() const {
   uint young_list_length = _g1->young_list()->length();
   uint young_list_target_length = _young_list_target_length;
-  return young_list_length >= young_list_target_length;
+  return young_list_length < young_list_target_length;
 }
 
 bool G1DefaultPolicy::can_expand_young_list() const {
--- a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.hpp	Wed Apr 27 13:50:00 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.hpp	Wed Apr 27 16:02:02 2016 +0200
@@ -384,7 +384,7 @@
 
   size_t young_list_target_length() const { return _young_list_target_length; }
 
-  bool is_young_list_full() const;
+  bool should_allocate_mutator_region() const;
 
   bool can_expand_young_list() const;
 
--- a/hotspot/src/share/vm/gc/g1/g1Policy.hpp	Wed Apr 27 13:50:00 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1Policy.hpp	Wed Apr 27 16:02:02 2016 +0200
@@ -162,7 +162,7 @@
 
   virtual size_t young_list_target_length() const = 0;
 
-  virtual bool is_young_list_full() const = 0;
+  virtual bool should_allocate_mutator_region() const = 0;
 
   virtual bool can_expand_young_list() const = 0;