125 G1StringDedupUnlinkOrOopsDoClosure _cl; 126 127 public: 128 G1StringDedupUnlinkOrOopsDoTask(BoolObjectClosure* is_alive, 129 OopClosure* keep_alive, 130 bool allow_resize_and_rehash) : 131 AbstractGangTask("G1StringDedupUnlinkOrOopsDoTask"), 132 _cl(is_alive, keep_alive, allow_resize_and_rehash) { 133 } 134 135 virtual void work(uint worker_id) { 136 double queue_fixup_start = os::elapsedTime(); 137 G1StringDedupQueue::unlink_or_oops_do(&_cl); 138 139 double table_fixup_start = os::elapsedTime(); 140 G1StringDedupTable::unlink_or_oops_do(&_cl, worker_id); 141 142 double queue_fixup_time_sec = table_fixup_start - queue_fixup_start; 143 double table_fixup_time_sec = os::elapsedTime() - table_fixup_start; 144 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); 145 g1p->phase_times()->record_time(G1GCPhaseTimes::StringDedupQueueFixup, worker_id, queue_fixup_time_sec); 146 g1p->phase_times()->record_time(G1GCPhaseTimes::StringDedupTableFixup, worker_id, table_fixup_time_sec); 147 } 148 }; 149 150 void G1StringDedup::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, bool allow_resize_and_rehash) { 151 assert(is_enabled(), "String deduplication not enabled"); 152 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); 153 double fixup_start = os::elapsedTime(); 154 155 G1StringDedupUnlinkOrOopsDoTask task(is_alive, keep_alive, allow_resize_and_rehash); 156 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 157 g1h->set_par_threads(); 158 g1h->workers()->run_task(&task); 159 g1h->set_par_threads(0); 160 161 double fixup_time_ms = (os::elapsedTime() - fixup_start) * 1000.0; 162 g1p->phase_times()->record_string_dedup_fixup_time(fixup_time_ms); 163 } 164 165 void G1StringDedup::threads_do(ThreadClosure* tc) { 166 assert(is_enabled(), "String deduplication not enabled"); | 125 G1StringDedupUnlinkOrOopsDoClosure _cl; 126 127 public: 128 G1StringDedupUnlinkOrOopsDoTask(BoolObjectClosure* is_alive, 129 OopClosure* keep_alive, 130 bool allow_resize_and_rehash) : 131 AbstractGangTask("G1StringDedupUnlinkOrOopsDoTask"), 132 _cl(is_alive, keep_alive, allow_resize_and_rehash) { 133 } 134 135 virtual void work(uint worker_id) { 136 double queue_fixup_start = os::elapsedTime(); 137 G1StringDedupQueue::unlink_or_oops_do(&_cl); 138 139 double table_fixup_start = os::elapsedTime(); 140 G1StringDedupTable::unlink_or_oops_do(&_cl, worker_id); 141 142 double queue_fixup_time_sec = table_fixup_start - queue_fixup_start; 143 double table_fixup_time_sec = os::elapsedTime() - table_fixup_start; 144 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); 145 g1p->phase_times()->record_time_secs(G1GCPhaseTimes::StringDedupQueueFixup, worker_id, queue_fixup_time_sec); 146 g1p->phase_times()->record_time_secs(G1GCPhaseTimes::StringDedupTableFixup, worker_id, table_fixup_time_sec); 147 } 148 }; 149 150 void G1StringDedup::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, bool allow_resize_and_rehash) { 151 assert(is_enabled(), "String deduplication not enabled"); 152 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); 153 double fixup_start = os::elapsedTime(); 154 155 G1StringDedupUnlinkOrOopsDoTask task(is_alive, keep_alive, allow_resize_and_rehash); 156 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 157 g1h->set_par_threads(); 158 g1h->workers()->run_task(&task); 159 g1h->set_par_threads(0); 160 161 double fixup_time_ms = (os::elapsedTime() - fixup_start) * 1000.0; 162 g1p->phase_times()->record_string_dedup_fixup_time(fixup_time_ms); 163 } 164 165 void G1StringDedup::threads_do(ThreadClosure* tc) { 166 assert(is_enabled(), "String deduplication not enabled"); |