RFR: 8281195: Mistakenly used logging causes significant overhead in interpreter [v4]
Alexey Pavlyutkin
duke at openjdk.java.net
Tue Feb 8 07:37:09 UTC 2022
On Tue, 8 Feb 2022 06:39:33 GMT, Alexey Pavlyutkin <duke at openjdk.java.net> wrote:
>> Fixes
>>
>> `bool OopMapCacheEntry::verify_mask(CellTypeState* vars, CellTypeState* stack, int max_locals, int stack_top)`
>>
>> eliminating frequent generation of log messages with no respect of logging configuration
>>
>> Verification: N/A (the issue does not have an observable effect)
>>
>> Regression: hotspot_compiler (20.04 on amd64 )
>
> Alexey Pavlyutkin has updated the pull request incrementally with one additional commit since the last revision:
>
> Restores mistakenly lost code
I'd suggest to wrap `LogStream` with something like
struct tracer{
tracer()
: _enabled(log_is_enabled(LogLevel::Trace, interpreter, oopmap))
, _stream(Log(interpreter, oopmap)::trace()) {
}
void print(const char* fmt, ...) {
if (_enabled) {
va_list args;
va_start(args, format);
_stream.print(fmt, args);
va_end(args);
}
}
void cr() {
if (_enabled) _stream.cr();
}
private:
const bool _enabled;
LogStream _stream;
};
but `LogStream.print()` requires `format` argument to be string literal. Also `outputStream::print()` and `outputStream::cr()` are not virtual, thus we cannot use dummy stream pointer to suppress logging
-------------
PR: https://git.openjdk.java.net/jdk/pull/7367
More information about the hotspot-runtime-dev
mailing list