RFR: 8193513: add support for printing a stack trace on class loading [v7]
Ioi Lam
iklam at openjdk.org
Fri Jul 7 17:02:02 UTC 2023
On Fri, 7 Jul 2023 16:27:30 GMT, Doug Simon <dnsimon at openjdk.org> wrote:
>> Even if they are independent, relevant output should be grouped together. Currently, if we specify `-Xlog:class+load*=debug`, the output would look like this:
>>
>>
>> Java stack when loading java.util.concurrent.ConcurrentHashMap$ValuesView
>> ...
>> [many many lines of output]
>> ...
>> java.util.concurrent.ConcurrentHashMap$ValuesView source: shared objects file
>> klass: 0x000000080033a0f8 super: 0x000000080033a320 loader: [loader data: 0x00007faa34113890 of 'bootstrap']
>>
>> This makes it difficult to see all the information of this class at a glance.
>
> If I'm interested in class load cause logging of `java.util.concurrent.ConcurrentHashMap$ValuesView`, I don't particularly care about the `class+load` output for that class.
> Note that some of the `class+load+placeholders` output is going to be shown after `class+load+cause` anyway.
> That said, I've pushed a commit to implement your request: d84186840b874ba74e270f6ac51cc0ed71d655f5
It's not about personal preferences. We should organize the logging so that they are grouped logically. That way, they can be more useful for others who might use the log tags in a different way.
The `class+load+placeholders` logs are for dealing with parallel loading of the same class by different threads. This happens before the class is actually loaded, so those logs cannot appear after the main `class+load` tag.
***
To minimize the delta in this PR, and limit code indentation, it's better to move the old code to a new function, so you have something like:
void InstanceKlass::print_class_load_logging(ClassLoaderData* loader_data,
const ModuleEntry* module_entry,
const ClassFileStream* cfs) const {
if (ClassListWriter::is_enabled()) {
ClassListWriter::write(this, cfs);
}
>>> add
print_class_load_helper();
print_class_load_cause_logging();
}
void InstanceKlass::print_class_load_helper(ClassLoaderData* loader_data,
const ModuleEntry* module_entry,
const ClassFileStream* cfs) const {
<<< end
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14553#discussion_r1256138240
More information about the hotspot-dev
mailing list