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

Alex Menkov amenkov at openjdk.java.net
Mon Feb 14 09:22:17 UTC 2022


On Mon, 14 Feb 2022 05:02:34 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> 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?

This comment explains why we call ClassLoaderDataGraph::classes_do(do_class_dump) and then Universe::basic_type_classes_do(&do_basic_type_array_class_dump).

Bottom klass is 1-dimensional type.
For example for [[LObject; element type is [lObject;, and bottom klass is LObject;
Looked at the code and see that ObjAyyaKlass actually contains link to it - see ObjArrayKlass::bottom_klass(), so I can update do_class_dump to use it.

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

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


More information about the hotspot-runtime-dev mailing list