[lworld] Integrated: 8285763: Implement new approach to dump inlined objects
Alex Menkov
amenkov at openjdk.java.net
Thu Apr 28 21:22:15 UTC 2022
On Wed, 27 Apr 2022 22:15:18 GMT, Alex Menkov <amenkov at openjdk.org> wrote:
> Implements new way to dump inlined objects.
>
> Hprof file format changes:
> -- dump inlined fields in the holder object by introducing synthetic fields to hold the primitive fields of the inlined type.
> HPROF_GC_CLASS_DUMP records describe the synthetic fields.
> HPROF_GC_INSTANCE_DUMP records dump inlined object as fields of the holder object.
> Example:
> primitive class P1 {
> byte b1;
> }
> primitive class P2 {
> P1 p1;
> int i1;
> }
> class Holder {
> P1 p1;
> P2 p2;
> }
>
> HPROF_GC_CLASS_DUMP record for Holder class does not contain descriptions for p1 and p2 fields, but instead has:
> p1.b1: byte;
> p2.p1.b1: byte;
> p2.i1: int;
>
> -- new record type is added to describe class with inlined fields:
> HPROF_INLINED_FIELDS
> The record contains HPROF_CLASS_WITH_INLINED_FIELDS subrecords with the following format:
> id - class ID (dumped as HPROF_GC_CLASS_DUMP)
> u2 - number of instance inlined fields (not including super)
>
> in the example above 2 (p1.b1, p2.p1.b1, p2.i1)
>
> [u2 - inlined field index (zero-based)
> u2 - synthetic field count
> id - original field name (dumped as HPROF_UTF8)
> id]* - inlined field class ID (dumped by HPROF_GC_CLASS_DUMP)
>
> in the example above there are 2 elements:
> [0, 1, "p1", P1 HPROF_GC_CLASS_DUMP record]
> [1, 2, "p2", P2 HPROF_GC_CLASS_DUMP record]
>
> This records allows new hprof parser tools to restore original fields of the object;
> Old tools will see synthetic fields which makes possible manual research of the dump.
>
> -- flat arrays are dumped as HPROF_GC_PRIM_ARRAY_DUMP subrecords (may be byte/short/int array)
>
> -- new record type is added to describe flat arrays:
> HPROF_FLAT_ARRAYS
> The record contains array of HPROF_FLAT_ARRAY subrecords:
> id - array object ID (dumped as HPROF_GC_PRIM_ARRAY_DUMP)
> id - element class ID (dumped by HPROF_GC_CLASS_DUMP)
>
> This records allows new hprof parsers to restore original type of the flat arrays;
> Unfortunately old parsers can't extract much information from the array dump.
This pull request has now been integrated.
Changeset: 04181f90
Author: Alex Menkov <amenkov at openjdk.org>
URL: https://git.openjdk.java.net/valhalla/commit/04181f90aec4b5ffb738944e22bb6b78203b1567
Stats: 1228 lines in 9 files changed: 882 ins; 156 del; 190 mod
8285763: Implement new approach to dump inlined objects
-------------
PR: https://git.openjdk.java.net/valhalla/pull/686
More information about the valhalla-dev
mailing list