RFR: 8311821: Simplify ParallelGCThreadsConstraintFunc after CMS removal
Kim Barrett
kbarrett at openjdk.org
Fri Jul 21 02:47:59 UTC 2023
On Thu, 20 Jul 2023 23:26:51 GMT, Jenny Shivayogi <duke at openjdk.org> wrote:
> Code oddities reported by SonarCloud after CMS removal
> Fix: moving ParallelGCThreadsConstraintFuncParallel to shared code as ParallelGCThreadsConstraintFunc
Could we eliminate the constraint function and instead specify a range for the option?
Using `range(0, INT_MAX)` would reduce the upper bound for collectors other than
ParallelGC, but I doubt anyone would notice :)
Or keep the constraint function if we can also move the check here that the value must be
greater than zero for most (i.e. not SerialGC) collectors. (I think that's in ergo and might
not be movable because of other ergo calculations based on it that might not work for
a value of 0.)
src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp line 56:
> 54: // the flag has been set by the user and so should be checked.
> 55:
> 56: // (earlier ParallelGCThreadConstraintsFuncParallel) replaced after CMS is removed
I don't think we need this comment.
src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp line 61:
> 59: // So can't exceed with "max_jint"
> 60:
> 61: if (UseParallelGC && (value > (uint)max_jint)) {
Throughout this change: s/max_jint/INT_MAX/
src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp line 66:
> 64: "less than or equal to " UINT32_FORMAT " for Parallel GC\n",
> 65: value, max_jint);
> 66: return JVMFlag::VIOLATES_CONSTRAINT;
There is no reason to use UINT32_FORMAT here, and indeed it just clutters things and makes it harder to read
and understand (and could even be wrong on some theoretical platform with ints larger than 32bits).
Just using "%u" for the first, and "%d" for the second is simple and correct.
-------------
Changes requested by kbarrett (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14965#pullrequestreview-1540373717
PR Review Comment: https://git.openjdk.org/jdk/pull/14965#discussion_r1270164926
PR Review Comment: https://git.openjdk.org/jdk/pull/14965#discussion_r1270164838
PR Review Comment: https://git.openjdk.org/jdk/pull/14965#discussion_r1270168258
More information about the hotspot-gc-dev
mailing list