src/share/vm/runtime/vmThread.cpp

Print this page




 106   VM_Operation* r = _queue[prio]->next();
 107   assert(r != _queue[prio], "cannot remove base element");
 108   unlink(r);
 109   return r;
 110 }
 111 
 112 VM_Operation* VMOperationQueue::queue_drain(int prio) {
 113   if (queue_empty(prio)) return NULL;
 114   DEBUG_ONLY(int length = _queue_length[prio];);
 115   assert(length >= 0, "sanity check");
 116   _queue_length[prio] = 0;
 117   VM_Operation* r = _queue[prio]->next();
 118   assert(r != _queue[prio], "cannot remove base element");
 119   // remove links to base element from head and tail
 120   r->set_prev(NULL);
 121   _queue[prio]->prev()->set_next(NULL);
 122   // restore queue to empty state
 123   _queue[prio]->set_next(_queue[prio]);
 124   _queue[prio]->set_prev(_queue[prio]);
 125   assert(queue_empty(prio), "drain corrupted queue");
 126 #ifdef DEBUG
 127   int len = 0;
 128   VM_Operation* cur;
 129   for(cur = r; cur != NULL; cur=cur->next()) len++;
 130   assert(len == length, "drain lost some ops");
 131 #endif
 132   return r;
 133 }
 134 
 135 void VMOperationQueue::queue_oops_do(int queue, OopClosure* f) {
 136   VM_Operation* cur = _queue[queue];
 137   cur = cur->next();
 138   while (cur != _queue[queue]) {
 139     cur->oops_do(f);
 140     cur = cur->next();
 141   }
 142 }
 143 
 144 void VMOperationQueue::drain_list_oops_do(OopClosure* f) {
 145   VM_Operation* cur = _drain_list;
 146   while (cur != NULL) {




 106   VM_Operation* r = _queue[prio]->next();
 107   assert(r != _queue[prio], "cannot remove base element");
 108   unlink(r);
 109   return r;
 110 }
 111 
 112 VM_Operation* VMOperationQueue::queue_drain(int prio) {
 113   if (queue_empty(prio)) return NULL;
 114   DEBUG_ONLY(int length = _queue_length[prio];);
 115   assert(length >= 0, "sanity check");
 116   _queue_length[prio] = 0;
 117   VM_Operation* r = _queue[prio]->next();
 118   assert(r != _queue[prio], "cannot remove base element");
 119   // remove links to base element from head and tail
 120   r->set_prev(NULL);
 121   _queue[prio]->prev()->set_next(NULL);
 122   // restore queue to empty state
 123   _queue[prio]->set_next(_queue[prio]);
 124   _queue[prio]->set_prev(_queue[prio]);
 125   assert(queue_empty(prio), "drain corrupted queue");
 126 #ifdef ASSERT
 127   int len = 0;
 128   VM_Operation* cur;
 129   for(cur = r; cur != NULL; cur=cur->next()) len++;
 130   assert(len == length, "drain lost some ops");
 131 #endif
 132   return r;
 133 }
 134 
 135 void VMOperationQueue::queue_oops_do(int queue, OopClosure* f) {
 136   VM_Operation* cur = _queue[queue];
 137   cur = cur->next();
 138   while (cur != _queue[queue]) {
 139     cur->oops_do(f);
 140     cur = cur->next();
 141   }
 142 }
 143 
 144 void VMOperationQueue::drain_list_oops_do(OopClosure* f) {
 145   VM_Operation* cur = _drain_list;
 146   while (cur != NULL) {