RFR: 8377777: Improve logging when rejecting assets from the AOT archive [v4]
Ioi Lam
iklam at openjdk.org
Wed Feb 18 16:40:17 UTC 2026
On Wed, 18 Feb 2026 09:34:12 GMT, María Arias de Reyna Domínguez <duke at openjdk.org> wrote:
>> src/hotspot/share/oops/cpCache.cpp line 467:
>>
>>> 465: rfi->is_resolved(Bytecodes::_getstatic) || rfi->is_resolved(Bytecodes::_putstatic) ? " *** static" : "");
>>> 466: }
>>> 467: }
>>
>> The two log lines basically print out the same info, except that one of them prints "reverted" and the other prints "...resolution is not deterministic".
>>
>> I would suggest changing the format (of all the messages touched by this PR) to something like:
>>
>>
>> archived xxxxx
>> reverted xxxxxx (resolution not deterministic)
>> reverted xxxxxx (non-builtin loader)
>>
>>
>> The messages should be concise to reduce log file size.
>>
>> The C++ code can generally look like this:
>>
>>
>> log.print("%s ...... %s",
>> (archived ? "archived" : "reverted"),
>> ......
>> (archived ? "" : "(resolution not deterministic)");
>
> 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)"));
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29690#discussion_r2823307536
More information about the hotspot-dev
mailing list