From cb730775e93141732b11872d50265d4db400cd29 Mon Sep 17 00:00:00 2001 From: Christian Despres Date: Tue, 19 Dec 2023 20:07:14 +0000 Subject: [PATCH] Shut down ROM class cache if purging all clients The JITServer expects that the shared ROM class cache will have been initialized only if the _clientSessionMap is empty. Fixes: #18631 Signed-off-by: Christian Despres --- runtime/compiler/runtime/JITClientSession.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/runtime/compiler/runtime/JITClientSession.cpp b/runtime/compiler/runtime/JITClientSession.cpp index 6e1f920b259..eeabaf9ecd5 100644 --- a/runtime/compiler/runtime/JITClientSession.cpp +++ b/runtime/compiler/runtime/JITClientSession.cpp @@ -1241,6 +1241,13 @@ ClientSessionHT::purgeOldDataIfNeeded() _clientSessionMap.erase(iter); // delete the mapping from the hashtable } } + // If all the clients were deleted, shut down the shared ROMClass cache + if (_clientSessionMap.empty()) + { + if (auto cache = TR::CompilationInfo::get()->getJITServerSharedROMClassCache()) + cache->shutdown(); + } + _timeOfLastPurge = crtTime; // JITServer TODO: keep stats on how many elements were purged