src/share/vm/gc_implementation/g1/ptrQueue.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File warning2 Sdiff src/share/vm/gc_implementation/g1

src/share/vm/gc_implementation/g1/ptrQueue.cpp

Print this page
rev 3821 : [mq]: unused


  47 {}
  48 
  49 void PtrQueue::flush() {
  50   if (!_perm && _buf != NULL) {
  51     if (_index == _sz) {
  52       // No work to do.
  53       qset()->deallocate_buffer(_buf);
  54     } else {
  55       // We must NULL out the unused entries, then enqueue.
  56       for (size_t i = 0; i < _index; i += oopSize) {
  57         _buf[byte_index_to_index((int)i)] = NULL;
  58       }
  59       qset()->enqueue_complete_buffer(_buf);
  60     }
  61     _buf = NULL;
  62     _index = 0;
  63   }
  64 }
  65 
  66 
  67 static int byte_index_to_index(int ind) {
  68   assert((ind % oopSize) == 0, "Invariant.");
  69   return ind / oopSize;
  70 }
  71 
  72 static int index_to_byte_index(int byte_ind) {
  73   return byte_ind * oopSize;
  74 }
  75 
  76 void PtrQueue::enqueue_known_active(void* ptr) {
  77   assert(0 <= _index && _index <= _sz, "Invariant.");
  78   assert(_index == 0 || _buf != NULL, "invariant");
  79 
  80   while (_index == 0) {
  81     handle_zero_index();
  82   }
  83 
  84   assert(_index > 0, "postcondition");
  85   _index -= oopSize;
  86   _buf[byte_index_to_index((int)_index)] = ptr;
  87   assert(0 <= _index && _index <= _sz, "Invariant.");
  88 }
  89 
  90 void PtrQueue::locking_enqueue_completed_buffer(void** buf) {
  91   assert(_lock->owned_by_self(), "Required.");
  92 
  93   // We have to unlock _lock (which may be Shared_DirtyCardQ_lock) before
  94   // we acquire DirtyCardQ_CBL_mon inside enqeue_complete_buffer as they
  95   // have the same rank and we may get the "possible deadlock" message




  47 {}
  48 
  49 void PtrQueue::flush() {
  50   if (!_perm && _buf != NULL) {
  51     if (_index == _sz) {
  52       // No work to do.
  53       qset()->deallocate_buffer(_buf);
  54     } else {
  55       // We must NULL out the unused entries, then enqueue.
  56       for (size_t i = 0; i < _index; i += oopSize) {
  57         _buf[byte_index_to_index((int)i)] = NULL;
  58       }
  59       qset()->enqueue_complete_buffer(_buf);
  60     }
  61     _buf = NULL;
  62     _index = 0;
  63   }
  64 }
  65 
  66 









  67 void PtrQueue::enqueue_known_active(void* ptr) {
  68   assert(0 <= _index && _index <= _sz, "Invariant.");
  69   assert(_index == 0 || _buf != NULL, "invariant");
  70 
  71   while (_index == 0) {
  72     handle_zero_index();
  73   }
  74 
  75   assert(_index > 0, "postcondition");
  76   _index -= oopSize;
  77   _buf[byte_index_to_index((int)_index)] = ptr;
  78   assert(0 <= _index && _index <= _sz, "Invariant.");
  79 }
  80 
  81 void PtrQueue::locking_enqueue_completed_buffer(void** buf) {
  82   assert(_lock->owned_by_self(), "Required.");
  83 
  84   // We have to unlock _lock (which may be Shared_DirtyCardQ_lock) before
  85   // we acquire DirtyCardQ_CBL_mon inside enqeue_complete_buffer as they
  86   // have the same rank and we may get the "possible deadlock" message


src/share/vm/gc_implementation/g1/ptrQueue.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File