29 #include "gc_implementation/g1/heapRegionSet.hpp"
30 #include "gc_implementation/g1/g1RegionToSpaceMapper.hpp"
31 #include "gc_implementation/shared/gcId.hpp"
32 #include "utilities/taskqueue.hpp"
33
34 class G1CollectedHeap;
35 class CMBitMap;
36 class CMTask;
37 typedef GenericTaskQueue<oop, mtGC> CMTaskQueue;
38 typedef GenericTaskQueueSet<CMTaskQueue, mtGC> CMTaskQueueSet;
39
40 // Closure used by CM during concurrent reference discovery
41 // and reference processing (during remarking) to determine
42 // if a particular object is alive. It is primarily used
43 // to determine if referents of discovered reference objects
44 // are alive. An instance is also embedded into the
45 // reference processor as the _is_alive_non_header field
46 class G1CMIsAliveClosure: public BoolObjectClosure {
47 G1CollectedHeap* _g1;
48 public:
49 G1CMIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) { }
50
51 bool do_object_b(oop obj);
52 };
53
54 // A generic CM bit map. This is essentially a wrapper around the BitMap
55 // class, with one bit per (1<<_shifter) HeapWords.
56
57 class CMBitMapRO VALUE_OBJ_CLASS_SPEC {
58 protected:
59 HeapWord* _bmStartWord; // base address of range covered by map
60 size_t _bmWordSize; // map size (in #HeapWords covered)
61 const int _shifter; // map to char or bit
62 BitMap _bm; // the bit map itself
63
64 public:
65 // constructor
66 CMBitMapRO(int shifter);
67
68 enum { do_yield = true };
165 // Clear the whole mark bitmap.
166 void clearAll();
167 };
168
169 // Represents a marking stack used by ConcurrentMarking in the G1 collector.
170 class CMMarkStack VALUE_OBJ_CLASS_SPEC {
171 VirtualSpace _virtual_space; // Underlying backing store for actual stack
172 ConcurrentMark* _cm;
173 oop* _base; // bottom of stack
174 jint _index; // one more than last occupied index
175 jint _capacity; // max #elements
176 jint _saved_index; // value of _index saved at start of GC
177 NOT_PRODUCT(jint _max_depth;) // max depth plumbed during run
178
179 bool _overflow;
180 bool _should_expand;
181 DEBUG_ONLY(bool _drain_in_progress;)
182 DEBUG_ONLY(bool _drain_in_progress_yields;)
183
184 public:
185 CMMarkStack(ConcurrentMark* cm);
186 ~CMMarkStack();
187
188 #ifndef PRODUCT
189 jint max_depth() const {
190 return _max_depth;
191 }
192 #endif
193
194 bool allocate(size_t capacity);
195
196 oop pop() {
197 if (!isEmpty()) {
198 return _base[--_index] ;
199 }
200 return NULL;
201 }
202
203 // If overflow happens, don't do the push, and record the overflow.
204 // *Requires* that "ptr" is already marked.
|
29 #include "gc_implementation/g1/heapRegionSet.hpp"
30 #include "gc_implementation/g1/g1RegionToSpaceMapper.hpp"
31 #include "gc_implementation/shared/gcId.hpp"
32 #include "utilities/taskqueue.hpp"
33
34 class G1CollectedHeap;
35 class CMBitMap;
36 class CMTask;
37 typedef GenericTaskQueue<oop, mtGC> CMTaskQueue;
38 typedef GenericTaskQueueSet<CMTaskQueue, mtGC> CMTaskQueueSet;
39
40 // Closure used by CM during concurrent reference discovery
41 // and reference processing (during remarking) to determine
42 // if a particular object is alive. It is primarily used
43 // to determine if referents of discovered reference objects
44 // are alive. An instance is also embedded into the
45 // reference processor as the _is_alive_non_header field
46 class G1CMIsAliveClosure: public BoolObjectClosure {
47 G1CollectedHeap* _g1;
48 public:
49 G1CMIsAliveClosure() { }
50 G1CMIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) { }
51
52 bool do_object_b(oop obj);
53 };
54
55 // A generic CM bit map. This is essentially a wrapper around the BitMap
56 // class, with one bit per (1<<_shifter) HeapWords.
57
58 class CMBitMapRO VALUE_OBJ_CLASS_SPEC {
59 protected:
60 HeapWord* _bmStartWord; // base address of range covered by map
61 size_t _bmWordSize; // map size (in #HeapWords covered)
62 const int _shifter; // map to char or bit
63 BitMap _bm; // the bit map itself
64
65 public:
66 // constructor
67 CMBitMapRO(int shifter);
68
69 enum { do_yield = true };
166 // Clear the whole mark bitmap.
167 void clearAll();
168 };
169
170 // Represents a marking stack used by ConcurrentMarking in the G1 collector.
171 class CMMarkStack VALUE_OBJ_CLASS_SPEC {
172 VirtualSpace _virtual_space; // Underlying backing store for actual stack
173 ConcurrentMark* _cm;
174 oop* _base; // bottom of stack
175 jint _index; // one more than last occupied index
176 jint _capacity; // max #elements
177 jint _saved_index; // value of _index saved at start of GC
178 NOT_PRODUCT(jint _max_depth;) // max depth plumbed during run
179
180 bool _overflow;
181 bool _should_expand;
182 DEBUG_ONLY(bool _drain_in_progress;)
183 DEBUG_ONLY(bool _drain_in_progress_yields;)
184
185 public:
186 CMMarkStack() { }
187 CMMarkStack(ConcurrentMark* cm);
188 ~CMMarkStack();
189
190 #ifndef PRODUCT
191 jint max_depth() const {
192 return _max_depth;
193 }
194 #endif
195
196 bool allocate(size_t capacity);
197
198 oop pop() {
199 if (!isEmpty()) {
200 return _base[--_index] ;
201 }
202 return NULL;
203 }
204
205 // If overflow happens, don't do the push, and record the overflow.
206 // *Requires* that "ptr" is already marked.
|