< prev index next >

src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp

Print this page
rev 7471 : 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
Summary: Evaluate and improve object copy time by micro-optimizations and splitting out slow and fast paths aggressively.
Reviewed-by:
Contributed-by: Tony Printezis <tprintezis@twitter.com>, Thomas Schatzl <thomas.schatzl@oracle.com>
rev 7472 : [mq]: 8060025-mikael-review1

@@ -30,10 +30,11 @@
 #include "gc_implementation/g1/concurrentMark.hpp"
 #include "gc_implementation/g1/evacuationInfo.hpp"
 #include "gc_implementation/g1/g1AllocRegion.hpp"
 #include "gc_implementation/g1/g1BiasedArray.hpp"
 #include "gc_implementation/g1/g1HRPrinter.hpp"
+#include "gc_implementation/g1/g1InCSetState.hpp"
 #include "gc_implementation/g1/g1MonitoringSupport.hpp"
 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
 #include "gc_implementation/g1/g1YCTypes.hpp"
 #include "gc_implementation/g1/heapRegionManager.hpp"
 #include "gc_implementation/g1/heapRegionSet.hpp"

@@ -545,26 +546,13 @@
 
   // Allocate blocks during garbage collection. Will ensure an
   // allocation region, either by picking one or expanding the
   // heap, and then allocate a block of the given size. The block
   // may not be a humongous - it must fit into a single heap region.
-  HeapWord* par_allocate_during_gc(in_cset_state_t dest,
+  inline HeapWord* par_allocate_during_gc(in_cset_state_t dest,
                                    size_t word_size,
-                                   AllocationContext_t context) {
-    switch (dest) {
-      case InCSetState::Young:
-        return survivor_attempt_allocation(word_size, context);
-      case InCSetState::Old:
-        return old_attempt_allocation(word_size, context);
-      default:
-        assert(false, err_msg("Unknown dest: %d", dest));
-        break;
-    }
-    // keep some compilers happy
-    return NULL;
-  }
-
+                                          AllocationContext_t context);
   // Ensure that no further allocations can happen in "r", bearing in mind
   // that parallel threads might be attempting allocations.
   void par_allocate_remaining_space(HeapRegion* r);
 
   // Allocation attempt during GC for a survivor object / PLAB.

@@ -646,45 +634,14 @@
   // false otherwise.
   // (Rounds up to a HeapRegion boundary.)
   bool expand(size_t expand_bytes);
 
   // Returns the PLAB statistics for a given destination.
-  PLABStats* alloc_buffer_stats(in_cset_state_t dest) {
-    switch (dest) {
-      case InCSetState::Young:
-        return &_survivor_plab_stats;
-      case InCSetState::Old:
-        return &_old_plab_stats;
-      default:
-        assert(false, err_msg("unknown dest: %d", dest));
-        break;
-    }
-    // keep some compilers happy
-    return NULL;
-  }
+  inline PLABStats* alloc_buffer_stats(in_cset_state_t dest);
 
   // Determines PLAB size for a given destination.
-  size_t desired_plab_sz(in_cset_state_t dest) {
-    size_t gclab_word_size = 0;
-    switch (dest) {
-      case InCSetState::Young:
-        gclab_word_size = _survivor_plab_stats.desired_plab_sz();
-        break;
-      case InCSetState::Old:
-        gclab_word_size = _old_plab_stats.desired_plab_sz();
-        break;
-      default:
-        assert(false, err_msg("Unknown dest: %d", dest));
-        break;
-    }
-
-    // Prevent humongous PLAB sizes for two reasons:
-    // * PLABs are allocated using a similar paths as oops, but should
-    //   never be in a humongous region
-    // * Allowing humongous PLABs needlessly churns the region free lists
-    return MIN2(_humongous_object_threshold_in_words, gclab_word_size);
-  }
+  inline size_t desired_plab_sz(in_cset_state_t dest);
 
   inline AllocationContextStats& allocation_context_stats();
 
   // Do anything common to GC's.
   virtual void gc_prologue(bool full);

@@ -1206,11 +1163,11 @@
   // have any spurious marks. If errors are detected, print
   // appropriate error messages and crash.
   void check_bitmaps(const char* caller) PRODUCT_RETURN;
 
   // Do sanity check on the contents of the in-cset fast test table.
-  bool check_cset_fast_test();
+  bool check_cset_fast_test() PRODUCT_RETURN_( return true; );
 
   // verify_region_sets() performs verification over the region
   // lists. It will be compiled in the product code to be used when
   // necessary (i.e., during heap verification).
   void verify_region_sets();

@@ -1304,50 +1261,10 @@
   inline bool is_in_cset(oop obj);
 
   inline bool is_in_cset_or_humongous(const oop obj);
 
  private:
-  // Instances of this class are used for quick tests on whether a reference points
-  // into the collection set and into which generation or is a humongous object
-  //
-  // Each of the array's elements indicates whether the corresponding region is in
-  // the collection set and if so in which generation, or a humongous region.
-  //
-  // We use this to speed up reference processing during young collection and
-  // quickly reclaim humongous objects. For the latter, by making a humongous region
-  // succeed this test, we sort-of add it to the collection set. During the reference
-  // iteration closures, when we see a humongous region, we then simply mark it as
-  // referenced, i.e. live.
-  class G1InCSetStateFastTestBiasedMappedArray : public G1BiasedMappedArray<in_cset_state_t> {
-   protected:
-    in_cset_state_t default_value() const { return InCSetState::NotInCSet; }
-   public:
-    void set_humongous(uintptr_t index) {
-      assert(get_by_index(index) == default_value(), "should be default");
-      set_by_index(index, InCSetState::humongous());
-    }
-
-    void clear_humongous(uintptr_t index) {
-      set_by_index(index, InCSetState::NotInCSet);
-    }
-
-    void set_in_young(uintptr_t index) {
-      assert(get_by_index(index) == default_value(), "should be default");
-      set_by_index(index, InCSetState::Young);
-    }
-
-    void set_in_old(uintptr_t index) {
-      assert(get_by_index(index) == default_value(), "should be default");
-      set_by_index(index, InCSetState::Old);
-    }
-
-    bool is_in_cset_or_humongous(HeapWord* addr) const { return InCSetState::is_in_cset_or_humongous(at(addr)); }
-    bool is_in_cset(HeapWord* addr) const { return InCSetState::is_in_cset(at(addr)); }
-    in_cset_state_t at(HeapWord* addr) const { return (in_cset_state_t) get_by_address(addr); }
-    void clear() { G1BiasedMappedArray<in_cset_state_t>::clear(); }
-  };
-
   // This array is used for a quick test on whether a reference points into
   // the collection set or not. Each of the array's elements denotes whether the
   // corresponding region is in the collection set or not.
   G1InCSetStateFastTestBiasedMappedArray _in_cset_fast_test;
 
< prev index next >