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");