RFR: 8284849: Add deoptimization to unified logging

David Holmes dholmes at openjdk.java.net
Mon May 23 07:28:54 UTC 2022


On Fri, 20 May 2022 19:06:55 GMT, Johan Sjölén <duke at openjdk.java.net> wrote:

>> src/hotspot/share/runtime/deoptimization.cpp line 1935:
>> 
>>> 1933:     JFR_ONLY(post_deoptimization_event(nm, trap_method(), trap_bci, trap_bc, reason, action);)
>>> 1934: 
>>> 1935:     if(Log(deoptimization)::is_info()) {
>> 
>> I don't see this pattern used for checking whether a log tag is enabled used elsewhere. Won't this only print when the log level is exactly `info`?
>> 
>> The pattern I see used elsewhere is:
>> 
>> 
>> LogTarget(Info, <tag>) lt;
>> if (lt.is_enabled()) {
>>     ...
>> }
>
> This does the same thing. `is_enabled` calls `is_level` internally. I did it this way so that we have a temporary value instead of cluttering the outer scope.

Using a `LogMessage` instead of a `LogTarget` is very rarely used in the codebase. I have no idea what the pros and cons of each are, nor can I find any guidance on which to use when.

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

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


More information about the hotspot-dev mailing list