From b0353addf2bb649f98db7194a110c2152c0ed58b Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Thu, 31 Aug 2023 09:49:16 +0000 Subject: [PATCH] 8315242: G1: Fix -Wconversion warnings around GCDrainStackTargetSize Reviewed-by: tschatzl, mli --- src/hotspot/share/gc/g1/g1ConcurrentMark.cpp | 4 ++-- src/hotspot/share/gc/parallel/psPromotionManager.cpp | 6 ++---- src/hotspot/share/gc/shared/gc_globals.hpp | 4 ++-- src/hotspot/share/utilities/globalDefinitions.hpp | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index 70badde7307..7dd6ee759be 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -2317,9 +2317,9 @@ void G1CMTask::drain_local_queue(bool partially) { // Decide what the target size is, depending whether we're going to // drain it partially (so that other tasks can steal if they run out // of things to do) or totally (at the very end). - size_t target_size; + uint target_size; if (partially) { - target_size = MIN2((size_t)_task_queue->max_elems()/3, GCDrainStackTargetSize); + target_size = MIN2(_task_queue->max_elems() / 3, GCDrainStackTargetSize); } else { target_size = 0; } diff --git a/src/hotspot/share/gc/parallel/psPromotionManager.cpp b/src/hotspot/share/gc/parallel/psPromotionManager.cpp index 20ee8ec1f2a..4f0b0973e76 100644 --- a/src/hotspot/share/gc/parallel/psPromotionManager.cpp +++ b/src/hotspot/share/gc/parallel/psPromotionManager.cpp @@ -178,15 +178,13 @@ PSPromotionManager::PSPromotionManager() { // We set the old lab's start array. _old_lab.set_start_array(old_gen()->start_array()); - uint queue_size; - queue_size = claimed_stack_depth()->max_elems(); + uint queue_size = claimed_stack_depth()->max_elems(); if (ParallelGCThreads == 1) { _target_stack_size = 0; } else { // don't let the target stack size to be more than 1/4 of the entries - _target_stack_size = (uint) MIN2((uint) GCDrainStackTargetSize, - (uint) (queue_size / 4)); + _target_stack_size = MIN2(GCDrainStackTargetSize, (queue_size / 4)); } _array_chunk_size = ParGCArrayScanChunk; diff --git a/src/hotspot/share/gc/shared/gc_globals.hpp b/src/hotspot/share/gc/shared/gc_globals.hpp index 1a0b1b2c265..d610bae0c18 100644 --- a/src/hotspot/share/gc/shared/gc_globals.hpp +++ b/src/hotspot/share/gc/shared/gc_globals.hpp @@ -684,10 +684,10 @@ develop(uintx, GCExpandToAllocateDelayMillis, 0, \ "Delay between expansion and allocation (in milliseconds)") \ \ - product(uintx, GCDrainStackTargetSize, 64, \ + product(uint, GCDrainStackTargetSize, 64, \ "Number of entries we will try to leave on the stack " \ "during parallel gc") \ - range(0, max_juint) \ + range(0, (UINT_MAX - 1) / 2) \ \ product(uint, GCCardSizeInBytes, 512, \ "Card table entry size (in bytes) for card based collectors") \ diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index 719992de62c..df06622391e 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -1044,7 +1044,7 @@ const int badCodeHeapFreeVal = 0xDD; // value used to zap #define badHeapWord (::badHeapWordVal) // Default TaskQueue size is 16K (32-bit) or 128K (64-bit) -const size_t TASKQUEUE_SIZE = (NOT_LP64(1<<14) LP64_ONLY(1<<17)); +const uint TASKQUEUE_SIZE = (NOT_LP64(1<<14) LP64_ONLY(1<<17)); //---------------------------------------------------------------------------------------------------- // Utility functions for bitfield manipulations