< prev index next >

src/hotspot/share/runtime/sweeper.cpp

Print this page




 657       // Only expose live nmethods for scanning
 658       _thread->set_scanned_compiled_method(cm);
 659     }
 660   }
 661   ~CompiledMethodMarker() {
 662     _thread->set_scanned_compiled_method(NULL);
 663   }
 664 };
 665 
 666 NMethodSweeper::MethodStateChange NMethodSweeper::process_compiled_method(CompiledMethod* cm) {
 667   assert(cm != NULL, "sanity");
 668   assert(!CodeCache_lock->owned_by_self(), "just checking");
 669 
 670   MethodStateChange result = None;
 671   // Make sure this nmethod doesn't get unloaded during the scan,
 672   // since safepoints may happen during acquired below locks.
 673   CompiledMethodMarker nmm(cm);
 674   SWEEP(cm);
 675 
 676   // Skip methods that are currently referenced by the VM
 677   if (cm->is_locked_by_vm()) {
 678     // But still remember to clean-up inline caches for alive nmethods
 679     if (cm->is_alive()) {
 680       // Clean inline caches that point to zombie/non-entrant/unloaded nmethods
 681       cm->cleanup_inline_caches(false);
 682       SWEEP(cm);
 683     }
 684     return result;
 685   }
 686 
 687   if (cm->is_zombie()) {
 688     // All inline caches that referred to this nmethod were cleaned in the
 689     // previous sweeper cycle. Now flush the nmethod from the code cache.
 690     assert(!cm->is_locked_by_vm(), "must not flush locked Compiled Methods");
 691     cm->flush();
 692     assert(result == None, "sanity");
 693     result = Flushed;
 694   } else if (cm->is_not_entrant()) {
 695     // If there are no current activations of this method on the
 696     // stack we can safely convert it to a zombie method
 697     OrderAccess::loadload(); // _stack_traversal_mark and _state




 657       // Only expose live nmethods for scanning
 658       _thread->set_scanned_compiled_method(cm);
 659     }
 660   }
 661   ~CompiledMethodMarker() {
 662     _thread->set_scanned_compiled_method(NULL);
 663   }
 664 };
 665 
 666 NMethodSweeper::MethodStateChange NMethodSweeper::process_compiled_method(CompiledMethod* cm) {
 667   assert(cm != NULL, "sanity");
 668   assert(!CodeCache_lock->owned_by_self(), "just checking");
 669 
 670   MethodStateChange result = None;
 671   // Make sure this nmethod doesn't get unloaded during the scan,
 672   // since safepoints may happen during acquired below locks.
 673   CompiledMethodMarker nmm(cm);
 674   SWEEP(cm);
 675 
 676   // Skip methods that are currently referenced by the VM
 677   if (cm->is_locked_by_vm() || cm->is_on_continuation_stack()) {
 678     // But still remember to clean-up inline caches for alive nmethods
 679     if (cm->is_alive()) {
 680       // Clean inline caches that point to zombie/non-entrant/unloaded nmethods
 681       cm->cleanup_inline_caches(false);
 682       SWEEP(cm);
 683     }
 684     return result;
 685   }
 686 
 687   if (cm->is_zombie()) {
 688     // All inline caches that referred to this nmethod were cleaned in the
 689     // previous sweeper cycle. Now flush the nmethod from the code cache.
 690     assert(!cm->is_locked_by_vm(), "must not flush locked Compiled Methods");
 691     cm->flush();
 692     assert(result == None, "sanity");
 693     result = Flushed;
 694   } else if (cm->is_not_entrant()) {
 695     // If there are no current activations of this method on the
 696     // stack we can safely convert it to a zombie method
 697     OrderAccess::loadload(); // _stack_traversal_mark and _state


< prev index next >