RFR: 8377777: Improve logging when rejecting assets from the AOT archive [v4]

María Arias de Reyna Domínguez duke at openjdk.org
Mon Feb 23 11:20:07 UTC 2026


On Wed, 18 Feb 2026 16:37:14 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> The problem with that approach is that either I drag the reason from `ConstantPoolCache::can_archive_resolved_method` forwards to the log lines of `ConstantPoolCache::remove_resolved_method_entries_if_non_deterministic`...
>> 
>> Or I only log the archived ones there (in https://github.com/openjdk/jdk/pull/29690/changes#diff-7c80246775ae7b0e39ab029c1f9782d2dcf9e2e53a3d2d37c01080fae5d0a6deR501 ) and write the reject reason on `ConstantPoolCache::can_archive_resolved_method` which may mean in the future someone forget to add a rejection log message for new cases.
>
> What I mean is -- in all the places where you add one extra print:
> 
> 
> if (resolved) {
>   log.print("%s field  CP entry [%3d]: %s => %s.%s:%s%s",
>             (archived ? "archived" : "reverted"),
>             cp_index,
>             cp->pool_holder()->name()->as_C_string(),
>             klass_name->as_C_string(), name->as_C_string(), signature->as_C_string(),
>             rfi->is_resolved(Bytecodes::_getstatic) || rfi->is_resolved(Bytecodes::_putstatic) ? " *** static" : "");
>   if (!archived && !CDSConfig::is_dumping_preimage_static_archive()) {
>     log.print("%s field  CP entry [%3d] => %s.%s:%s%s can't be archived because its resolution is not deterministic.",
>               src_cp->pool_holder()->name()->as_C_string(),
>               cp_index,
>               klass_name->as_C_string(), name->as_C_string(), signature->as_C_string(),
>               rfi->is_resolved(Bytecodes::_getstatic) || rfi->is_resolved(Bytecodes::_putstatic) ? " *** static" : "");
>   }
> }
> 
> 
> Do this instead so we don't duplicate the code twice and print essentially the same information twice.
> 
> The check for `!CDSConfig::is_dumping_preimage_static_archive()` is not necessary for the logs. Try removing it and see if it still works for your scripts.
> 
> 
> if (resolved) {
>   log.print("%s field  CP entry [%3d]: %s => %s.%s:%s%s%s",
>             (archived ? "archived" : "reverted"),
>             cp_index,
>             cp->pool_holder()->name()->as_C_string(),
>             klass_name->as_C_string(), name->as_C_string(), signature->as_C_string(),
>             rfi->is_resolved(Bytecodes::_getstatic) || rfi->is_resolved(Bytecodes::_putstatic) ? " *** static" : "",
>             (archived ? "" : " (resolution not deterministic)"));
> }

Now we have three situations:

`indy`

[trace  ][aot,resolve] reverted indy   CP entry [ 89]: org/hibernate/sql/results/graph/entity/internal/BatchEntitySelectFetchInitializer (0)    java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; (resolution is not deterministic)


`field`

[trace  ][aot,resolve] reverted field  CP entry [ 17]: org/hibernate/resource/beans/internal/BeansMessageLogger_$logger => org/hibernate/resource/beans/internal/BeansMessageLogger_$logger.FQCN:Ljava/lang/String; (resolution is not deterministic)


`method`

[trace][aot,resolve] reverted method CP entry [  2]: org/hibernate/sql/results/graph/entity/internal/EntitySelectFetchInitializerBuilder$BatchMode [Lorg/hibernate/sql/results/graph/entity/internal/EntitySelectFetchInitializerBuilder$BatchMode;.clone:()Ljava/lang/Object; (resolution is not deterministic)
[trace][aot,resolve] reverted method CP entry [  2]: org/hibernate/sql/results/graph/entity/internal/EntitySelectFetchInitializerBuilder$BatchMode [Lorg/hibernate/sql/results/graph/entity/internal/EntitySelectFetchInitializerBuilder$BatchMode;.clone:()Ljava/lang/Object;

which is duplicated because one is done on `ConstantPoolCache::can_archive_resolved_method` and the second one at the end of `ConstantPoolCache::remove_resolved_method_entries_if_non_deterministic` which doesn't have the reason (and I don't trust removing the second one just in case we introduce some condition not covered in the previous method).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29690#discussion_r2840294590


More information about the hotspot-dev mailing list