On Fri, 18 Jul 2025 16:43:09 GMT, Calvin Cheung <cche...@openjdk.org> wrote:

>> When `-XX:+AOTClassLinking` is enabled when dumping CDS archives with `java 
>> -Xshare:dump`, we have more stringent restriction of what Java code can be 
>> executed -- if arbitrary Java code is executed, it may produce side effects 
>> that cannot be handled when archiving Java heap objects. This usually leads 
>> to cdsHeapVerifier.cpp reporting suspicious references to static fields that 
>> are not known to be safe.
>> 
>> We already avoid loading Java agents when dumping AOT caches (which are just 
>> enhanced CDS archives with more optimizations), we should do the same thing 
>> for `java -Xshare:dump -XX:+AOTClassLinking`.
>> 
>> After this PR, we still allow Java agents for `java -Xshare:dump 
>> -XX:-AOTClassLinking`, as that is required by some CDS tests. In a 
>> subsequent RFE, we will fix these CDS tests so Java agents are always 
>> disabled for `java -Xshare:dump`. See 
>> [JDK-8362561](https://bugs.openjdk.org/browse/JDK-8362561)
>
> test/hotspot/jtreg/runtime/cds/appcds/aotCache/JavaAgentTransformer.java line 
> 41:
> 
>> 39:         savedInstrumentation = instrumentation;
>> 40: 
>> 41:         LOGGER.log(Level.WARNING, "JavaAgentTransformer::premain() is 
>> finished");
> 
> Just curious why not use `Level.INFO` instead. Is it because the log won't be 
> printed with product build if `Level.INFO` is used?

I copied this code from the original reproducer. If this code was executed 
inside the assembly phase, then we will get a CDSHeapVerifier error.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26374#discussion_r2216943972

Reply via email to