src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp

changeset 3065
ff53346271fe
parent 2643
1216415d8e35
child 3208
ec4b032a4977
equal deleted inserted replaced
3064:7c29742c41b4 3065:ff53346271fe
48 _vtime_count_accum(0.0) 48 _vtime_count_accum(0.0)
49 { 49 {
50 create_and_start(); 50 create_and_start();
51 } 51 }
52 52
53 class CMCheckpointRootsInitialClosure: public VoidClosure {
54
55 ConcurrentMark* _cm;
56 public:
57
58 CMCheckpointRootsInitialClosure(ConcurrentMark* cm) :
59 _cm(cm) {}
60
61 void do_void(){
62 _cm->checkpointRootsInitial();
63 }
64 };
65
66 class CMCheckpointRootsFinalClosure: public VoidClosure { 53 class CMCheckpointRootsFinalClosure: public VoidClosure {
67 54
68 ConcurrentMark* _cm; 55 ConcurrentMark* _cm;
69 public: 56 public:
70 57
112 99
113 if (PrintGC) { 100 if (PrintGC) {
114 gclog_or_tty->date_stamp(PrintGCDateStamps); 101 gclog_or_tty->date_stamp(PrintGCDateStamps);
115 gclog_or_tty->stamp(PrintGCTimeStamps); 102 gclog_or_tty->stamp(PrintGCTimeStamps);
116 gclog_or_tty->print_cr("[GC concurrent-mark-start]"); 103 gclog_or_tty->print_cr("[GC concurrent-mark-start]");
117 }
118
119 if (!g1_policy->in_young_gc_mode()) {
120 // this ensures the flag is not set if we bail out of the marking
121 // cycle; normally the flag is cleared immediately after cleanup
122 g1h->set_marking_complete();
123
124 if (g1_policy->adaptive_young_list_length()) {
125 double now = os::elapsedTime();
126 double init_prediction_ms = g1_policy->predict_init_time_ms();
127 jlong sleep_time_ms = mmu_tracker->when_ms(now, init_prediction_ms);
128 os::sleep(current_thread, sleep_time_ms, false);
129 }
130
131 // We don't have to skip here if we've been asked to restart, because
132 // in the worst case we just enqueue a new VM operation to start a
133 // marking. Note that the init operation resets has_aborted()
134 CMCheckpointRootsInitialClosure init_cl(_cm);
135 strcpy(verbose_str, "GC initial-mark");
136 VM_CGC_Operation op(&init_cl, verbose_str);
137 VMThread::execute(&op);
138 } 104 }
139 105
140 int iter = 0; 106 int iter = 0;
141 do { 107 do {
142 iter++; 108 iter++;

mercurial