RFR: 8355236: AOT Assembly crash with unregistered class and -Xlog:cds+resolve=trace

Aleksey Shipilev shade at openjdk.org
Thu May 22 05:35:38 UTC 2025


On Sun, 11 May 2025 05:04:14 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> Please review this small bug fix. When running  `java -XX:AOTMode=create -Xlog:cds+resolve=trace ...`, we are not handling unregistered classes classes in the `get_type()`, which is called only when printing log messages.

src/hotspot/share/oops/constantPool.cpp line 491:

> 489:       // unregistered classes by calling SystemDictionaryShared::add_unregistered_class(). Such
> 490:       // classes are not actually loaded so they don't have a class_loader_data.
> 491:       precond(src_ik->is_shared_unregistered_class());

So for this printing, why not just check `src_ik->is_shared_unregistered_class()`? It sounds straight-forward that unregistered classes are printed as `unreg`?

test/hotspot/jtreg/runtime/cds/appcds/aotCache/ExcludedClasses.java line 29:

> 27:  * @summary Test how various AOT optimizations handle classes that are excluded from the AOT cache.
> 28:  * @requires vm.cds.write.archived.java.heap
> 29:  * @comment work around JDK-8345635

This `@comment` still valid, or?

test/hotspot/jtreg/runtime/cds/appcds/aotCache/ExcludedClasses.java line 64:

> 62: 
> 63:     public static void main(String[] args) throws Exception {
> 64:         {

Braces are redundant here.

test/hotspot/jtreg/runtime/cds/appcds/aotCache/ExcludedClasses.java line 72:

> 70:     static class Tester extends CDSAppTester {
> 71:         public Tester() {
> 72:             super(mainClass);;

Suggestion:

            super(mainClass);

test/hotspot/jtreg/runtime/cds/appcds/aotCache/ExcludedClasses.java line 111:

> 109:         // to the final image. See ClassPrelinker::record_unregistered_klasses().
> 110:         custInstance = initFromCustomLoader();
> 111:         custArrayInstance = java.lang.reflect.Array.newInstance(custInstance.getClass(), 0);

Want to `import java.lang.reflect.Array` instead?

test/hotspot/jtreg/runtime/cds/appcds/aotCache/ExcludedClasses.java line 200:

> 198:                 doit(() -> {
> 199:                         counter ++;
> 200:                     });

Suggestion:

                doit(() -> counter++);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25171#discussion_r2084827523
PR Review Comment: https://git.openjdk.org/jdk/pull/25171#discussion_r2084828828
PR Review Comment: https://git.openjdk.org/jdk/pull/25171#discussion_r2084829682
PR Review Comment: https://git.openjdk.org/jdk/pull/25171#discussion_r2084829842
PR Review Comment: https://git.openjdk.org/jdk/pull/25171#discussion_r2084831155
PR Review Comment: https://git.openjdk.org/jdk/pull/25171#discussion_r2084839148


More information about the hotspot-dev mailing list