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

Print this page
rev 6670 : 8049426: Minor cleanups after G1 class unloading
Reviewed-by: stefank


 152 }
 153 
 154 size_t G1CodeRootSet::free_chunks_mem_size() {
 155   return _default_chunk_manager.fl_mem_size();
 156 }
 157 
 158 G1CodeRootSet::G1CodeRootSet(G1CodeRootChunkManager* manager) : _manager(manager), _list(), _length(0) {
 159   if (_manager == NULL) {
 160     _manager = &_default_chunk_manager;
 161   }
 162   _list.initialize();
 163   _list.set_size(G1CodeRootChunk::word_size());
 164 }
 165 
 166 G1CodeRootSet::~G1CodeRootSet() {
 167   clear();
 168 }
 169 
 170 void G1CodeRootSet::add(nmethod* method) {
 171   if (!contains(method)) {
 172     // Find the first chunk thatisn't full.
 173     G1CodeRootChunk* cur = _list.head();
 174     while (cur != NULL) {
 175       if (!cur->is_full()) {
 176         break;
 177       }
 178       cur = cur->next();
 179     }
 180 
 181     // All chunks are full, get a new chunk.
 182     if (cur == NULL) {
 183       cur = new_chunk();
 184       _list.return_chunk_at_head(cur);
 185     }
 186 
 187     // Add the nmethod.
 188     bool result = cur->add(method);
 189 
 190     guarantee(result, err_msg("Not able to add nmethod "PTR_FORMAT" to newly allocated chunk.", method));
 191 
 192     _length++;




 152 }
 153 
 154 size_t G1CodeRootSet::free_chunks_mem_size() {
 155   return _default_chunk_manager.fl_mem_size();
 156 }
 157 
 158 G1CodeRootSet::G1CodeRootSet(G1CodeRootChunkManager* manager) : _manager(manager), _list(), _length(0) {
 159   if (_manager == NULL) {
 160     _manager = &_default_chunk_manager;
 161   }
 162   _list.initialize();
 163   _list.set_size(G1CodeRootChunk::word_size());
 164 }
 165 
 166 G1CodeRootSet::~G1CodeRootSet() {
 167   clear();
 168 }
 169 
 170 void G1CodeRootSet::add(nmethod* method) {
 171   if (!contains(method)) {
 172     // Find the first chunk that isn't full.
 173     G1CodeRootChunk* cur = _list.head();
 174     while (cur != NULL) {
 175       if (!cur->is_full()) {
 176         break;
 177       }
 178       cur = cur->next();
 179     }
 180 
 181     // All chunks are full, get a new chunk.
 182     if (cur == NULL) {
 183       cur = new_chunk();
 184       _list.return_chunk_at_head(cur);
 185     }
 186 
 187     // Add the nmethod.
 188     bool result = cur->add(method);
 189 
 190     guarantee(result, err_msg("Not able to add nmethod "PTR_FORMAT" to newly allocated chunk.", method));
 191 
 192     _length++;