RFR: 8193513: add support for printing a stack trace on class loading [v2]

David Holmes dholmes at openjdk.org
Sun Jul 2 22:36:54 UTC 2023


On Sun, 2 Jul 2023 22:29:16 GMT, David Holmes <dholmes at openjdk.org> wrote:

>>> Also, this is always JavaThread::current() because all the callers have the current JavaThread. No need for the null check or the cast.
>> 
>> Does this mean this existing type check and cast is unnecessary: https://github.com/openjdk/jdk/blob/e8ff74c7e84ec2440a51fee1b4c45e87332807a0/src/hotspot/share/oops/instanceKlass.cpp#L3821-L3823
>
> Yes. I originally raised the possibility of the current thread not being set yet, but then when I checked it would always be set. But you chose to to add in the check "just in case".

> This way, you don't need to repeat the class name, which is already printed by -Xlog:class+load

No this is bad form IMO. It only works if the person enabling logging knows that these two have to be specified together - and there is nothing that actually documents what the different log tags do.

Using multi-level tags is tricky to get right. If you assume they are dependent then specifying one without the other leads to strange looking output because bits are missing. But if you specify both, or use wildcards, you get repetition. This problem arises when you try to use a tag as a "level of detail" rather than as a classification.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14553#discussion_r1249847278


More information about the hotspot-dev mailing list