< prev index next >

src/hotspot/share/runtime/sweeper.cpp

Print this page

181 
182   _seen = 0;
183   _current = CompiledMethodIterator(CompiledMethodIterator::all_blobs);
184   // Initialize to first nmethod
185   _current.next();
186   _traversals += 1;
187   _total_time_this_sweep = Tickspan();
188 
189   if (PrintMethodFlushing) {
190     tty->print_cr("### Sweep: stack traversal %ld", _traversals);
191   }
192   return &mark_activation_closure;
193 }
194 
195 /**
196   * This function triggers a VM operation that does stack scanning of active
197   * methods. Stack scanning is mandatory for the sweeper to make progress.
198   */
199 void NMethodSweeper::do_stack_scanning() {
200   assert(!CodeCache_lock->owned_by_self(), "just checking");


201   if (wait_for_stack_scanning()) {
202     CodeBlobClosure* code_cl;
203     {
204       MutexLocker ccl(CodeCache_lock, Mutex::_no_safepoint_check_flag);
205       code_cl = prepare_mark_active_nmethods();
206     }
207     if (code_cl != NULL) {
208       NMethodMarkingClosure nm_cl(code_cl);
209       Handshake::execute(&nm_cl);
210     }
211   }
212 }
213 
214 void NMethodSweeper::sweeper_loop() {
215   bool timeout;
216   while (true) {
217     {
218       ThreadBlockInVM tbivm(JavaThread::current());
219       MonitorLocker waiter(CodeSweeper_lock, Mutex::_no_safepoint_check_flag);
220       const long wait_time = 60*60*24 * 1000;

181 
182   _seen = 0;
183   _current = CompiledMethodIterator(CompiledMethodIterator::all_blobs);
184   // Initialize to first nmethod
185   _current.next();
186   _traversals += 1;
187   _total_time_this_sweep = Tickspan();
188 
189   if (PrintMethodFlushing) {
190     tty->print_cr("### Sweep: stack traversal %ld", _traversals);
191   }
192   return &mark_activation_closure;
193 }
194 
195 /**
196   * This function triggers a VM operation that does stack scanning of active
197   * methods. Stack scanning is mandatory for the sweeper to make progress.
198   */
199 void NMethodSweeper::do_stack_scanning() {
200   assert(!CodeCache_lock->owned_by_self(), "just checking");
201   // There are stacks in the heap that need to be scanned.
202   Universe::heap()->collect_for_codecache();
203   if (wait_for_stack_scanning()) {
204     CodeBlobClosure* code_cl;
205     {
206       MutexLocker ccl(CodeCache_lock, Mutex::_no_safepoint_check_flag);
207       code_cl = prepare_mark_active_nmethods();
208     }
209     if (code_cl != NULL) {
210       NMethodMarkingClosure nm_cl(code_cl);
211       Handshake::execute(&nm_cl);
212     }
213   }
214 }
215 
216 void NMethodSweeper::sweeper_loop() {
217   bool timeout;
218   while (true) {
219     {
220       ThreadBlockInVM tbivm(JavaThread::current());
221       MonitorLocker waiter(CodeSweeper_lock, Mutex::_no_safepoint_check_flag);
222       const long wait_time = 60*60*24 * 1000;
< prev index next >