RFR: 8261608: Move common CDS archive building code to archiveBuilder.cpp

Ioi Lam iklam at openjdk.java.net
Thu Feb 11 23:51:48 UTC 2021


On Thu, 11 Feb 2021 23:41:34 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> This is a follow-up to https://git.openjdk.java.net/jdk/pull/2296:
> 
> - Move common code for writing the CDS archive from metaspaceShared.cpp to archiveBuilder.cpp
> 
> - Data structures related to dumping were haphazardly organized in several classes (e.g., `DumpRegions`). We needed various APIs to access them across classes. These should be consolidated in archiveBuilder.cpp and the API should be cleaned up
> 
> - Detailed stats (`DumpAllocStats::print_stats`) were available only for static dump. Refactor the code so they are also printed for dynamic dump

Example of detailed stats that are now available for dynamic dump:

[info ][cds] Shared file region (mc )  0:       24 bytes, addr 0x0000000800c30000 file offset 0x00001000 crc 0xa3c1ca20
[info ][cds] Shared file region (rw )  1:     1016 bytes, addr 0x0000000800c31000 file offset 0x00002000 crc 0xb7970a35
[info ][cds] Shared file region (ro )  2:     1632 bytes, addr 0x0000000800c32000 file offset 0x00003000 crc 0x4edeacfa
[info ][cds] Shared file region (bm )  3:      160 bytes, addr 0x0000000000000000 file offset 0x00004000 crc 0x27cf167e
[debug][cds] mc  space:        24 [  0.1% of total] out of      4096 bytes [  0.6% used] at 0x0000000800c30000
[debug][cds] rw  space:      1016 [  6.2% of total] out of      4096 bytes [ 24.8% used] at 0x0000000800c31000
[debug][cds] ro  space:      1632 [ 10.0% of total] out of      4096 bytes [ 39.8% used] at 0x0000000800c32000
[debug][cds] bm  space:       160 [  1.0% of total] out of       160 bytes [100.0% used]
[debug][cds] total    :      2832 [100.0% of total] out of     16384 bytes [ 17.3% used]
[debug][cds] Detailed metadata info (excluding heap regions; rw stats include mc regions):
[debug][cds]                         ro_cnt   ro_bytes     % |   rw_cnt   rw_bytes     % |  all_cnt  all_bytes     %
[debug][cds] --------------------+---------------------------+---------------------------+--------------------------
[debug][cds] Class               :        0          0   0.0 |        1        544  52.3 |        1        544  20.4
[debug][cds] Symbol              :        3         64   3.9 |        0          0   0.0 |        3         64   2.4
[debug][cds] TypeArrayU1         :        3        168  10.3 |        1         40   3.8 |        4        208   7.8
[debug][cds] TypeArrayU2         :        2         16   1.0 |        0          0   0.0 |        2         16   0.6
[debug][cds] TypeArrayU4         :        1         16   1.0 |        0          0   0.0 |        1         16   0.6
[debug][cds] TypeArrayU8         :        2        672  41.2 |        1         40   3.8 |        3        712  26.6
[debug][cds] TypeArrayOther      :        0          0   0.0 |        0          0   0.0 |        0          0   0.0
[debug][cds] Method              :        0          0   0.0 |        2        192  18.5 |        2        192   7.2
[debug][cds] ConstMethod         :        2        144   8.8 |        0          0   0.0 |        2        144   5.4
[debug][cds] MethodData          :        0          0   0.0 |        0          0   0.0 |        0          0   0.0
[debug][cds] ConstantPool        :        1        312  19.1 |        0          0   0.0 |        1        312  11.7
[debug][cds] ConstantPoolCache   :        0          0   0.0 |        1        136  13.1 |        1        136   5.1
[debug][cds] Annotations         :        0          0   0.0 |        0          0   0.0 |        0          0   0.0
[debug][cds] MethodCounters      :        0          0   0.0 |        1         64   6.2 |        1         64   2.4
[debug][cds] RecordComponent     :        0          0   0.0 |        0          0   0.0 |        0          0   0.0
[debug][cds] SymbolHashentry     :        3         32   2.0 |        0          0   0.0 |        3         32   1.2
[debug][cds] SymbolBucket        :        2         16   1.0 |        0          0   0.0 |        2         16   0.6
[debug][cds] StringHashentry     :        0          0   0.0 |        0          0   0.0 |        0          0   0.0
[debug][cds] StringBucket        :        0          0   0.0 |        0          0   0.0 |        0          0   0.0
[debug][cds] ModulesNatives      :        0          0   0.0 |        0          0   0.0 |        0          0   0.0
[debug][cds] Other               :        0        192  11.8 |        0         24   2.3 |        0        216   8.1
[debug][cds] --------------------+---------------------------+---------------------------+--------------------------
[debug][cds] Total               :       19       1632 100.0 |        7       1040 100.0 |       26       2672 100.0

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

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


More information about the hotspot-dev mailing list