RFR: 8267189: Remove duplicated unregistered classes from dynamic archive

Yumin Qi minqi at openjdk.java.net
Thu Jun 17 18:28:35 UTC 2021


On Thu, 17 Jun 2021 04:03:09 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> In the CDS archive, "unregistered" classes are those to be loaded by custom loaders.
> 
> When doing a CDS dynamic dump (with -XX:ArchiveClassesAtExit=foo.jsa), a class of the same name may be loaded by several custom class loaders. Currently we write all of these unregistered classes into the archive. However, only one copy of them will be usable at runtime.
> 
> For size saving, we should avoid writing such duplicated classes into the archive.
> 
> (Note that this problem does not affect the CDS static dump, which is driven by a classlist file. We already disallow duplicate unregistered classes in the classlist.)
> 
> Testing: mach5 tiers 1-4. Also tested locally with Eclipse IDE.

src/hotspot/share/classfile/systemDictionaryShared.cpp line 1511:

> 1509: class UnregisteredClassesDuplicationChecker : StackObj {
> 1510:   GrowableArray<InstanceKlass*> _list;
> 1511:   Thread* _thread;

seems _thread only used at line 1542, could remove the field and use Thread::current() in the site.

src/hotspot/share/classfile/systemDictionaryShared.cpp line 1529:

> 1527:       return intx(loader_a) - intx(loader_b);
> 1528:     } else {
> 1529:       return intx(a[0]) -intx(b[0]);

space after "-"

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

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


More information about the hotspot-runtime-dev mailing list