< prev index next > src/hotspot/share/runtime/sweeper.cpp
}
#else
#define SWEEP(nm)
#endif
-CompiledMethodIterator NMethodSweeper::_current; // Current compiled method
+CompiledMethodIterator NMethodSweeper::_current(false /* only_alive */, false /* only_not_unloading */); // Current compiled method
long NMethodSweeper::_traversals = 0; // Stack scan count, also sweep ID.
long NMethodSweeper::_total_nof_code_cache_sweeps = 0; // Total number of full sweeps of the code cache
long NMethodSweeper::_time_counter = 0; // Virtual time used to periodically invoke sweeper
long NMethodSweeper::_last_sweep = 0; // Value of _time_counter when the last sweep happened
int NMethodSweeper::_seen = 0; // Nof. nmethod we have currently processed in current pass of CodeCache
// Check for restart
assert(_current.method() == NULL, "should only happen between sweeper cycles");
assert(wait_for_stack_scanning(), "should only happen between sweeper cycles");
_seen = 0;
- _current = CompiledMethodIterator();
+ _current = CompiledMethodIterator(false /* only_alive */, false /* only_not_unloading */);
// Initialize to first nmethod
_current.next();
_traversals += 1;
_total_time_this_sweep = Tickspan();
public:
CompiledMethodMarker(CompiledMethod* cm) {
JavaThread* current = JavaThread::current();
assert (current->is_Code_cache_sweeper_thread(), "Must be");
_thread = (CodeCacheSweeperThread*)current;
- if (!cm->is_zombie() && !cm->is_unloaded()) {
+ if (!cm->is_zombie() && !cm->is_unloading()) {
// Only expose live nmethods for scanning
_thread->set_scanned_compiled_method(cm);
}
}
~CompiledMethodMarker() {
SWEEP(cm);
// Skip methods that are currently referenced by the VM
if (cm->is_locked_by_vm()) {
// But still remember to clean-up inline caches for alive nmethods
- if (cm->is_alive()) {
+ if (cm->is_alive() && !cm->is_unloading()) {
// Clean inline caches that point to zombie/non-entrant/unloaded nmethods
CompiledICLocker ml(cm);
cm->cleanup_inline_caches(false);
SWEEP(cm);
}
}
void NMethodSweeper::possibly_flush(nmethod* nm) {
if (UseCodeCacheFlushing) {
- if (!nm->is_locked_by_vm() && !nm->is_native_method() && !nm->is_not_installed()) {
+ if (!nm->is_locked_by_vm() && !nm->is_native_method() && !nm->is_not_installed() && !nm->is_unloading()) {
bool make_not_entrant = false;
// Do not make native methods not-entrant
nm->dec_hotness_counter();
// Get the initial value of the hotness counter. This value depends on the
< prev index next >