< prev index next >

src/hotspot/share/code/codeCache.cpp

Print this page
rev 54936 : [mq]: 8221734-v3
rev 54937 : [mq]: 8221734-v5

@@ -1144,25 +1144,25 @@
 
   Deoptimization::deoptimize_all_marked();
 }
 #endif // INCLUDE_JVMTI
 
-// Deoptimize all(most) methods
+// Mark methods for deopt (if safe or possible).
 void CodeCache::mark_all_nmethods_for_deoptimization() {
   MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
   while(iter.next()) {
     CompiledMethod* nm = iter.method();
-    // Not installed are unsafe to mark for deopt, normally never deopted.
-    // A not_entrant method may become a zombie at any time,
-    // since we don't know on which side of last safepoint it became not_entrant
-    // (state must be in_use).
-    // Native method are unsafe to mark for deopt, normally never deopted.
     if (!nm->method()->is_method_handle_intrinsic() &&
         !nm->is_not_installed() &&
         nm->is_in_use() &&
         !nm->is_native_method()) {
+      // Intrinsics and native methods are never deopted. A method that is
+      // not installed yet or is not in use is not safe to deopt; the
+      // is_in_use() check covers the not_entrant and not zombie cases.
+      // Note: A not_entrant method can become a zombie at anytime if it was
+      // made not_entrant before the previous safepoint/handshake.
       nm->mark_for_deoptimization();
     }
   }
 }
 

@@ -1186,16 +1186,16 @@
 void CodeCache::make_marked_nmethods_not_entrant() {
   assert_locked_or_safepoint(CodeCache_lock);
   CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
   while(iter.next()) {
     CompiledMethod* nm = iter.method();
-    // only_alive_and_not_unloading returns not_entrant nmethods.
-    // A not_entrant can become a zombie at anytime,
-    // if it was made not_entrant before previous safepoint/handshake.
-    // We check that it is not not_entrant and not zombie,
-    // by checking is_in_use().
     if (nm->is_marked_for_deoptimization() && nm->is_in_use()) {
+      // only_alive_and_not_unloading() can return not_entrant nmethods.
+      // A not_entrant method can become a zombie at anytime if it was
+      // made not_entrant before the previous safepoint/handshake. The
+      // is_in_use() check covers the not_entrant and not zombie cases
+      // that have become true after the method was marked for deopt.
       nm->make_not_entrant();
     }
   }
 }
 
< prev index next >