From 086c5f1750ad02d94c27f8b0e33df324abbe8ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Mon, 8 Jun 2020 12:15:30 +0000 Subject: [PATCH] 8246442: nmethod::can_convert_to_zombie() asserts when not called by the sweeper Reviewed-by: dholmes, dcubed, kvn --- src/hotspot/share/code/nmethod.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index 2f4a56e5e6c..38a94dd410f 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -1116,7 +1116,9 @@ bool nmethod::can_convert_to_zombie() { // not_entrant. However, with concurrent code cache unloading, the state // might have moved on to unloaded if it is_unloading(), due to racing // concurrent GC threads. - assert(is_not_entrant() || is_unloading(), "must be a non-entrant method"); + assert(is_not_entrant() || is_unloading() || + !Thread::current()->is_Code_cache_sweeper_thread(), + "must be a non-entrant method if called from sweeper"); // Since the nmethod sweeper only does partial sweep the sweeper's traversal // count can be greater than the stack traversal count before it hits the