1.1 --- a/src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp Mon Jul 21 09:40:19 2014 +0200 1.2 +++ b/src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp Mon Jul 21 09:40:19 2014 +0200 1.3 @@ -73,7 +73,8 @@ 1.4 1.5 1.6 class DirtyCardQueueSet: public PtrQueueSet { 1.7 - CardTableEntryClosure* _closure; 1.8 + // The closure used in mut_process_buffer(). 1.9 + CardTableEntryClosure* _mut_process_closure; 1.10 1.11 DirtyCardQueue _shared_dirty_card_queue; 1.12 1.13 @@ -88,10 +89,12 @@ 1.14 jint _processed_buffers_mut; 1.15 jint _processed_buffers_rs_thread; 1.16 1.17 + // Current buffer node used for parallel iteration. 1.18 + BufferNode* volatile _cur_par_buffer_node; 1.19 public: 1.20 DirtyCardQueueSet(bool notify_when_complete = true); 1.21 1.22 - void initialize(Monitor* cbl_mon, Mutex* fl_lock, 1.23 + void initialize(CardTableEntryClosure* cl, Monitor* cbl_mon, Mutex* fl_lock, 1.24 int process_completed_threshold, 1.25 int max_completed_queue, 1.26 Mutex* lock, PtrQueueSet* fl_owner = NULL); 1.27 @@ -102,33 +105,15 @@ 1.28 1.29 static void handle_zero_index_for_thread(JavaThread* t); 1.30 1.31 - // Register "blk" as "the closure" for all queues. Only one such closure 1.32 - // is allowed. The "apply_closure_to_completed_buffer" method will apply 1.33 - // this closure to a completed buffer, and "iterate_closure_all_threads" 1.34 - // applies it to partially-filled buffers (the latter should only be done 1.35 - // with the world stopped). 1.36 - void set_closure(CardTableEntryClosure* closure); 1.37 - 1.38 - // If there is a registered closure for buffers, apply it to all entries 1.39 - // in all currently-active buffers. This should only be applied at a 1.40 - // safepoint. (Currently must not be called in parallel; this should 1.41 - // change in the future.) If "consume" is true, processed entries are 1.42 - // discarded. 1.43 - void iterate_closure_all_threads(bool consume = true, 1.44 + // Apply the given closure to all entries in all currently-active buffers. 1.45 + // This should only be applied at a safepoint. (Currently must not be called 1.46 + // in parallel; this should change in the future.) If "consume" is true, 1.47 + // processed entries are discarded. 1.48 + void iterate_closure_all_threads(CardTableEntryClosure* cl, 1.49 + bool consume = true, 1.50 uint worker_i = 0); 1.51 1.52 // If there exists some completed buffer, pop it, then apply the 1.53 - // registered closure to all its elements, nulling out those elements 1.54 - // processed. If all elements are processed, returns "true". If no 1.55 - // completed buffers exist, returns false. If a completed buffer exists, 1.56 - // but is only partially completed before a "yield" happens, the 1.57 - // partially completed buffer (with its processed elements set to NULL) 1.58 - // is returned to the completed buffer set, and this call returns false. 1.59 - bool apply_closure_to_completed_buffer(uint worker_i = 0, 1.60 - int stop_at = 0, 1.61 - bool during_pause = false); 1.62 - 1.63 - // If there exists some completed buffer, pop it, then apply the 1.64 // specified closure to all its elements, nulling out those elements 1.65 // processed. If all elements are processed, returns "true". If no 1.66 // completed buffers exist, returns false. If a completed buffer exists, 1.67 @@ -149,7 +134,12 @@ 1.68 1.69 // Applies the current closure to all completed buffers, 1.70 // non-consumptively. 1.71 - void apply_closure_to_all_completed_buffers(); 1.72 + void apply_closure_to_all_completed_buffers(CardTableEntryClosure* cl); 1.73 + 1.74 + void reset_for_par_iteration() { _cur_par_buffer_node = _completed_buffers_head; } 1.75 + // Applies the current closure to all completed buffers, non-consumptively. 1.76 + // Parallel version. 1.77 + void par_apply_closure_to_all_completed_buffers(CardTableEntryClosure* cl); 1.78 1.79 DirtyCardQueue* shared_dirty_card_queue() { 1.80 return &_shared_dirty_card_queue;