comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 17756:a07bea31ef35

8035398: Add card redirty time in "Other" time in G1 Summary: Show the time taken by card redirtying during GC in a new "Redirty Cards" line. Reviewed-by: jwilhelm, brutisso
author tschatzl
date Mon, 24 Mar 2014 15:30:40 +0100
parents 96b1c2e06e25
children eff02b5bd56c
comparison
equal deleted inserted replaced
17755:96b1c2e06e25 17756:a07bea31ef35
165 *card_ptr = 0; 165 *card_ptr = 0;
166 } 166 }
167 return true; 167 return true;
168 } 168 }
169 int calls() { return _calls; } 169 int calls() { return _calls; }
170 };
171
172 class RedirtyLoggedCardTableEntryFastClosure : public CardTableEntryClosure {
173 public:
174 bool do_card_ptr(jbyte* card_ptr, int worker_i) {
175 *card_ptr = CardTableModRefBS::dirty_card_val();
176 return true;
177 }
178 }; 170 };
179 171
180 YoungList::YoungList(G1CollectedHeap* g1h) : 172 YoungList::YoungList(G1CollectedHeap* g1h) :
181 _g1h(g1h), _head(NULL), _length(0), _last_sampled_rs_lengths(0), 173 _g1h(g1h), _head(NULL), _length(0), _last_sampled_rs_lengths(0),
182 _survivor_head(NULL), _survivor_tail(NULL), _survivor_length(0) { 174 _survivor_head(NULL), _survivor_tail(NULL), _survivor_length(0) {
5304 g1_unlink_task.strings_processed(), g1_unlink_task.strings_removed(), 5296 g1_unlink_task.strings_processed(), g1_unlink_task.strings_removed(),
5305 g1_unlink_task.symbols_processed(), g1_unlink_task.symbols_removed()); 5297 g1_unlink_task.symbols_processed(), g1_unlink_task.symbols_removed());
5306 } 5298 }
5307 } 5299 }
5308 5300
5301 class RedirtyLoggedCardTableEntryFastClosure : public CardTableEntryClosure {
5302 public:
5303 bool do_card_ptr(jbyte* card_ptr, int worker_i) {
5304 *card_ptr = CardTableModRefBS::dirty_card_val();
5305 return true;
5306 }
5307 };
5308
5309 void G1CollectedHeap::redirty_logged_cards() {
5310 guarantee(G1DeferredRSUpdate, "Must only be called when using deferred RS updates.");
5311 double redirty_logged_cards_start = os::elapsedTime();
5312
5313 RedirtyLoggedCardTableEntryFastClosure redirty;
5314 dirty_card_queue_set().set_closure(&redirty);
5315 dirty_card_queue_set().apply_closure_to_all_completed_buffers();
5316
5317 DirtyCardQueueSet& dcq = JavaThread::dirty_card_queue_set();
5318 dcq.merge_bufferlists(&dirty_card_queue_set());
5319 assert(dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed");
5320
5321 g1_policy()->phase_times()->record_redirty_logged_cards_time_ms((os::elapsedTime() - redirty_logged_cards_start) * 1000.0);
5322 }
5323
5309 // Weak Reference Processing support 5324 // Weak Reference Processing support
5310 5325
5311 // An always "is_alive" closure that is used to preserve referents. 5326 // An always "is_alive" closure that is used to preserve referents.
5312 // If the object is non-null then it's alive. Used in the preservation 5327 // If the object is non-null then it's alive. Used in the preservation
5313 // of referent objects that are pointed to by reference objects 5328 // of referent objects that are pointed to by reference objects
5960 // cards). We need these updates logged to update any 5975 // cards). We need these updates logged to update any
5961 // RSets. 5976 // RSets.
5962 enqueue_discovered_references(n_workers); 5977 enqueue_discovered_references(n_workers);
5963 5978
5964 if (G1DeferredRSUpdate) { 5979 if (G1DeferredRSUpdate) {
5965 RedirtyLoggedCardTableEntryFastClosure redirty; 5980 redirty_logged_cards();
5966 dirty_card_queue_set().set_closure(&redirty);
5967 dirty_card_queue_set().apply_closure_to_all_completed_buffers();
5968
5969 DirtyCardQueueSet& dcq = JavaThread::dirty_card_queue_set();
5970 dcq.merge_bufferlists(&dirty_card_queue_set());
5971 assert(dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed");
5972 } 5981 }
5973 COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); 5982 COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
5974 } 5983 }
5975 5984
5976 void G1CollectedHeap::free_region(HeapRegion* hr, 5985 void G1CollectedHeap::free_region(HeapRegion* hr,