RFR: 8286180: Enable construction of LogStreamImpl from LogMessageImpl [v4]
David Holmes
dholmes at openjdk.java.net
Wed May 18 02:23:58 UTC 2022
On Tue, 17 May 2022 13:35:53 GMT, Johan Sjölén <duke at openjdk.java.net> wrote:
>> May I please have a review of this PR which adds non-interleaving log streams to UL?
>>
>> In `LogMessageImpl` I remove templates and instead directly store a reference to `LogTagSet` and change `LogTagHandle` to be consistent (from pointer to reference) with `LogMessageImpl`.
>>
>> Adding a non-interleaving log stream enables UL to replace two patterns found in HotSpot:
>>
>> 1. `ttyLocker` + `(x)tty`
>> Instead of taking the global tty lock in order to ensure non-interleaving logs we can now make a `NonInterleavingLogstream` and pass that around to various `print_on(outputStream*)` functions.
>>
>> 2. `stringStream` + `outputStream*`
>> In order to avoid taking the lock and being able to take arbitrary output streams a `stringStream` is created and finally printed through `print_raw(ss.as_string())`. This however requires a `ResourceMark`, which `NonInterleavingLogStream` does not require.
>>
>> Passes tier 1.
>
> Johan Sjölén has updated the pull request incrementally with one additional commit since the last revision:
>
> Don't use get_ prefix and fix indentation
src/hotspot/share/logging/logStream.hpp line 127:
> 125: size_t newcap = align_up(atleast + additional_expansion, additional_expansion);
> 126: if (newcap > reasonable_max) {
> 127: log_info(logging)("Suspiciously long log line: \"%.100s%s",
Can we safely log from inside logging code?
test/hotspot/gtest/logging/test_logStream.cpp line 24:
> 22: *
> 23: */
> 24: #include "memory/resourceArea.hpp"
includes should be ordered alphabetically in general, but nothing should come before precompiled.hpp
-------------
PR: https://git.openjdk.java.net/jdk/pull/8748
More information about the hotspot-runtime-dev
mailing list