1.1 --- a/src/share/vm/gc_implementation/g1/g1StringDedup.cpp Thu Oct 23 11:43:29 2014 +0200 1.2 +++ b/src/share/vm/gc_implementation/g1/g1StringDedup.cpp Thu Mar 26 13:19:32 2015 +0100 1.3 @@ -105,7 +105,7 @@ 1.4 1.5 void G1StringDedup::oops_do(OopClosure* keep_alive) { 1.6 assert(is_enabled(), "String deduplication not enabled"); 1.7 - unlink_or_oops_do(NULL, keep_alive); 1.8 + unlink_or_oops_do(NULL, keep_alive, true /* allow_resize_and_rehash */); 1.9 } 1.10 1.11 void G1StringDedup::unlink(BoolObjectClosure* is_alive) { 1.12 @@ -122,37 +122,35 @@ 1.13 class G1StringDedupUnlinkOrOopsDoTask : public AbstractGangTask { 1.14 private: 1.15 G1StringDedupUnlinkOrOopsDoClosure _cl; 1.16 + G1GCPhaseTimes* _phase_times; 1.17 1.18 public: 1.19 G1StringDedupUnlinkOrOopsDoTask(BoolObjectClosure* is_alive, 1.20 OopClosure* keep_alive, 1.21 - bool allow_resize_and_rehash) : 1.22 + bool allow_resize_and_rehash, 1.23 + G1GCPhaseTimes* phase_times) : 1.24 AbstractGangTask("G1StringDedupUnlinkOrOopsDoTask"), 1.25 - _cl(is_alive, keep_alive, allow_resize_and_rehash) { 1.26 - } 1.27 + _cl(is_alive, keep_alive, allow_resize_and_rehash), _phase_times(phase_times) { } 1.28 1.29 virtual void work(uint worker_id) { 1.30 - double queue_fixup_start = os::elapsedTime(); 1.31 - G1StringDedupQueue::unlink_or_oops_do(&_cl); 1.32 - 1.33 - double table_fixup_start = os::elapsedTime(); 1.34 - G1StringDedupTable::unlink_or_oops_do(&_cl, worker_id); 1.35 - 1.36 - double queue_fixup_time_ms = (table_fixup_start - queue_fixup_start) * 1000.0; 1.37 - double table_fixup_time_ms = (os::elapsedTime() - table_fixup_start) * 1000.0; 1.38 - G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); 1.39 - g1p->phase_times()->record_string_dedup_queue_fixup_worker_time(worker_id, queue_fixup_time_ms); 1.40 - g1p->phase_times()->record_string_dedup_table_fixup_worker_time(worker_id, table_fixup_time_ms); 1.41 + { 1.42 + G1GCParPhaseTimesTracker x(_phase_times, G1GCPhaseTimes::StringDedupQueueFixup, worker_id); 1.43 + G1StringDedupQueue::unlink_or_oops_do(&_cl); 1.44 + } 1.45 + { 1.46 + G1GCParPhaseTimesTracker x(_phase_times, G1GCPhaseTimes::StringDedupTableFixup, worker_id); 1.47 + G1StringDedupTable::unlink_or_oops_do(&_cl, worker_id); 1.48 + } 1.49 } 1.50 }; 1.51 1.52 -void G1StringDedup::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, bool allow_resize_and_rehash) { 1.53 +void G1StringDedup::unlink_or_oops_do(BoolObjectClosure* is_alive, 1.54 + OopClosure* keep_alive, 1.55 + bool allow_resize_and_rehash, 1.56 + G1GCPhaseTimes* phase_times) { 1.57 assert(is_enabled(), "String deduplication not enabled"); 1.58 - G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); 1.59 - g1p->phase_times()->note_string_dedup_fixup_start(); 1.60 - double fixup_start = os::elapsedTime(); 1.61 1.62 - G1StringDedupUnlinkOrOopsDoTask task(is_alive, keep_alive, allow_resize_and_rehash); 1.63 + G1StringDedupUnlinkOrOopsDoTask task(is_alive, keep_alive, allow_resize_and_rehash, phase_times); 1.64 if (G1CollectedHeap::use_parallel_gc_threads()) { 1.65 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 1.66 g1h->set_par_threads(); 1.67 @@ -161,10 +159,6 @@ 1.68 } else { 1.69 task.work(0); 1.70 } 1.71 - 1.72 - double fixup_time_ms = (os::elapsedTime() - fixup_start) * 1000.0; 1.73 - g1p->phase_times()->record_string_dedup_fixup_time(fixup_time_ms); 1.74 - g1p->phase_times()->note_string_dedup_fixup_end(); 1.75 } 1.76 1.77 void G1StringDedup::threads_do(ThreadClosure* tc) {