< prev index next >

src/hotspot/share/runtime/handles.cpp

Print this page




  77   }                                                                    \
  78   return *this;                                                        \
  79 }                                                                      \
  80 inline void name##Handle::remove() {                                   \
  81   if (_value != NULL) {                                                \
  82     int i = _thread->metadata_handles()->find_from_end((Metadata*)_value); \
  83     assert(i!=-1, "not in metadata_handles list");                     \
  84     _thread->metadata_handles()->remove_at(i);                         \
  85   }                                                                    \
  86 }                                                                      \
  87 name##Handle::~name##Handle () { remove(); }                           \
  88 
  89 DEF_METADATA_HANDLE_FN_NOINLINE(method, Method)
  90 DEF_METADATA_HANDLE_FN_NOINLINE(constantPool, ConstantPool)
  91 
  92 
  93 static uintx chunk_oops_do(OopClosure* f, Chunk* chunk, char* chunk_top) {
  94   oop* bottom = (oop*) chunk->bottom();
  95   oop* top    = (oop*) chunk_top;
  96   uintx handles_visited = top - bottom;
  97   BufferedValuesDealiaser* dealiaser = NULL;
  98   assert(top >= bottom && top <= (oop*) chunk->top(), "just checking");
  99   // during GC phase 3, a handle may be a forward pointer that
 100   // is not yet valid, so loosen the assertion
 101   while (bottom < top) {
 102     if (Universe::heap()->is_in_reserved_or_null(*bottom)) {
 103       f->do_oop(bottom);
 104     } else {
 105       if (VTBuffer::is_in_vt_buffer(*bottom)) {
 106         if(dealiaser == NULL) {
 107           dealiaser = Thread::current()->buffered_values_dealiaser();
 108         }
 109         dealiaser->oops_do(f, *bottom);
 110       }
 111     }
 112     bottom++;
 113   }
 114   return handles_visited;
 115 }
 116 
 117 // Used for debugging handle allocation.
 118 NOT_PRODUCT(jint _nof_handlemarks  = 0;)
 119 
 120 void HandleArea::oops_do(OopClosure* f) {
 121   uintx handles_visited = 0;
 122   // First handle the current chunk. It is filled to the high water mark.
 123   handles_visited += chunk_oops_do(f, _chunk, _hwm);
 124   // Then handle all previous chunks. They are completely filled.
 125   Chunk* k = _first;
 126   while(k != _chunk) {
 127     handles_visited += chunk_oops_do(f, k, k->top());
 128     k = k->next();
 129   }
 130 




  77   }                                                                    \
  78   return *this;                                                        \
  79 }                                                                      \
  80 inline void name##Handle::remove() {                                   \
  81   if (_value != NULL) {                                                \
  82     int i = _thread->metadata_handles()->find_from_end((Metadata*)_value); \
  83     assert(i!=-1, "not in metadata_handles list");                     \
  84     _thread->metadata_handles()->remove_at(i);                         \
  85   }                                                                    \
  86 }                                                                      \
  87 name##Handle::~name##Handle () { remove(); }                           \
  88 
  89 DEF_METADATA_HANDLE_FN_NOINLINE(method, Method)
  90 DEF_METADATA_HANDLE_FN_NOINLINE(constantPool, ConstantPool)
  91 
  92 
  93 static uintx chunk_oops_do(OopClosure* f, Chunk* chunk, char* chunk_top) {
  94   oop* bottom = (oop*) chunk->bottom();
  95   oop* top    = (oop*) chunk_top;
  96   uintx handles_visited = top - bottom;

  97   assert(top >= bottom && top <= (oop*) chunk->top(), "just checking");
  98   // during GC phase 3, a handle may be a forward pointer that
  99   // is not yet valid, so loosen the assertion
 100   while (bottom < top) {
 101     if (Universe::heap()->is_in_reserved_or_null(*bottom)) {
 102       f->do_oop(bottom);







 103     }
 104     bottom++;
 105   }
 106   return handles_visited;
 107 }
 108 
 109 // Used for debugging handle allocation.
 110 NOT_PRODUCT(jint _nof_handlemarks  = 0;)
 111 
 112 void HandleArea::oops_do(OopClosure* f) {
 113   uintx handles_visited = 0;
 114   // First handle the current chunk. It is filled to the high water mark.
 115   handles_visited += chunk_oops_do(f, _chunk, _hwm);
 116   // Then handle all previous chunks. They are completely filled.
 117   Chunk* k = _first;
 118   while(k != _chunk) {
 119     handles_visited += chunk_oops_do(f, k, k->top());
 120     k = k->next();
 121   }
 122 


< prev index next >