RFR: 8281195: Mistakenly used logging causes significant overhead in interpreter [v2]
Coleen Phillimore
coleenp at openjdk.java.net
Mon Feb 7 20:26:08 UTC 2022
On Mon, 7 Feb 2022 19:35:12 GMT, Alexey Pavlyutkin <duke at openjdk.java.net> wrote:
>> src/hotspot/share/interpreter/oopMapCache.cpp line 282:
>>
>>> 280: LogStream st(Log(interpreter, oopmap)::trace());
>>> 281:
>>> 282: if (log) st.print("Locals (%d): ", max_locals);
>>
>> This seems unfortunate to have these if statements, and a counter goal of the logging framework. Is there another way to do this without the if statements?
>
> The problem is that here we use multiple print()/cr() statements to make up a single log message, thus we cannot simply use regular log_trace(). The only obvious way to avoid multiple if statements is to quote whole body with one if and introduce else branch without logging. But as I understand the intention of LogStream is exactly to build log message as a combination of pieces, so I don't see any problem here
The logging framework was intended to avoid these explicit if statements also. It seems it could be refactored to duplicate the loops with logging, and not combine them with verification.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7367
More information about the hotspot-runtime-dev
mailing list