RFR: 8265602: -XX:DumpLoadedClassList should support custom loaders

Calvin Cheung ccheung at openjdk.java.net
Wed Aug 4 01:48:32 UTC 2021


On Mon, 2 Aug 2021 06:39:37 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> Some applications load a lot of classes using custom loaders. This PR improves the start-up performance of these apps when using a "static" CDS archive:
> 
> Here are performance numbers for the Eclipse IDE:
> 
> 
> Static Archive Before: 7.31 sec (classlist does not include custom loader classes)
> Static Archive After:  6.49 sec (classlist includes custom loader classes)
> Dynamic Archive:       6.62 sec

Looks good. Just a few minor comments.

src/hotspot/share/cds/archiveUtils.cpp line 336:

> 334:   if (ClassListWriter::is_enabled()) {
> 335:     if (SystemDictionaryShared::is_supported_invokedynamic(bootstrap_specifier)) {
> 336:       ResourceMark rm(THREAD);

Line 336 could be moved after line 338.

src/hotspot/share/cds/classListWriter.cpp line 54:

> 52: 
> 53: void ClassListWriter::write(const InstanceKlass* k, const ClassFileStream* cfs) {
> 54:   assert(is_enabled(), "must be");

Should `assert_locked()` be added here?

src/hotspot/share/cds/classListWriter.hpp line 63:

> 61:     return false;
> 62:   }
> 63: #endif

Please add `// INCLUDE_CDS` after `endif`.

test/hotspot/jtreg/runtime/cds/appcds/customLoader/test-classes/CustomLoadee4WithLambda.java line 30:

> 28:                 System.out.println("Hello inside a Lambda expression");
> 29:             });
> 30:     }

We have a similar class in dynamicArchive/test-classes/LambHello.java.
To avoid changes in existing tests, maybe you can just add a `test()` method there.

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

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


More information about the hotspot-runtime-dev mailing list