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

Aleksey Shipilev shade at openjdk.java.net
Thu Oct 29 07:52:43 UTC 2020


On Wed, 28 Oct 2020 21:53:11 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> In fact, maybe just inline this literal down in `vm_exit_during_initialization` invocation.
>
> 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)

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

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


More information about the shenandoah-dev mailing list