From 55af21fdf1d6d53adee4d04726fefbcb5e232e93 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Tue, 10 Jun 2025 04:44:01 +0000 Subject: [PATCH] make jvm exit gracefully --- src/hotspot/share/code/codeCache.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp index 3a5da1d7cd2..d4c04b217b8 100644 --- a/src/hotspot/share/code/codeCache.cpp +++ b/src/hotspot/share/code/codeCache.cpp @@ -1106,6 +1106,9 @@ size_t CodeCache::freelists_length() { void icache_init(); void CodeCache::initialize() { + if (!is_power_of_2(CodeCacheSegmentSize)) { + vm_exit_during_initialization(err_msg("CodeCacheSegmentSize should be a power of 2")); + } assert(CodeCacheSegmentSize >= (uintx)CodeEntryAlignment, "CodeCacheSegmentSize must be large enough to align entry points"); #ifdef COMPILER2 assert(CodeCacheSegmentSize >= (uintx)OptoLoopAlignment, "CodeCacheSegmentSize must be large enough to align inner loops");