RFR: 8267191: Avoid repeated SystemDictionaryShared::should_be_excluded calls

David Holmes dholmes at openjdk.java.net
Tue May 18 06:48:41 UTC 2021


On Mon, 17 May 2021 17:39:32 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> `SystemDictionaryShared::should_be_excluded` is called during CDS dump time to see if a class should be excluded from the archive. This function calls itself to check super types. As a result, some classes many be checked more than once.
> 
> The repeated calls slows down dumping. Also, If a class is excluded, we will see multiple warning messages like this, which is too verbose and confusing.
> 
> 
> Skipping org/eclipse/osgi/util/NLS: Signed JAR
> Skipping org/eclipse/osgi/util/NLS: Signed JAR
> Skipping org/eclipse/osgi/util/NLS: Signed JAR
> 
> 
> BTW, to make the code a little easier to read, I also changed
> 
> 
>  warn_excluded(k, "Failed verification");
>  return true;
> 
> 
> to
> 
> 
> return  warn_excluded(k, "Failed verification");

Hi Ioi,

These changes seem fine.

A couple of nits below.

Thanks,
David

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

> 1407:   if (k->is_hidden() && !is_registered_lambda_proxy_class(k)) {
> 1408:     ResourceMark rm;
> 1409:     log_debug(cds)("Skipping %s: %s", k->name()->as_C_string(), "Hidden class");

You don't need to feed "Hidden class" to a %s.

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

> 1414:   if (super != NULL && check_for_exclusion(super, NULL)) {
> 1415:     ResourceMark rm;
> 1416:     log_warning(cds)("Skipping %s: super class %s is excluded @%p", k->name()->as_C_string(), super->name()->as_C_string(), super);

Pretty sure we still don't/can't use %p in shared code, but should be INTPTR_FORMAT and use p2i(super)

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

> 1423:     InstanceKlass* intf = interfaces->at(i);
> 1424:     if (check_for_exclusion(intf, NULL)) {
> 1425:       log_warning(cds)("Skipping %s: interface %s is excluded @%p", k->name()->as_C_string(), intf->name()->as_C_string(), intf);

Ditto on %p

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

Marked as reviewed by dholmes (Reviewer).

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


More information about the hotspot-runtime-dev mailing list