On Wed, 24 Mar 2021 15:35:55 GMT, Yumin Qi <mi...@openjdk.org> wrote:

>> Hi, Please review
>> 
>>   Added jcmd option for dumping CDS archive during application runtime. 
>> Before this change, user has to dump shared archive in two steps: first run 
>> application with
>>   `java -XX:DumpLoadedClassList=<classlist> .... `  
>>  to collect shareable class names and saved in file `<classlist>` , then 
>>   `java -Xshare:dump -XX:SharedClassListFile=<classlist> 
>> -XX:SharedArchiveFile=<archivefile> ...`
>>   With this change, user can use jcmd to dump CDS without going through 
>> above steps. Also user can choose a moment during the app runtime  to dump 
>> an archive.
>>    The bug is associated with the CSR: 
>> https://bugs.openjdk.java.net/browse/JDK-8259798 which has been approved.
>>    New added jcmd option:
>>    `jcmd <pid or AppName> VM.cds static_dump <filename>`
>>    or
>>     `jcmd <pid or AppName> VM.cds dynamic_dump <filename>`
>>   To dump dynamic archive, requires start app with newly added flag 
>> `-XX:+RecordDynamicDumpInfo`, with this flag, some information related to 
>> dynamic dump like loader constraints will be recorded. Note the dumping 
>> process changed some object memory locations so for dumping dynamic archive, 
>> can only done once for a running app. For static dump, user can dump 
>> multiple times against same process. 
>>    The file name is optional, if the file name is not supplied, the file 
>> name will take format of `java_pid<number>_static.jsa` or 
>> `java_pid<number>_dynamic.jsa` for static and dynamic respectively. The 
>> `<number>` is the application process ID.
>> 
>>   Tests: tier1,tier2,tier3,tier4
>> 
>> Thanks
>> Yumin
>
> Yumin Qi has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Remove redundant check for if a class is shareable

src/hotspot/share/oops/instanceKlass.cpp line 4269:

> 4267:         }
> 4268: 
> 4269:         if (class_loader == NULL && 
> ClassLoader::contains_append_entry(stream->source())) {

Since the above has been removed, I think the 
`ClassLoader::contains_append_entry()` function can be removed too.

test/hotspot/jtreg/runtime/cds/appcds/jcmd/JCmdTest.java line 59:

> 57: public class JCmdTest {
> 58:     static final String TEST_CLASS[] = {"LingeredTestApp", 
> "jdk/test/lib/apps/LingeredApp"};
> 59:     static final String TEST_JAR   = "test.jar";

`TEST_JAR` is unused.

test/hotspot/jtreg/runtime/cds/appcds/jcmd/JCmdTest.java line 168:

> 166:          "-XX:ArchiveClassesAtExit=tmp.jsa",
> 167:          "-Xshare:auto",
> 168:          "-Xshare:on"};

The `excludeFlags` doesn't match the ones in CDS.java.

226     private static String[] excludeFlags = {
227          "-XX:DumpLoadedClassList=",
228          "-XX:+DumpSharedSpaces",
229          "-XX:+DynamicDumpSharedSpaces",
230          "-XX:+RecordDynamicDumpInfo",
231          "-Xshare:",
232          "-XX:SharedClassListFile=",
233          "-XX:SharedArchiveFile=",
234          "-XX:ArchiveClassesAtExit=",
235          "-XX:+UseSharedSpaces",
236          "-XX:+RequireSharedSpaces"};

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

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

Reply via email to