src/share/vm/gc_implementation/parNew/parNewGeneration.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/gc_implementation/parNew

src/share/vm/gc_implementation/parNew/parNewGeneration.hpp

Print this page




  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 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP
  27 
  28 #include "gc_implementation/parNew/parOopClosures.hpp"
  29 #include "gc_implementation/shared/gcTrace.hpp"
  30 #include "gc_implementation/shared/parGCAllocBuffer.hpp"
  31 #include "gc_implementation/shared/copyFailedInfo.hpp"
  32 #include "memory/defNewGeneration.hpp"
  33 #include "memory/padded.hpp"
  34 #include "utilities/taskqueue.hpp"
  35 
  36 class ChunkArray;
  37 class ParScanWithoutBarrierClosure;
  38 class ParScanWithBarrierClosure;
  39 class ParRootScanWithoutBarrierClosure;
  40 class ParRootScanWithBarrierTwoGensClosure;
  41 class ParEvacuateFollowersClosure;
  42 
  43 // It would be better if these types could be kept local to the .cpp file,
  44 // but they must be here to allow ParScanClosure::do_oop_work to be defined
  45 // in genOopClosures.inline.hpp.
  46 
  47 typedef Padded<OopTaskQueue> ObjToScanQueue;
  48 typedef GenericTaskQueueSet<ObjToScanQueue, mtGC> ObjToScanQueueSet;
  49 
  50 class ParKeepAliveClosure: public DefNewGeneration::KeepAliveClosure {
  51  private:
  52   ParScanWeakRefClosure* _par_cl;
  53  protected:
  54   template <class T> void do_oop_work(T* p);
  55  public:
  56   ParKeepAliveClosure(ParScanWeakRefClosure* cl);
  57   virtual void do_oop(oop* p);
  58   virtual void do_oop(narrowOop* p);
  59 };
  60 
  61 // The state needed by thread performing parallel young-gen collection.
  62 class ParScanThreadState {
  63   friend class ParScanThreadStateSet;
  64  private:
  65   ObjToScanQueue *_work_queue;
  66   Stack<oop, mtGC>* const _overflow_stack;
  67 
  68   ParGCAllocBuffer _to_space_alloc_buffer;
  69 
  70   ParScanWithoutBarrierClosure         _to_space_closure; // scan_without_gc_barrier
  71   ParScanWithBarrierClosure            _old_gen_closure; // scan_with_gc_barrier
  72   ParRootScanWithoutBarrierClosure     _to_space_root_closure; // scan_root_without_gc_barrier
  73   // One of these two will be passed to process_roots, which will
  74   // set its generation.  The first is for two-gen configs where the
  75   // old gen collects the perm gen; the second is for arbitrary configs.
  76   // The second isn't used right now (it used to be used for the train, an
  77   // incremental collector) but the declaration has been left as a reminder.
  78   ParRootScanWithBarrierTwoGensClosure _older_gen_closure;
  79   // This closure will always be bound to the old gen; it will be used
  80   // in evacuate_followers.
  81   ParRootScanWithBarrierTwoGensClosure _old_gen_root_closure; // scan_old_root_with_gc_barrier
  82   ParEvacuateFollowersClosure          _evacuate_followers;
  83   DefNewGeneration::IsAliveClosure     _is_alive_closure;
  84   ParScanWeakRefClosure                _scan_weak_ref_closure;
  85   ParKeepAliveClosure                  _keep_alive_closure;
  86 
  87 
  88   Space* _to_space;


 123   void scan_partial_array_and_push_remainder(oop obj);
 124 
 125   // In support of CMS' parallel rescan of survivor space.
 126   ChunkArray* _survivor_chunk_array;
 127   ChunkArray* survivor_chunk_array() { return _survivor_chunk_array; }
 128 
 129   void record_survivor_plab(HeapWord* plab_start, size_t plab_word_size);
 130 
 131   ParScanThreadState(Space* to_space_, ParNewGeneration* gen_,
 132                      Generation* old_gen_, int thread_num_,
 133                      ObjToScanQueueSet* work_queue_set_,
 134                      Stack<oop, mtGC>* overflow_stacks_,
 135                      size_t desired_plab_sz_,
 136                      ParallelTaskTerminator& term_);
 137 
 138  public:
 139   ageTable* age_table() {return &_ageTable;}
 140 
 141   ObjToScanQueue* work_queue() { return _work_queue; }
 142 
 143   ParGCAllocBuffer* to_space_alloc_buffer() {
 144     return &_to_space_alloc_buffer;
 145   }
 146 
 147   ParEvacuateFollowersClosure&      evacuate_followers_closure() { return _evacuate_followers; }
 148   DefNewGeneration::IsAliveClosure& is_alive_closure() { return _is_alive_closure; }
 149   ParScanWeakRefClosure&            scan_weak_ref_closure() { return _scan_weak_ref_closure; }
 150   ParKeepAliveClosure&              keep_alive_closure() { return _keep_alive_closure; }
 151   ParScanClosure&                   older_gen_closure() { return _older_gen_closure; }
 152   ParRootScanWithoutBarrierClosure& to_space_root_closure() { return _to_space_root_closure; };
 153 
 154   // Decrease queue size below "max_size".
 155   void trim_queues(int max_size);
 156 
 157   // Private overflow stack usage
 158   Stack<oop, mtGC>* overflow_stack() { return _overflow_stack; }
 159   bool take_from_overflow_stack();
 160   void push_on_overflow_stack(oop p);
 161 
 162   // Is new_obj a candidate for scan_partial_array_and_push_remainder method.
 163   inline bool should_be_partially_scanned(oop new_obj, oop old_obj) const;




  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 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP
  27 
  28 #include "gc_implementation/parNew/parOopClosures.hpp"
  29 #include "gc_implementation/shared/gcTrace.hpp"
  30 #include "gc_implementation/shared/plab.hpp"
  31 #include "gc_implementation/shared/copyFailedInfo.hpp"
  32 #include "memory/defNewGeneration.hpp"
  33 #include "memory/padded.hpp"
  34 #include "utilities/taskqueue.hpp"
  35 
  36 class ChunkArray;
  37 class ParScanWithoutBarrierClosure;
  38 class ParScanWithBarrierClosure;
  39 class ParRootScanWithoutBarrierClosure;
  40 class ParRootScanWithBarrierTwoGensClosure;
  41 class ParEvacuateFollowersClosure;
  42 
  43 // It would be better if these types could be kept local to the .cpp file,
  44 // but they must be here to allow ParScanClosure::do_oop_work to be defined
  45 // in genOopClosures.inline.hpp.
  46 
  47 typedef Padded<OopTaskQueue> ObjToScanQueue;
  48 typedef GenericTaskQueueSet<ObjToScanQueue, mtGC> ObjToScanQueueSet;
  49 
  50 class ParKeepAliveClosure: public DefNewGeneration::KeepAliveClosure {
  51  private:
  52   ParScanWeakRefClosure* _par_cl;
  53  protected:
  54   template <class T> void do_oop_work(T* p);
  55  public:
  56   ParKeepAliveClosure(ParScanWeakRefClosure* cl);
  57   virtual void do_oop(oop* p);
  58   virtual void do_oop(narrowOop* p);
  59 };
  60 
  61 // The state needed by thread performing parallel young-gen collection.
  62 class ParScanThreadState {
  63   friend class ParScanThreadStateSet;
  64  private:
  65   ObjToScanQueue *_work_queue;
  66   Stack<oop, mtGC>* const _overflow_stack;
  67 
  68   PLAB _to_space_alloc_buffer;
  69 
  70   ParScanWithoutBarrierClosure         _to_space_closure; // scan_without_gc_barrier
  71   ParScanWithBarrierClosure            _old_gen_closure; // scan_with_gc_barrier
  72   ParRootScanWithoutBarrierClosure     _to_space_root_closure; // scan_root_without_gc_barrier
  73   // One of these two will be passed to process_roots, which will
  74   // set its generation.  The first is for two-gen configs where the
  75   // old gen collects the perm gen; the second is for arbitrary configs.
  76   // The second isn't used right now (it used to be used for the train, an
  77   // incremental collector) but the declaration has been left as a reminder.
  78   ParRootScanWithBarrierTwoGensClosure _older_gen_closure;
  79   // This closure will always be bound to the old gen; it will be used
  80   // in evacuate_followers.
  81   ParRootScanWithBarrierTwoGensClosure _old_gen_root_closure; // scan_old_root_with_gc_barrier
  82   ParEvacuateFollowersClosure          _evacuate_followers;
  83   DefNewGeneration::IsAliveClosure     _is_alive_closure;
  84   ParScanWeakRefClosure                _scan_weak_ref_closure;
  85   ParKeepAliveClosure                  _keep_alive_closure;
  86 
  87 
  88   Space* _to_space;


 123   void scan_partial_array_and_push_remainder(oop obj);
 124 
 125   // In support of CMS' parallel rescan of survivor space.
 126   ChunkArray* _survivor_chunk_array;
 127   ChunkArray* survivor_chunk_array() { return _survivor_chunk_array; }
 128 
 129   void record_survivor_plab(HeapWord* plab_start, size_t plab_word_size);
 130 
 131   ParScanThreadState(Space* to_space_, ParNewGeneration* gen_,
 132                      Generation* old_gen_, int thread_num_,
 133                      ObjToScanQueueSet* work_queue_set_,
 134                      Stack<oop, mtGC>* overflow_stacks_,
 135                      size_t desired_plab_sz_,
 136                      ParallelTaskTerminator& term_);
 137 
 138  public:
 139   ageTable* age_table() {return &_ageTable;}
 140 
 141   ObjToScanQueue* work_queue() { return _work_queue; }
 142 
 143   PLAB* to_space_alloc_buffer() {
 144     return &_to_space_alloc_buffer;
 145   }
 146 
 147   ParEvacuateFollowersClosure&      evacuate_followers_closure() { return _evacuate_followers; }
 148   DefNewGeneration::IsAliveClosure& is_alive_closure() { return _is_alive_closure; }
 149   ParScanWeakRefClosure&            scan_weak_ref_closure() { return _scan_weak_ref_closure; }
 150   ParKeepAliveClosure&              keep_alive_closure() { return _keep_alive_closure; }
 151   ParScanClosure&                   older_gen_closure() { return _older_gen_closure; }
 152   ParRootScanWithoutBarrierClosure& to_space_root_closure() { return _to_space_root_closure; };
 153 
 154   // Decrease queue size below "max_size".
 155   void trim_queues(int max_size);
 156 
 157   // Private overflow stack usage
 158   Stack<oop, mtGC>* overflow_stack() { return _overflow_stack; }
 159   bool take_from_overflow_stack();
 160   void push_on_overflow_stack(oop p);
 161 
 162   // Is new_obj a candidate for scan_partial_array_and_push_remainder method.
 163   inline bool should_be_partially_scanned(oop new_obj, oop old_obj) const;


src/share/vm/gc_implementation/parNew/parNewGeneration.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File