comparison src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp @ 17844:8847586c9037

8016302: Change type of the number of GC workers to unsigned int (2) Reviewed-by: tschatzl, jwilhelm
author vkempik
date Thu, 03 Apr 2014 17:49:31 +0400
parents b9a9ed0f8eeb
children 570cb6369f17 42c091d63c72
comparison
equal deleted inserted replaced
17843:81d7a4b28dc5 17844:8847586c9037
34 // require these closure objects to be stack-allocated. 34 // require these closure objects to be stack-allocated.
35 class CardTableEntryClosure: public CHeapObj<mtGC> { 35 class CardTableEntryClosure: public CHeapObj<mtGC> {
36 public: 36 public:
37 // Process the card whose card table entry is "card_ptr". If returns 37 // Process the card whose card table entry is "card_ptr". If returns
38 // "false", terminate the iteration early. 38 // "false", terminate the iteration early.
39 virtual bool do_card_ptr(jbyte* card_ptr, int worker_i = 0) = 0; 39 virtual bool do_card_ptr(jbyte* card_ptr, uint worker_i = 0) = 0;
40 }; 40 };
41 41
42 // A ptrQueue whose elements are "oops", pointers to object heads. 42 // A ptrQueue whose elements are "oops", pointers to object heads.
43 class DirtyCardQueue: public PtrQueue { 43 class DirtyCardQueue: public PtrQueue {
44 public: 44 public:
51 // buffer empty. If a closure application returns "false", return 51 // buffer empty. If a closure application returns "false", return
52 // "false" immediately, halting the iteration. If "consume" is true, 52 // "false" immediately, halting the iteration. If "consume" is true,
53 // deletes processed entries from logs. 53 // deletes processed entries from logs.
54 bool apply_closure(CardTableEntryClosure* cl, 54 bool apply_closure(CardTableEntryClosure* cl,
55 bool consume = true, 55 bool consume = true,
56 size_t worker_i = 0); 56 uint worker_i = 0);
57 57
58 // Apply the closure to all elements of "buf", down to "index" 58 // Apply the closure to all elements of "buf", down to "index"
59 // (inclusive.) If returns "false", then a closure application returned 59 // (inclusive.) If returns "false", then a closure application returned
60 // "false", and we return immediately. If "consume" is true, entries are 60 // "false", and we return immediately. If "consume" is true, entries are
61 // set to NULL as they are processed, so they will not be processed again 61 // set to NULL as they are processed, so they will not be processed again
62 // later. 62 // later.
63 static bool apply_closure_to_buffer(CardTableEntryClosure* cl, 63 static bool apply_closure_to_buffer(CardTableEntryClosure* cl,
64 void** buf, size_t index, size_t sz, 64 void** buf, size_t index, size_t sz,
65 bool consume = true, 65 bool consume = true,
66 int worker_i = 0); 66 uint worker_i = 0);
67 void **get_buf() { return _buf;} 67 void **get_buf() { return _buf;}
68 void set_buf(void **buf) {_buf = buf;} 68 void set_buf(void **buf) {_buf = buf;}
69 size_t get_index() { return _index;} 69 size_t get_index() { return _index;}
70 void reinitialize() { _buf = 0; _sz = 0; _index = 0;} 70 void reinitialize() { _buf = 0; _sz = 0; _index = 0;}
71 }; 71 };
96 int max_completed_queue, 96 int max_completed_queue,
97 Mutex* lock, PtrQueueSet* fl_owner = NULL); 97 Mutex* lock, PtrQueueSet* fl_owner = NULL);
98 98
99 // The number of parallel ids that can be claimed to allow collector or 99 // The number of parallel ids that can be claimed to allow collector or
100 // mutator threads to do card-processing work. 100 // mutator threads to do card-processing work.
101 static size_t num_par_ids(); 101 static uint num_par_ids();
102 102
103 static void handle_zero_index_for_thread(JavaThread* t); 103 static void handle_zero_index_for_thread(JavaThread* t);
104 104
105 // Register "blk" as "the closure" for all queues. Only one such closure 105 // Register "blk" as "the closure" for all queues. Only one such closure
106 // is allowed. The "apply_closure_to_completed_buffer" method will apply 106 // is allowed. The "apply_closure_to_completed_buffer" method will apply
113 // in all currently-active buffers. This should only be applied at a 113 // in all currently-active buffers. This should only be applied at a
114 // safepoint. (Currently must not be called in parallel; this should 114 // safepoint. (Currently must not be called in parallel; this should
115 // change in the future.) If "consume" is true, processed entries are 115 // change in the future.) If "consume" is true, processed entries are
116 // discarded. 116 // discarded.
117 void iterate_closure_all_threads(bool consume = true, 117 void iterate_closure_all_threads(bool consume = true,
118 size_t worker_i = 0); 118 uint worker_i = 0);
119 119
120 // If there exists some completed buffer, pop it, then apply the 120 // If there exists some completed buffer, pop it, then apply the
121 // registered closure to all its elements, nulling out those elements 121 // registered closure to all its elements, nulling out those elements
122 // processed. If all elements are processed, returns "true". If no 122 // processed. If all elements are processed, returns "true". If no
123 // completed buffers exist, returns false. If a completed buffer exists, 123 // completed buffers exist, returns false. If a completed buffer exists,
124 // but is only partially completed before a "yield" happens, the 124 // but is only partially completed before a "yield" happens, the
125 // partially completed buffer (with its processed elements set to NULL) 125 // partially completed buffer (with its processed elements set to NULL)
126 // is returned to the completed buffer set, and this call returns false. 126 // is returned to the completed buffer set, and this call returns false.
127 bool apply_closure_to_completed_buffer(int worker_i = 0, 127 bool apply_closure_to_completed_buffer(uint worker_i = 0,
128 int stop_at = 0, 128 int stop_at = 0,
129 bool during_pause = false); 129 bool during_pause = false);
130 130
131 // If there exists some completed buffer, pop it, then apply the 131 // If there exists some completed buffer, pop it, then apply the
132 // specified closure to all its elements, nulling out those elements 132 // specified closure to all its elements, nulling out those elements
134 // completed buffers exist, returns false. If a completed buffer exists, 134 // completed buffers exist, returns false. If a completed buffer exists,
135 // but is only partially completed before a "yield" happens, the 135 // but is only partially completed before a "yield" happens, the
136 // partially completed buffer (with its processed elements set to NULL) 136 // partially completed buffer (with its processed elements set to NULL)
137 // is returned to the completed buffer set, and this call returns false. 137 // is returned to the completed buffer set, and this call returns false.
138 bool apply_closure_to_completed_buffer(CardTableEntryClosure* cl, 138 bool apply_closure_to_completed_buffer(CardTableEntryClosure* cl,
139 int worker_i = 0, 139 uint worker_i = 0,
140 int stop_at = 0, 140 int stop_at = 0,
141 bool during_pause = false); 141 bool during_pause = false);
142 142
143 // Helper routine for the above. 143 // Helper routine for the above.
144 bool apply_closure_to_completed_buffer_helper(CardTableEntryClosure* cl, 144 bool apply_closure_to_completed_buffer_helper(CardTableEntryClosure* cl,
145 int worker_i, 145 uint worker_i,
146 BufferNode* nd); 146 BufferNode* nd);
147 147
148 BufferNode* get_completed_buffer(int stop_at); 148 BufferNode* get_completed_buffer(int stop_at);
149 149
150 // Applies the current closure to all completed buffers, 150 // Applies the current closure to all completed buffers,