20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/symbolTable.hpp"
27 #include "gc_implementation/g1/concurrentMark.inline.hpp"
28 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
29 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
30 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
31 #include "gc_implementation/g1/g1ErgoVerbose.hpp"
32 #include "gc_implementation/g1/g1Log.hpp"
33 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
34 #include "gc_implementation/g1/g1RemSet.hpp"
35 #include "gc_implementation/g1/heapRegion.inline.hpp"
36 #include "gc_implementation/g1/heapRegionRemSet.hpp"
37 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
38 #include "gc_implementation/shared/vmGCOperations.hpp"
39 #include "gc_implementation/shared/gcTimer.hpp"
40 #include "gc_implementation/shared/gcTraceTime.hpp"
41 #include "memory/genOopClosures.inline.hpp"
42 #include "memory/referencePolicy.hpp"
43 #include "memory/resourceArea.hpp"
44 #include "oops/oop.inline.hpp"
45 #include "runtime/handles.inline.hpp"
46 #include "runtime/java.hpp"
47 #include "services/memTracker.hpp"
48
49 // Concurrent marking bit map wrapper
50
51 CMBitMapRO::CMBitMapRO(ReservedSpace rs, int shifter) :
52 _bm((uintptr_t*)NULL,0),
53 _shifter(shifter) {
54 _bmStartWord = (HeapWord*)(rs.base());
55 _bmWordSize = rs.size()/HeapWordSize; // rs.size() is in bytes
56 ReservedSpace brs(ReservedSpace::allocation_align_size_up(
57 (_bmWordSize >> (_shifter + LogBitsPerByte)) + 1));
58
59 MemTracker::record_virtual_memory_type((address)brs.base(), mtGC);
1184 Universe::verify(/* silent */ false,
1185 /* option */ VerifyOption_G1UseNextMarking);
1186 }
1187 assert(!restart_for_overflow(), "sanity");
1188 // Completely reset the marking state since marking completed
1189 set_non_marking_state();
1190 }
1191
1192 #if VERIFY_OBJS_PROCESSED
1193 _scan_obj_cl.objs_processed = 0;
1194 ThreadLocalObjQueue::objs_enqueued = 0;
1195 #endif
1196
1197 // Statistics
1198 double now = os::elapsedTime();
1199 _remark_mark_times.add((mark_work_end - start) * 1000.0);
1200 _remark_weak_ref_times.add((now - mark_work_end) * 1000.0);
1201 _remark_times.add((now - start) * 1000.0);
1202
1203 g1p->record_concurrent_mark_remark_end();
1204 }
1205
1206 // Base class of the closures that finalize and verify the
1207 // liveness counting data.
1208 class CMCountDataClosureBase: public HeapRegionClosure {
1209 protected:
1210 G1CollectedHeap* _g1h;
1211 ConcurrentMark* _cm;
1212 CardTableModRefBS* _ct_bs;
1213
1214 BitMap* _region_bm;
1215 BitMap* _card_bm;
1216
1217 // Takes a region that's not empty (i.e., it has at least one
1218 // live object in it and sets its corresponding bit on the region
1219 // bitmap to 1. If the region is "starts humongous" it will also set
1220 // to 1 the bits on the region bitmap that correspond to its
1221 // associated "continues humongous" regions.
1222 void set_bit_for_region(HeapRegion* hr) {
1223 assert(!hr->continuesHumongous(), "should have filtered those out");
|
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/symbolTable.hpp"
27 #include "gc_implementation/g1/concurrentMark.inline.hpp"
28 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
29 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
30 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
31 #include "gc_implementation/g1/g1ErgoVerbose.hpp"
32 #include "gc_implementation/g1/g1Log.hpp"
33 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
34 #include "gc_implementation/g1/g1RemSet.hpp"
35 #include "gc_implementation/g1/heapRegion.inline.hpp"
36 #include "gc_implementation/g1/heapRegionRemSet.hpp"
37 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
38 #include "gc_implementation/shared/vmGCOperations.hpp"
39 #include "gc_implementation/shared/gcTimer.hpp"
40 #include "gc_implementation/shared/gcTrace.hpp"
41 #include "gc_implementation/shared/gcTraceTime.hpp"
42 #include "memory/genOopClosures.inline.hpp"
43 #include "memory/referencePolicy.hpp"
44 #include "memory/resourceArea.hpp"
45 #include "oops/oop.inline.hpp"
46 #include "runtime/handles.inline.hpp"
47 #include "runtime/java.hpp"
48 #include "services/memTracker.hpp"
49
50 // Concurrent marking bit map wrapper
51
52 CMBitMapRO::CMBitMapRO(ReservedSpace rs, int shifter) :
53 _bm((uintptr_t*)NULL,0),
54 _shifter(shifter) {
55 _bmStartWord = (HeapWord*)(rs.base());
56 _bmWordSize = rs.size()/HeapWordSize; // rs.size() is in bytes
57 ReservedSpace brs(ReservedSpace::allocation_align_size_up(
58 (_bmWordSize >> (_shifter + LogBitsPerByte)) + 1));
59
60 MemTracker::record_virtual_memory_type((address)brs.base(), mtGC);
1185 Universe::verify(/* silent */ false,
1186 /* option */ VerifyOption_G1UseNextMarking);
1187 }
1188 assert(!restart_for_overflow(), "sanity");
1189 // Completely reset the marking state since marking completed
1190 set_non_marking_state();
1191 }
1192
1193 #if VERIFY_OBJS_PROCESSED
1194 _scan_obj_cl.objs_processed = 0;
1195 ThreadLocalObjQueue::objs_enqueued = 0;
1196 #endif
1197
1198 // Statistics
1199 double now = os::elapsedTime();
1200 _remark_mark_times.add((mark_work_end - start) * 1000.0);
1201 _remark_weak_ref_times.add((now - mark_work_end) * 1000.0);
1202 _remark_times.add((now - start) * 1000.0);
1203
1204 g1p->record_concurrent_mark_remark_end();
1205
1206 G1CMIsAliveClosure is_alive(g1h);
1207 g1h->gc_tracer_cm()->report_class_count_after_gc(&is_alive);
1208 }
1209
1210 // Base class of the closures that finalize and verify the
1211 // liveness counting data.
1212 class CMCountDataClosureBase: public HeapRegionClosure {
1213 protected:
1214 G1CollectedHeap* _g1h;
1215 ConcurrentMark* _cm;
1216 CardTableModRefBS* _ct_bs;
1217
1218 BitMap* _region_bm;
1219 BitMap* _card_bm;
1220
1221 // Takes a region that's not empty (i.e., it has at least one
1222 // live object in it and sets its corresponding bit on the region
1223 // bitmap to 1. If the region is "starts humongous" it will also set
1224 // to 1 the bits on the region bitmap that correspond to its
1225 // associated "continues humongous" regions.
1226 void set_bit_for_region(HeapRegion* hr) {
1227 assert(!hr->continuesHumongous(), "should have filtered those out");
|