hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
changeset 26796 666464578742
parent 26422 4ee5901e205e
child 26809 8d3de4de954d
equal deleted inserted replaced
26706:1e985d72c57f 26796:666464578742
  5093       _claimed_nmethod(NULL),
  5093       _claimed_nmethod(NULL),
  5094       _postponed_list(NULL),
  5094       _postponed_list(NULL),
  5095       _num_entered_barrier(0)
  5095       _num_entered_barrier(0)
  5096   {
  5096   {
  5097     nmethod::increase_unloading_clock();
  5097     nmethod::increase_unloading_clock();
  5098     _first_nmethod = CodeCache::alive_nmethod(CodeCache::first());
  5098     // Get first alive nmethod
       
  5099     NMethodIterator iter = NMethodIterator();
       
  5100     if(iter.next_alive()) {
       
  5101       _first_nmethod = iter.method();
       
  5102     }
  5099     _claimed_nmethod = (volatile nmethod*)_first_nmethod;
  5103     _claimed_nmethod = (volatile nmethod*)_first_nmethod;
  5100   }
  5104   }
  5101 
  5105 
  5102   ~G1CodeCacheUnloadingTask() {
  5106   ~G1CodeCacheUnloadingTask() {
  5103     CodeCache::verify_clean_inline_caches();
  5107     CodeCache::verify_clean_inline_caches();
  5136 
  5140 
  5137   static const int MaxClaimNmethods = 16;
  5141   static const int MaxClaimNmethods = 16;
  5138 
  5142 
  5139   void claim_nmethods(nmethod** claimed_nmethods, int *num_claimed_nmethods) {
  5143   void claim_nmethods(nmethod** claimed_nmethods, int *num_claimed_nmethods) {
  5140     nmethod* first;
  5144     nmethod* first;
  5141     nmethod* last;
  5145     NMethodIterator last;
  5142 
  5146 
  5143     do {
  5147     do {
  5144       *num_claimed_nmethods = 0;
  5148       *num_claimed_nmethods = 0;
  5145 
  5149 
  5146       first = last = (nmethod*)_claimed_nmethod;
  5150       first = (nmethod*)_claimed_nmethod;
       
  5151       last = NMethodIterator(first);
  5147 
  5152 
  5148       if (first != NULL) {
  5153       if (first != NULL) {
       
  5154 
  5149         for (int i = 0; i < MaxClaimNmethods; i++) {
  5155         for (int i = 0; i < MaxClaimNmethods; i++) {
  5150           last = CodeCache::alive_nmethod(CodeCache::next(last));
  5156           if (!last.next_alive()) {
  5151 
       
  5152           if (last == NULL) {
       
  5153             break;
  5157             break;
  5154           }
  5158           }
  5155 
  5159           claimed_nmethods[i] = last.method();
  5156           claimed_nmethods[i] = last;
       
  5157           (*num_claimed_nmethods)++;
  5160           (*num_claimed_nmethods)++;
  5158         }
  5161         }
  5159       }
  5162       }
  5160 
  5163 
  5161     } while ((nmethod*)Atomic::cmpxchg_ptr(last, &_claimed_nmethod, first) != first);
  5164     } while ((nmethod*)Atomic::cmpxchg_ptr(last.method(), &_claimed_nmethod, first) != first);
  5162   }
  5165   }
  5163 
  5166 
  5164   nmethod* claim_postponed_nmethod() {
  5167   nmethod* claim_postponed_nmethod() {
  5165     nmethod* claim;
  5168     nmethod* claim;
  5166     nmethod* next;
  5169     nmethod* next;