comparison src/share/vm/runtime/sweeper.cpp @ 1615:ff38d05ea86f

6956958: assert(is_clean() || is_call_to_compiled() || is_call_to_interpreted() || is_optimized() || is_megam Reviewed-by: kvn
author never
date Fri, 18 Jun 2010 16:51:54 -0700
parents c18cbe5936b8
children 2a47bd84841f
comparison
equal deleted inserted replaced
1609:4311f23817fd 1615:ff38d05ea86f
24 24
25 # include "incls/_precompiled.incl" 25 # include "incls/_precompiled.incl"
26 # include "incls/_sweeper.cpp.incl" 26 # include "incls/_sweeper.cpp.incl"
27 27
28 long NMethodSweeper::_traversals = 0; // No. of stack traversals performed 28 long NMethodSweeper::_traversals = 0; // No. of stack traversals performed
29 CodeBlob* NMethodSweeper::_current = NULL; // Current nmethod 29 nmethod* NMethodSweeper::_current = NULL; // Current nmethod
30 int NMethodSweeper::_seen = 0 ; // No. of blobs we have currently processed in current pass of CodeCache 30 int NMethodSweeper::_seen = 0 ; // No. of blobs we have currently processed in current pass of CodeCache
31 int NMethodSweeper::_invocations = 0; // No. of invocations left until we are completed with this pass 31 int NMethodSweeper::_invocations = 0; // No. of invocations left until we are completed with this pass
32 32
33 jint NMethodSweeper::_locked_seen = 0; 33 jint NMethodSweeper::_locked_seen = 0;
34 jint NMethodSweeper::_not_entrant_seen_on_stack = 0; 34 jint NMethodSweeper::_not_entrant_seen_on_stack = 0;
169 for(int i = 0; i < todo && _current != NULL; i++) { 169 for(int i = 0; i < todo && _current != NULL; i++) {
170 170
171 // Since we will give up the CodeCache_lock, always skip ahead to an nmethod. 171 // Since we will give up the CodeCache_lock, always skip ahead to an nmethod.
172 // Other blobs can be deleted by other threads 172 // Other blobs can be deleted by other threads
173 // Read next before we potentially delete current 173 // Read next before we potentially delete current
174 CodeBlob* next = CodeCache::next_nmethod(_current); 174 nmethod* next = CodeCache::next_nmethod(_current);
175 175
176 // Now ready to process nmethod and give up CodeCache_lock 176 // Now ready to process nmethod and give up CodeCache_lock
177 { 177 {
178 MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); 178 MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
179 process_nmethod((nmethod *)_current); 179 process_nmethod(_current);
180 } 180 }
181 _seen++; 181 _seen++;
182 _current = next; 182 _current = next;
183 } 183 }
184
185 // Skip forward to the next nmethod (if any). Code blobs other than nmethods
186 // can be freed async to us and make _current invalid while we sleep.
187 _current = CodeCache::next_nmethod(_current);
188 } 184 }
189 185
190 if (_current == NULL && !_rescan && (_locked_seen || _not_entrant_seen_on_stack)) { 186 if (_current == NULL && !_rescan && (_locked_seen || _not_entrant_seen_on_stack)) {
191 // we've completed a scan without making progress but there were 187 // we've completed a scan without making progress but there were
192 // nmethods we were unable to process either because they were 188 // nmethods we were unable to process either because they were