8203843: BasicParState::default_estimated_thread_count(false) can return 0 in gtest
authorkbarrett
Tue, 29 May 2018 16:02:23 -0400
changeset 50298 188a87cbfac3
parent 50297 580744d900c8
child 50299 896486c6e357
8203843: BasicParState::default_estimated_thread_count(false) can return 0 in gtest Summary: Ensure minimum estimated thread count is 1. Reviewed-by: tschatzl, stuefe, rehn
src/hotspot/share/gc/shared/oopStorage.cpp
--- a/src/hotspot/share/gc/shared/oopStorage.cpp	Tue May 29 15:50:27 2018 -0400
+++ b/src/hotspot/share/gc/shared/oopStorage.cpp	Tue May 29 16:02:23 2018 -0400
@@ -907,7 +907,8 @@
 // Parallel iteration support
 
 uint OopStorage::BasicParState::default_estimated_thread_count(bool concurrent) {
-  return concurrent ? ConcGCThreads : ParallelGCThreads;
+  uint configured = concurrent ? ConcGCThreads : ParallelGCThreads;
+  return MAX2(1u, configured);  // Never estimate zero threads.
 }
 
 OopStorage::BasicParState::BasicParState(const OopStorage* storage,