< prev index next >

src/share/vm/gc/g1/g1ConcurrentMark.hpp

Print this page




  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_G1CONCURRENTMARK_HPP
  26 #define SHARE_VM_GC_G1_G1CONCURRENTMARK_HPP
  27 
  28 #include "classfile/javaClasses.hpp"
  29 #include "gc/g1/g1ConcurrentMarkObjArrayProcessor.hpp"
  30 #include "gc/g1/g1RegionToSpaceMapper.hpp"
  31 #include "gc/g1/heapRegionSet.hpp"
  32 #include "gc/shared/taskqueue.hpp"
  33 
  34 class G1CollectedHeap;
  35 class G1CMBitMap;
  36 class G1CMTask;
  37 class G1ConcurrentMark;
  38 class ConcurrentGCTimer;
  39 class G1OldTracer;
  40 class G1SurvivorRegions;
  41 
  42 #ifdef _MSC_VER
  43 #pragma warning(push)
  44 // warning C4522: multiple assignment operators specified
  45 #pragma warning(disable:4522)
  46 #endif
  47 
  48 // This is a container class for either an oop or a continuation address for
  49 // mark stack entries. Both are pushed onto the mark stack.
  50 class G1TaskQueueEntry VALUE_OBJ_CLASS_SPEC {
  51 private:
  52   void* _holder;
  53 
  54   static const uintptr_t ArraySliceBit = 1;
  55 
  56   G1TaskQueueEntry(oop obj) : _holder(obj) {
  57     assert(_holder != NULL, "Not allowed to set NULL task queue element");
  58   }
  59   G1TaskQueueEntry(HeapWord* addr) : _holder((void*)((uintptr_t)addr | ArraySliceBit)) { }
  60 public:
  61   G1TaskQueueEntry(const G1TaskQueueEntry& other) { _holder = other._holder; }
  62   G1TaskQueueEntry() : _holder(NULL) { }
  63 
  64   static G1TaskQueueEntry from_slice(HeapWord* what) { return G1TaskQueueEntry(what); }
  65   static G1TaskQueueEntry from_oop(oop obj) { return G1TaskQueueEntry(obj); }
  66 
  67   G1TaskQueueEntry& operator=(const G1TaskQueueEntry& t) {
  68     _holder = t._holder;
  69     return *this;
  70   }
  71 
  72   volatile G1TaskQueueEntry& operator=(const volatile G1TaskQueueEntry& t) volatile {
  73     _holder = t._holder;
  74     return *this;
  75   }
  76 
  77   oop obj() const {
  78     assert(!is_array_slice(), "Trying to read array slice " PTR_FORMAT " as oop", p2i(_holder));
  79     return (oop)_holder;
  80   }
  81 
  82   HeapWord* slice() const {
  83     assert(is_array_slice(), "Trying to read oop " PTR_FORMAT " as array slice", p2i(_holder));
  84     return (HeapWord*)((uintptr_t)_holder & ~ArraySliceBit);
  85   }
  86 
  87   bool is_oop() const { return !is_array_slice(); }
  88   bool is_array_slice() const { return ((uintptr_t)_holder & ArraySliceBit) != 0; }
  89   bool is_null() const { return _holder == NULL; }
  90 };
  91 
  92 #ifdef _MSC_VER
  93 #pragma warning(pop)
  94 #endif
  95 
  96 typedef GenericTaskQueue<G1TaskQueueEntry, mtGC> G1CMTaskQueue;
  97 typedef GenericTaskQueueSet<G1CMTaskQueue, mtGC> G1CMTaskQueueSet;
  98 
  99 // Closure used by CM during concurrent reference discovery
 100 // and reference processing (during remarking) to determine
 101 // if a particular object is alive. It is primarily used
 102 // to determine if referents of discovered reference objects
 103 // are alive. An instance is also embedded into the
 104 // reference processor as the _is_alive_non_header field
 105 class G1CMIsAliveClosure: public BoolObjectClosure {
 106   G1CollectedHeap* _g1;
 107  public:
 108   G1CMIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) { }
 109 
 110   bool do_object_b(oop obj);
 111 };
 112 
 113 // A generic CM bit map.  This is essentially a wrapper around the BitMap
 114 // class, with one bit per (1<<_shifter) HeapWords.




  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_G1CONCURRENTMARK_HPP
  26 #define SHARE_VM_GC_G1_G1CONCURRENTMARK_HPP
  27 
  28 #include "classfile/javaClasses.hpp"
  29 #include "gc/g1/g1ConcurrentMarkObjArrayProcessor.hpp"
  30 #include "gc/g1/g1RegionToSpaceMapper.hpp"
  31 #include "gc/g1/heapRegionSet.hpp"
  32 #include "gc/shared/taskqueue.hpp"
  33 
  34 class G1CollectedHeap;
  35 class G1CMBitMap;
  36 class G1CMTask;
  37 class G1ConcurrentMark;
  38 class ConcurrentGCTimer;
  39 class G1OldTracer;
  40 class G1SurvivorRegions;
  41 






  42 // This is a container class for either an oop or a continuation address for
  43 // mark stack entries. Both are pushed onto the mark stack.
  44 class G1TaskQueueEntry VALUE_OBJ_CLASS_SPEC {
  45 private:
  46   void* _holder;
  47 
  48   static const uintptr_t ArraySliceBit = 1;
  49 
  50   G1TaskQueueEntry(oop obj) : _holder(obj) {
  51     assert(_holder != NULL, "Not allowed to set NULL task queue element");
  52   }
  53   G1TaskQueueEntry(HeapWord* addr) : _holder((void*)((uintptr_t)addr | ArraySliceBit)) { }
  54 public:
  55   G1TaskQueueEntry(const G1TaskQueueEntry& other) { _holder = other._holder; }
  56   G1TaskQueueEntry() : _holder(NULL) { }
  57 
  58   static G1TaskQueueEntry from_slice(HeapWord* what) { return G1TaskQueueEntry(what); }
  59   static G1TaskQueueEntry from_oop(oop obj) { return G1TaskQueueEntry(obj); }
  60 
  61   void assign(const G1TaskQueueEntry& t) {
  62     _holder = t._holder;

  63   }
  64 
  65   volatile G1TaskQueueEntry& operator=(const volatile G1TaskQueueEntry& t) volatile {
  66     _holder = t._holder;
  67     return *this;
  68   }
  69 
  70   oop obj() const {
  71     assert(!is_array_slice(), "Trying to read array slice " PTR_FORMAT " as oop", p2i(_holder));
  72     return (oop)_holder;
  73   }
  74 
  75   HeapWord* slice() const {
  76     assert(is_array_slice(), "Trying to read oop " PTR_FORMAT " as array slice", p2i(_holder));
  77     return (HeapWord*)((uintptr_t)_holder & ~ArraySliceBit);
  78   }
  79 
  80   bool is_oop() const { return !is_array_slice(); }
  81   bool is_array_slice() const { return ((uintptr_t)_holder & ArraySliceBit) != 0; }
  82   bool is_null() const { return _holder == NULL; }
  83 };




  84 
  85 typedef GenericTaskQueue<G1TaskQueueEntry, mtGC> G1CMTaskQueue;
  86 typedef GenericTaskQueueSet<G1CMTaskQueue, mtGC> G1CMTaskQueueSet;
  87 
  88 // Closure used by CM during concurrent reference discovery
  89 // and reference processing (during remarking) to determine
  90 // if a particular object is alive. It is primarily used
  91 // to determine if referents of discovered reference objects
  92 // are alive. An instance is also embedded into the
  93 // reference processor as the _is_alive_non_header field
  94 class G1CMIsAliveClosure: public BoolObjectClosure {
  95   G1CollectedHeap* _g1;
  96  public:
  97   G1CMIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) { }
  98 
  99   bool do_object_b(oop obj);
 100 };
 101 
 102 // A generic CM bit map.  This is essentially a wrapper around the BitMap
 103 // class, with one bit per (1<<_shifter) HeapWords.


< prev index next >