RFR: 8315242: G1: Fix -Wconversion warnings around GCDrainStackTargetSize

Thomas Schatzl tschatzl at openjdk.org
Wed Aug 30 08:38:14 UTC 2023


On Tue, 29 Aug 2023 16:15:44 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Use more precise type and range for `GCDrainStackTargetSize`.
> 
> The change to `TASKQUEUE_SIZE` is there, because they are used in the same `MIN2`. (All uses expect `TASKQUEUE_SIZE` to be `uint` as well.)

Changes requested by tschatzl (Reviewer).

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 2322:

> 2320:   uint target_size;
> 2321:   if (partially) {
> 2322:     target_size = MIN2(_task_queue->max_elems()/3, GCDrainStackTargetSize);

Suggestion:

    target_size = MIN2(_task_queue->max_elems() / 3, GCDrainStackTargetSize);

src/hotspot/share/gc/shared/gc_globals.hpp line 687:

> 685:           "Delay between expansion and allocation (in milliseconds)")       \
> 686:                                                                             \
> 687:   product(uint, GCDrainStackTargetSize, 64,                                \

Suggestion:

  product(uint, GCDrainStackTargetSize, 64,                                 \

src/hotspot/share/gc/shared/gc_globals.hpp line 690:

> 688:           "Number of entries we will try to leave on the stack "            \
> 689:           "during parallel gc")                                             \
> 690:           range(0, (max_juint-1)/2)                                               \

Suggestion:

          range(0, (UINT_MAX - 1) / 2)                                         \

Avoid using `juint_*` in code not interfacing java. Also the `` is indented improperly, and even in above suggestion it might still be.

-------------

PR Review: https://git.openjdk.org/jdk/pull/15472#pullrequestreview-1602181980
PR Review Comment: https://git.openjdk.org/jdk/pull/15472#discussion_r1309898852
PR Review Comment: https://git.openjdk.org/jdk/pull/15472#discussion_r1309897911
PR Review Comment: https://git.openjdk.org/jdk/pull/15472#discussion_r1309896479


More information about the hotspot-dev mailing list