RFR: 8193513: add support for printing a stack trace on class loading [v2]
David Holmes
dholmes at openjdk.org
Wed Jun 21 12:48:05 UTC 2023
On Wed, 21 Jun 2023 06:56:13 GMT, Doug Simon <dnsimon at openjdk.org> wrote:
>> src/hotspot/share/oops/instanceKlass.cpp line 3747:
>>
>>> 3745: stringStream st;
>>> 3746: st.print_cr("Loading %s", external_name());
>>> 3747: JavaThread::current()->print_stack_on(&st);
>>
>> If this is called for a class loaded very early in VM initialization you may not yet have a current thread.
>
> When I use `-XX:TraceClassLoadingCause=*`, it all works which suggests there's always a current thread by the time class loading occurs. That said, I will add a null check just to be sure.
Sorry my mistake, yes we have JavaThread::current() before loading any Java classes - but it won't have an associated threadObj().
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14553#discussion_r1236943707
More information about the hotspot-dev
mailing list