RFR: 8259070: Add jcmd option to dump CDS [v4]

Yumin Qi minqi at openjdk.java.net
Thu Mar 18 03:34:57 UTC 2021


On Fri, 26 Feb 2021 22:01:50 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> Yumin Qi has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>> 
>>  - Fix filter more flags to exclude in static dump, add more test cases
>>  - Merge branch 'master' into jdk-8259070
>>  - Fix white space in CDS.java
>>  - Add function CDS.dumpSharedArchive in java to dump shared archive
>>  - 8259070: Add jcmd option to dump CDS
>
> src/hotspot/share/memory/metaspaceShared.cpp line 788:
> 
>> 786:   // The existing file will be overwritten.
>> 787:   char filename[JVM_MAXPATHLEN];
>> 788:   const char* file = file_name;
> 
> Is the variable at line 788 necessary? Could you just pass filename to callees?

New solutions using CDS.java to do the dump.

> src/hotspot/share/memory/metaspaceShared.cpp line 801:
> 
>> 799:         file = filename;
>> 800:       }
>> 801:     }
> 
> This block of code is very similar to lines 813 - 821 below. Maybe factor it into another function?

changed to use java to dump. That will be much simple to deal with string.

> src/hotspot/share/memory/metaspaceShared.cpp line 831:
> 
>> 829:   DumpClassListCLDClosure(fileStream* f) : CLDClosure() { _stream = f; }
>> 830:   ~DumpClassListCLDClosure() {
>> 831:     delete _stream; // The file need close since in child process it will be used.
> 
> Can you clarify the above comment?

Changed to use java to do the dump.

> test/hotspot/jtreg/runtime/cds/appcds/jcmd/JCmdTest.java line 213:
> 
>> 211:         if (!cdsEnabled) {
>> 212:             System.out.println("CDS is not available for this JDK, skip the test.");
>> 213:             return;
> 
> Should throw SkippedException instead.

Fixed

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

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


More information about the hotspot-dev mailing list