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

Doug Simon dnsimon at openjdk.org
Wed Jun 21 07:05:08 UTC 2023


On Wed, 21 Jun 2023 05:52:47 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Doug Simon has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
>> 
>>   added TraceClassLoadingCause flag
>
> src/hotspot/share/oops/instanceKlass.cpp line 3748:
> 
>> 3746:     st.print_cr("Loading %s", external_name());
>> 3747:     JavaThread::current()->print_stack_on(&st);
>> 3748:     tty->print_raw(st.as_string());
> 
> This should be integrated with the UL below. When logging is enabled dump the stacktrace from the stringStream to the UL stream - probably at debug, or even trace, level. You need the diagnostic flag to set the filter, but it should still be controlled by the UL settings IMO.

I assume you mean make the feature require `-Xlog:class+load` in addition? I had that at first but it adds a lot of noise when one is only interested in certain classes as it now shows a UL line for every class loaded, including those not matched by the filter.
I think this is such niche functionality, it's better to keep it separate from `-Xlog:class+load`.

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

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


More information about the hotspot-dev mailing list