RFR: 8274986: max code printed in hs-err logs should be configurable [v5]

Doug Simon dnsimon at openjdk.java.net
Tue Oct 12 19:58:57 UTC 2021


On Tue, 12 Oct 2021 16:14:27 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> In general I agree but in error reporting code I get extra defensive plus the defensive code is small and not on a hot path.
>> That said, I won't object to it being undone in a subsequent PR.
>
> I thought the point of MIN2 here is to handle ErrorLogPrintCodeLimit < max. IMHO ErrorLogPrintCodeLimit > max would be just an assert-worthy error, since as David wrote flag values should not be changed after initialization.

The point is to ensure that we don't run off the end of the stack allocated `printed` array in the (granted, unlikely) case that `ErrorLogPrintCodeLimit` is (accidentally) updated after arg parsing .
I'm not sure an assert is the best thing as it would cause error reporting to recurse.
Maybe I was being too defensive but I figured the overhead is negligible so why not be ultra-safe.

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

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


More information about the hotspot-dev mailing list