src/share/vm/gc_implementation/parallelScavenge/psScavenge.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hsx-gc.pslb Sdiff src/share/vm/gc_implementation/parallelScavenge

src/share/vm/gc_implementation/parallelScavenge/psScavenge.hpp

Print this page




  51    promoted_too_large,
  52    full_follows_scavenge
  53  };
  54 
  55   // Saved value of to_space->top(), used to prevent objects in to_space from
  56   // being rescanned.
  57   static HeapWord* _to_space_top_before_gc;
  58 
  59   // Number of consecutive attempts to scavenge that were skipped
  60   static int                _consecutive_skipped_scavenges;
  61 
  62 
  63  protected:
  64   // Flags/counters
  65   static ReferenceProcessor* _ref_processor;        // Reference processor for scavenging.
  66   static PSIsAliveClosure    _is_alive_closure;     // Closure used for reference processing
  67   static CardTableExtension* _card_table;           // We cache the card table for fast access.
  68   static bool                _survivor_overflow;    // Overflow this collection
  69   static uint                _tenuring_threshold;   // tenuring threshold for next scavenge
  70   static elapsedTimer        _accumulated_time;     // total time spent on scavenge
  71   static HeapWord*           _young_generation_boundary; // The lowest address possible for the young_gen.
  72                                                          // This is used to decide if an oop should be scavenged,
  73                                                          // cards should be marked, etc.



  74   static Stack<markOop, mtGC> _preserved_mark_stack; // List of marks to be restored after failed promotion
  75   static Stack<oop, mtGC>     _preserved_oop_stack;  // List of oops that need their mark restored.
  76   static CollectorCounters*      _counters;          // collector performance counters
  77   static bool                    _promotion_failed;
  78 
  79   static void clean_up_failed_promotion();
  80 
  81   static bool should_attempt_scavenge();
  82 
  83   static HeapWord* to_space_top_before_gc() { return _to_space_top_before_gc; }
  84   static inline void save_to_space_top_before_gc();
  85 
  86   // Private accessors
  87   static CardTableExtension* const card_table()       { assert(_card_table != NULL, "Sanity"); return _card_table; }
  88 
  89  public:
  90   // Accessors
  91   static uint             tenuring_threshold()  { return _tenuring_threshold; }
  92   static elapsedTimer*    accumulated_time()    { return &_accumulated_time; }
  93   static bool             promotion_failed()    { return _promotion_failed; }


  95     { return _consecutive_skipped_scavenges; }
  96 
  97   // Performance Counters
  98   static CollectorCounters* counters()           { return _counters; }
  99 
 100   // Used by scavenge_contents && psMarkSweep
 101   static ReferenceProcessor* const reference_processor() {
 102     assert(_ref_processor != NULL, "Sanity");
 103     return _ref_processor;
 104   }
 105   // Used to add tasks
 106   static GCTaskManager* const gc_task_manager();
 107   // The promotion managers tell us if they encountered overflow
 108   static void set_survivor_overflow(bool state) {
 109     _survivor_overflow = state;
 110   }
 111   // Adaptive size policy support.  When the young generation/old generation
 112   // boundary moves, _young_generation_boundary must be reset
 113   static void set_young_generation_boundary(HeapWord* v) {
 114     _young_generation_boundary = v;



 115   }
 116 
 117   // Called by parallelScavengeHeap to init the tenuring threshold
 118   static void initialize();
 119 
 120   // Scavenge entry point.  This may invoke a full gc; return true if so.
 121   static bool invoke();
 122   // Return true if a collection was done; false otherwise.
 123   static bool invoke_no_policy();
 124 
 125   // If an attempt to promote fails, this method is invoked
 126   static void oop_promotion_failed(oop obj, markOop obj_mark);
 127 
 128   template <class T> static inline bool should_scavenge(T* p);
 129 
 130   // These call should_scavenge() above and, if it returns true, also check that
 131   // the object was not newly copied into to_space.  The version with the bool
 132   // argument is a convenience wrapper that fetches the to_space pointer from
 133   // the heap and calls the other version (if the arg is true).
 134   template <class T> static inline bool should_scavenge(T* p, MutableSpace* to_space);
 135   template <class T> static inline bool should_scavenge(T* p, bool check_to_space);
 136 
 137   template <class T, bool promote_immediately>
 138     inline static void copy_and_push_safe_barrier(PSPromotionManager* pm, T* p);
 139 
 140   static void copy_and_push_safe_barrier_from_klass(PSPromotionManager* pm, oop* p);
 141 
 142   // Is an object in the young generation
 143   // This assumes that the HeapWord argument is in the heap,
 144   // so it only checks one side of the complete predicate.









 145   inline static bool is_obj_in_young(HeapWord* o) {
 146     const bool result = (o >= _young_generation_boundary);
 147     return result;
 148   }
 149 };
 150 
 151 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_HPP


  51    promoted_too_large,
  52    full_follows_scavenge
  53  };
  54 
  55   // Saved value of to_space->top(), used to prevent objects in to_space from
  56   // being rescanned.
  57   static HeapWord* _to_space_top_before_gc;
  58 
  59   // Number of consecutive attempts to scavenge that were skipped
  60   static int                _consecutive_skipped_scavenges;
  61 
  62 
  63  protected:
  64   // Flags/counters
  65   static ReferenceProcessor*  _ref_processor;        // Reference processor for scavenging.
  66   static PSIsAliveClosure     _is_alive_closure;     // Closure used for reference processing
  67   static CardTableExtension*  _card_table;           // We cache the card table for fast access.
  68   static bool                 _survivor_overflow;    // Overflow this collection
  69   static uint                 _tenuring_threshold;   // tenuring threshold for next scavenge
  70   static elapsedTimer         _accumulated_time;     // total time spent on scavenge
  71   // The lowest address possible for the young_gen.
  72   // This is used to decide if an oop should be scavenged,
  73   // cards should be marked, etc.
  74   static HeapWord*            _young_generation_boundary;
  75   // Used to optimize compressed oops young gen boundary checking.
  76   static uintptr_t            _young_generation_boundary_compressed;
  77   static Stack<markOop, mtGC> _preserved_mark_stack; // List of marks to be restored after failed promotion
  78   static Stack<oop, mtGC>     _preserved_oop_stack;  // List of oops that need their mark restored.
  79   static CollectorCounters*   _counters;             // collector performance counters
  80   static bool                 _promotion_failed;
  81 
  82   static void clean_up_failed_promotion();
  83 
  84   static bool should_attempt_scavenge();
  85 
  86   static HeapWord* to_space_top_before_gc() { return _to_space_top_before_gc; }
  87   static inline void save_to_space_top_before_gc();
  88 
  89   // Private accessors
  90   static CardTableExtension* const card_table()       { assert(_card_table != NULL, "Sanity"); return _card_table; }
  91 
  92  public:
  93   // Accessors
  94   static uint             tenuring_threshold()  { return _tenuring_threshold; }
  95   static elapsedTimer*    accumulated_time()    { return &_accumulated_time; }
  96   static bool             promotion_failed()    { return _promotion_failed; }


  98     { return _consecutive_skipped_scavenges; }
  99 
 100   // Performance Counters
 101   static CollectorCounters* counters()           { return _counters; }
 102 
 103   // Used by scavenge_contents && psMarkSweep
 104   static ReferenceProcessor* const reference_processor() {
 105     assert(_ref_processor != NULL, "Sanity");
 106     return _ref_processor;
 107   }
 108   // Used to add tasks
 109   static GCTaskManager* const gc_task_manager();
 110   // The promotion managers tell us if they encountered overflow
 111   static void set_survivor_overflow(bool state) {
 112     _survivor_overflow = state;
 113   }
 114   // Adaptive size policy support.  When the young generation/old generation
 115   // boundary moves, _young_generation_boundary must be reset
 116   static void set_young_generation_boundary(HeapWord* v) {
 117     _young_generation_boundary = v;
 118     if (UseCompressedOops) {
 119       _young_generation_boundary_compressed = (uintptr_t)oopDesc::encode_heap_oop((oop)v);
 120     }
 121   }
 122 
 123   // Called by parallelScavengeHeap to init the tenuring threshold
 124   static void initialize();
 125 
 126   // Scavenge entry point.  This may invoke a full gc; return true if so.
 127   static bool invoke();
 128   // Return true if a collection was done; false otherwise.
 129   static bool invoke_no_policy();
 130 
 131   // If an attempt to promote fails, this method is invoked
 132   static void oop_promotion_failed(oop obj, markOop obj_mark);
 133 
 134   template <class T> static inline bool should_scavenge(T* p);
 135 
 136   // These call should_scavenge() above and, if it returns true, also check that
 137   // the object was not newly copied into to_space.  The version with the bool
 138   // argument is a convenience wrapper that fetches the to_space pointer from
 139   // the heap and calls the other version (if the arg is true).
 140   template <class T> static inline bool should_scavenge(T* p, MutableSpace* to_space);
 141   template <class T> static inline bool should_scavenge(T* p, bool check_to_space);
 142 
 143   template <class T, bool promote_immediately>
 144     inline static void copy_and_push_safe_barrier(PSPromotionManager* pm, T* p);
 145 
 146   static void copy_and_push_safe_barrier_from_klass(PSPromotionManager* pm, oop* p);
 147 
 148   // Is an object in the young generation
 149   // This assumes that the 'o' is in the heap,
 150   // so it only checks one side of the complete predicate.
 151 
 152   inline static bool is_obj_in_young(oop o) {
 153     return (HeapWord*)o >= _young_generation_boundary;
 154   }
 155 
 156   inline static bool is_obj_in_young(narrowOop o) {
 157     return (uintptr_t)o >= _young_generation_boundary_compressed;
 158   }
 159 
 160   inline static bool is_obj_in_young(HeapWord* o) {
 161     return o >= _young_generation_boundary;

 162   }
 163 };
 164 
 165 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_HPP
src/share/vm/gc_implementation/parallelScavenge/psScavenge.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File