< prev index next >

src/hotspot/share/runtime/safepoint.cpp

Print this page
@@ -729,10 +729,15 @@
      SafepointSynchronize::increment_jni_active_count();
    }
    DEBUG_ONLY(_thread->set_visited_for_critical_count(SafepointSynchronize::safepoint_counter());)
    assert(!_safepoint_safe, "Must be unsafe before safe");
    _safepoint_safe = true;
+ 
+   // The oops in the monitor cache are cleared to prevent stale cache entries
+   // from keeping dead objects alive. Because these oops are always cleared
+   // before safepoint operations they are not visited in JavaThread::oops_do.
+   _thread->om_clear_monitor_cache();
  }
  
  void ThreadSafepointState::restart() {
    assert(_safepoint_safe, "Must be safe before unsafe");
    _safepoint_safe = false;
< prev index next >