185 }
186 set_insert_end(task);
187 increment_length();
188 verify_length();
189 if (TraceGCTaskQueue) {
190 print("after:");
191 }
192 }
193
194 // Enqueue a whole list of tasks. Empties the argument list.
195 void GCTaskQueue::enqueue(GCTaskQueue* list) {
196 if (TraceGCTaskQueue) {
197 tty->print_cr("[" INTPTR_FORMAT "]"
198 " GCTaskQueue::enqueue(list: "
199 INTPTR_FORMAT ")",
200 this, list);
201 print("before:");
202 list->print("list:");
203 }
204 if (list->is_empty()) {
205 // Enqueuing the empty list: nothing to do.
206 return;
207 }
208 uint list_length = list->length();
209 if (is_empty()) {
210 // Enqueuing to empty list: just acquire elements.
211 set_insert_end(list->insert_end());
212 set_remove_end(list->remove_end());
213 set_length(list_length);
214 } else {
215 // Prepend argument list to our queue.
216 list->remove_end()->set_older(insert_end());
217 insert_end()->set_newer(list->remove_end());
218 set_insert_end(list->insert_end());
219 set_length(length() + list_length);
220 // empty the argument list.
221 }
222 list->initialize();
223 if (TraceGCTaskQueue) {
224 print("after:");
225 list->print("list:");
226 }
227 verify_length();
228 }
229
230 // Dequeue one task.
|
185 }
186 set_insert_end(task);
187 increment_length();
188 verify_length();
189 if (TraceGCTaskQueue) {
190 print("after:");
191 }
192 }
193
194 // Enqueue a whole list of tasks. Empties the argument list.
195 void GCTaskQueue::enqueue(GCTaskQueue* list) {
196 if (TraceGCTaskQueue) {
197 tty->print_cr("[" INTPTR_FORMAT "]"
198 " GCTaskQueue::enqueue(list: "
199 INTPTR_FORMAT ")",
200 this, list);
201 print("before:");
202 list->print("list:");
203 }
204 if (list->is_empty()) {
205 // Enqueueing the empty list: nothing to do.
206 return;
207 }
208 uint list_length = list->length();
209 if (is_empty()) {
210 // Enqueueing to empty list: just acquire elements.
211 set_insert_end(list->insert_end());
212 set_remove_end(list->remove_end());
213 set_length(list_length);
214 } else {
215 // Prepend argument list to our queue.
216 list->remove_end()->set_older(insert_end());
217 insert_end()->set_newer(list->remove_end());
218 set_insert_end(list->insert_end());
219 set_length(length() + list_length);
220 // empty the argument list.
221 }
222 list->initialize();
223 if (TraceGCTaskQueue) {
224 print("after:");
225 list->print("list:");
226 }
227 verify_length();
228 }
229
230 // Dequeue one task.
|