RFR: 8255416: Investigate err_msg to detect unnecessary uses [v2]

Anton Kozlov akozlov at openjdk.java.net
Thu Oct 29 08:20:45 UTC 2020


On Thu, 29 Oct 2020 07:49:21 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Of course it should align to the left, like in the rest of hotspot. Thanks for noticing!
>> 
>> As for inlining of the message, there are pros and cons. The arguments should be aligned, so it would become
>>   do {                                                                      \
>>     if (!(name)) {                                                          \
>>       vm_exit_during_initialization("Error", msg);                          \
>>                                     "GC mode needs -XX:+" #name " to work correctly"; \
>>     }                                                                       \
>>   } while (0)
>> 
>> (not pretty at all, you see).
>> 
>> After that, there is an option to split the string into multiple lines in attempt to shrink the length, but then the line would become ungreppable (much bigger evil).
>> 
>> Among options, I decided to respect intention and style of original author, who introduced a variable for err_msg, which is unusual and should have some valid rationale behind, like the one above.
>
> I _am_ the author of those `SHENANDOAH_CHECK_FLAG_SET` blocks ;)
> 
> This should be fine:
> 
> do {                                                     \
>   if (!(name)) {                                         \
>     vm_exit_during_initialization("Error",               \
>       "GC mode needs -XX:+" #name " to work correctly"); \
>   }                                                      \
> } while (0)

OK, if you're OK with that. But let's introduce some consistency with e.g. https://github.com/openjdk/jdk/blob/a804c6a6/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp#L420 and use 8 spaces for the argument indentation

  do {                                                                      \
    if (!(name)) {                                                          \
      vm_exit_during_initialization("Error",                                \
              "GC mode needs -XX:+" #name " to work correctly");            \
    }                                                                       \
  } while (0)

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

PR: https://git.openjdk.java.net/jdk/pull/905


More information about the shenandoah-dev mailing list