137 |
137 |
138 public: |
138 public: |
139 static size_t compute_size(size_t heap_size); |
139 static size_t compute_size(size_t heap_size); |
140 // Returns the amount of bytes on the heap between two marks in the bitmap. |
140 // Returns the amount of bytes on the heap between two marks in the bitmap. |
141 static size_t mark_distance(); |
141 static size_t mark_distance(); |
|
142 // Returns how many bytes (or bits) of the heap a single byte (or bit) of the |
|
143 // mark bitmap corresponds to. This is the same as the mark distance above. |
|
144 static size_t heap_map_factor() { |
|
145 return mark_distance(); |
|
146 } |
142 |
147 |
143 CMBitMap() : CMBitMapRO(LogMinObjAlignment), _listener() { _listener.set_bitmap(this); } |
148 CMBitMap() : CMBitMapRO(LogMinObjAlignment), _listener() { _listener.set_bitmap(this); } |
144 |
149 |
145 // Initializes the underlying BitMap to cover the given area. |
150 // Initializes the underlying BitMap to cover the given area. |
146 void initialize(MemRegion heap, G1RegionToSpaceMapper* storage); |
151 void initialize(MemRegion heap, G1RegionToSpaceMapper* storage); |
669 ret += _accum_task_vtime[i]; |
674 ret += _accum_task_vtime[i]; |
670 return ret; |
675 return ret; |
671 } |
676 } |
672 |
677 |
673 // Attempts to steal an object from the task queues of other tasks |
678 // Attempts to steal an object from the task queues of other tasks |
674 bool try_stealing(uint worker_id, int* hash_seed, oop& obj) { |
679 bool try_stealing(uint worker_id, int* hash_seed, oop& obj); |
675 return _task_queues->steal(worker_id, hash_seed, obj); |
|
676 } |
|
677 |
680 |
678 ConcurrentMark(G1CollectedHeap* g1h, |
681 ConcurrentMark(G1CollectedHeap* g1h, |
679 G1RegionToSpaceMapper* prev_bitmap_storage, |
682 G1RegionToSpaceMapper* prev_bitmap_storage, |
680 G1RegionToSpaceMapper* next_bitmap_storage); |
683 G1RegionToSpaceMapper* next_bitmap_storage); |
681 ~ConcurrentMark(); |
684 ~ConcurrentMark(); |
1093 // it checks a bunch of conditions that might cause the marking step |
1096 // it checks a bunch of conditions that might cause the marking step |
1094 // to abort |
1097 // to abort |
1095 void regular_clock_call(); |
1098 void regular_clock_call(); |
1096 bool concurrent() { return _concurrent; } |
1099 bool concurrent() { return _concurrent; } |
1097 |
1100 |
1098 // Test whether objAddr might have already been passed over by the |
1101 // Test whether obj might have already been passed over by the |
1099 // mark bitmap scan, and so needs to be pushed onto the mark stack. |
1102 // mark bitmap scan, and so needs to be pushed onto the mark stack. |
1100 bool is_below_finger(HeapWord* objAddr, HeapWord* global_finger) const; |
1103 bool is_below_finger(oop obj, HeapWord* global_finger) const; |
1101 |
1104 |
1102 template<bool scan> void process_grey_object(oop obj); |
1105 template<bool scan> void process_grey_object(oop obj); |
1103 |
1106 |
1104 public: |
1107 public: |
1105 // It resets the task; it should be called right at the beginning of |
1108 // It resets the task; it should be called right at the beginning of |
1146 bool has_timed_out() { return _has_timed_out; } |
1149 bool has_timed_out() { return _has_timed_out; } |
1147 bool claimed() { return _claimed; } |
1150 bool claimed() { return _claimed; } |
1148 |
1151 |
1149 void set_cm_oop_closure(G1CMOopClosure* cm_oop_closure); |
1152 void set_cm_oop_closure(G1CMOopClosure* cm_oop_closure); |
1150 |
1153 |
1151 // It grays the object by marking it and, if necessary, pushing it |
1154 // Increment the number of references this task has visited. |
1152 // on the local queue |
1155 void increment_refs_reached() { ++_refs_reached; } |
|
1156 |
|
1157 // Grey the object by marking it. If not already marked, push it on |
|
1158 // the local queue if below the finger. |
|
1159 // Precondition: obj is in region. |
|
1160 // Precondition: obj is below region's NTAMS. |
|
1161 inline void make_reference_grey(oop obj, HeapRegion* region); |
|
1162 |
|
1163 // Grey the object (by calling make_grey_reference) if required, |
|
1164 // e.g. obj is below its containing region's NTAMS. |
|
1165 // Precondition: obj is a valid heap object. |
1153 inline void deal_with_reference(oop obj); |
1166 inline void deal_with_reference(oop obj); |
1154 |
1167 |
1155 // It scans an object and visits its children. |
1168 // It scans an object and visits its children. |
1156 void scan_object(oop obj) { process_grey_object<true>(obj); } |
1169 void scan_object(oop obj) { process_grey_object<true>(obj); } |
1157 |
1170 |