RFR: 8281267: VM HeapDumper dumps array classes several times [v2]

Chris Plummer cjplummer at openjdk.java.net
Mon Feb 14 05:06:09 UTC 2022


On Thu, 10 Feb 2022 11:57:25 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

>> src/hotspot/share/services/heapDumper.cpp line 2293:
>> 
>>> 2291:     // Writes HPROF_GC_CLASS_DUMP records
>>> 2292:     // For array classes we need signers and protection domain from their bottom classes
>>> 2293:     // so do_class_dump skips array classes and dumps array classes with corresponding instance class.
>> 
>> I'm having trouble parsing this comment. Can you clarify?
>
> HPROF_GC_CLASS_DUMP records contain references to signers and protection domain objects.
> But this is properties of InstanceKlass, for array classes the properties from their element classes are written (or NULL for arrays of primitive types).
> do_class_dump callback skips array classes:
>   if (k->is_instance_klass()) {
>     DumperSupport::dump_class_and_array_classes(writer(), k);
>   }
> 
> dump_class_and_array_classes dumps the class and then iterate over array classes (k->array_klass_or_null()) and writes records for them (using signer and protection domain from the instance class specified).
> 
> This approach also skips primitive type arrays (they don't have corresponding InstanceKlass) - they are dumped separately.
> 
> I added the comment to explain why do_class_dump goes this tricky way.
> Do you have any suggestions how to rephrase it to make clearer?

Sorry about the delay. I didn't see your response when it came in.

It seems like this comment belongs with do_class_dump(). Putting it here is kind of confusing. Also, what is meant by "bottom class"? Do you mean the element type of the array?

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

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


More information about the serviceability-dev mailing list