< prev index next >

src/hotspot/share/code/codeCache.cpp

Print this page
rev 51888 : 8177899: Tests fail due to code cache exhaustion on machines with many cores
Summary: Implemented upper limit on CICompilerCount based on code cache size.
Reviewed-by: kvn, mdoerr


 257     }
 258     if (diff_size != 0) {
 259       // Use non-nmethod code heap for remaining space requirements
 260       assert(!non_nmethod_set && ((intx)non_nmethod_size + diff_size) > 0, "sanity");
 261       non_nmethod_size += diff_size;
 262     }
 263   }
 264 
 265   // We do not need the profiled CodeHeap, use all space for the non-profiled CodeHeap
 266   if (!heap_available(CodeBlobType::MethodProfiled)) {
 267     non_profiled_size += profiled_size;
 268     profiled_size = 0;
 269   }
 270   // We do not need the non-profiled CodeHeap, use all space for the non-nmethod CodeHeap
 271   if (!heap_available(CodeBlobType::MethodNonProfiled)) {
 272     non_nmethod_size += non_profiled_size;
 273     non_profiled_size = 0;
 274   }
 275   // Make sure we have enough space for VM internal code
 276   uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);
 277   if (non_nmethod_size < (min_code_cache_size + code_buffers_size)) {
 278     vm_exit_during_initialization(err_msg(
 279         "Not enough space in non-nmethod code heap to run VM: " SIZE_FORMAT "K < " SIZE_FORMAT "K",
 280         non_nmethod_size/K, (min_code_cache_size + code_buffers_size)/K));
 281   }
 282 
 283   // Verify sizes and update flag values
 284   assert(non_profiled_size + profiled_size + non_nmethod_size == cache_size, "Invalid code heap sizes");
 285   FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, non_nmethod_size);
 286   FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, profiled_size);
 287   FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, non_profiled_size);
 288 
 289   // If large page support is enabled, align code heaps according to large
 290   // page size to make sure that code cache is covered by large pages.
 291   const size_t alignment = MAX2(page_size(false), (size_t) os::vm_allocation_granularity());
 292   non_nmethod_size = align_up(non_nmethod_size, alignment);
 293   profiled_size    = align_down(profiled_size, alignment);
 294 
 295   // Reserve one continuous chunk of memory for CodeHeaps and split it into
 296   // parts for the individual heaps. The memory layout looks like this:
 297   // ---------- high -----------
 298   //    Non-profiled nmethods
 299   //      Profiled nmethods
 300   //         Non-nmethods




 257     }
 258     if (diff_size != 0) {
 259       // Use non-nmethod code heap for remaining space requirements
 260       assert(!non_nmethod_set && ((intx)non_nmethod_size + diff_size) > 0, "sanity");
 261       non_nmethod_size += diff_size;
 262     }
 263   }
 264 
 265   // We do not need the profiled CodeHeap, use all space for the non-profiled CodeHeap
 266   if (!heap_available(CodeBlobType::MethodProfiled)) {
 267     non_profiled_size += profiled_size;
 268     profiled_size = 0;
 269   }
 270   // We do not need the non-profiled CodeHeap, use all space for the non-nmethod CodeHeap
 271   if (!heap_available(CodeBlobType::MethodNonProfiled)) {
 272     non_nmethod_size += non_profiled_size;
 273     non_profiled_size = 0;
 274   }
 275   // Make sure we have enough space for VM internal code
 276   uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);
 277   if (non_nmethod_size < min_code_cache_size) {
 278     vm_exit_during_initialization(err_msg(
 279         "Not enough space in non-nmethod code heap to run VM: " SIZE_FORMAT "K < " SIZE_FORMAT "K",
 280         non_nmethod_size/K, min_code_cache_size/K));
 281   }
 282 
 283   // Verify sizes and update flag values
 284   assert(non_profiled_size + profiled_size + non_nmethod_size == cache_size, "Invalid code heap sizes");
 285   FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, non_nmethod_size);
 286   FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, profiled_size);
 287   FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, non_profiled_size);
 288 
 289   // If large page support is enabled, align code heaps according to large
 290   // page size to make sure that code cache is covered by large pages.
 291   const size_t alignment = MAX2(page_size(false), (size_t) os::vm_allocation_granularity());
 292   non_nmethod_size = align_up(non_nmethod_size, alignment);
 293   profiled_size    = align_down(profiled_size, alignment);
 294 
 295   // Reserve one continuous chunk of memory for CodeHeaps and split it into
 296   // parts for the individual heaps. The memory layout looks like this:
 297   // ---------- high -----------
 298   //    Non-profiled nmethods
 299   //      Profiled nmethods
 300   //         Non-nmethods


< prev index next >