From 1a115f9763a4d4e73b2e1727b4fb6cdf8b3685d9 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Wed, 17 Jul 2019 08:33:38 -0400 Subject: [PATCH] 8227755: Need more than 2 distinct CodeCache unloading cycles Reviewed-by: eosterlund, rkennke --- src/hotspot/share/code/codeCache.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp index 22c77661443..ccf73cb51b5 100644 --- a/src/hotspot/share/code/codeCache.cpp +++ b/src/hotspot/share/code/codeCache.cpp @@ -771,9 +771,10 @@ void CodeCache::purge_exception_caches() { uint8_t CodeCache::_unloading_cycle = 1; void CodeCache::increment_unloading_cycle() { - if (_unloading_cycle == 1) { - _unloading_cycle = 2; - } else { + // 2-bit value (see IsUnloadingState in nmethod.cpp for details) + // 0 is reserved for new methods. + _unloading_cycle = (_unloading_cycle + 1) % 4; + if (_unloading_cycle == 0) { _unloading_cycle = 1; } }