RFR: 8266217: ZGC: Improve the -Xlog:gc+init output for NUMA
Jie Fu
jiefu at openjdk.java.net
Thu Apr 29 07:43:53 UTC 2021
On Thu, 29 Apr 2021 07:24:12 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
>> src/hotspot/share/gc/z/zNUMA.cpp line 41:
>>
>>> 39:
>>> 40: const char* ZNUMA::to_string() {
>>> 41: switch (_state) {
>>
>> Maybe consider to have a `static const char* strings[] = {"Enabled", "Unsupported", "Disabled" };` (in the correct order) constant here and index by the array (and maybe an assert to catch out of bounds access if/when adds an entry and forgets to update this list).
>> This is typically more readable then a long switch case like this, but idk other people's opinions.
>
> And of course it's not a particular important suggestion, feel free to ignore.
> Maybe consider to have a `static const char* strings[] = {"Enabled", "Unsupported", "Disabled" };` (in the correct order) constant here and index by the array (and maybe an assert to catch out of bounds access if/when adds an entry and forgets to update this list).
> This is typically more readable then a long switch case like this, but idk other people's opinions.
Thanks @tschatzl for your review.
I didn't think of this skill before.
Thanks for your teaching.
Let's just keep it this time since there are only 3 cases for `_state`.
And I'd like to use your style of code next time.
Thanks.
Best regards,
Jie
-------------
PR: https://git.openjdk.java.net/jdk/pull/3778
More information about the hotspot-gc-dev
mailing list