RFR: 8288298: Resolve multiline message parsing ambiguities in UL

Antón Seoane duke at openjdk.org
Wed Oct 30 09:17:10 UTC 2024


On Tue, 29 Oct 2024 09:20:31 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> src/hotspot/share/logging/logFileStreamOutput.cpp line 174:
>> 
>>> 172:   // Handle multiline strings: split the string replacing newlines with terminators,
>>> 173:   // and then force write_internal_line to print all of them (i.e. not stopping at the
>>> 174:   // first null but until msg_len bytes are printed)
>> 
>> The string duplication with newline-to-nul conversion likely performs okay for typical short logging statements. But my initial approach would have been to scan through the string looking for the next newline and print it in chunks that way.
>
> This might be the better way to go, with `strstr`.

I'm not sure if that would be possible. The JVM IO printing functions need a null terminated string, so in the end we would still need to either replace newlines or copy each newline-terminated string to a new one that we would print. In any case, if instead of traversing the string substituting we use `strstr`, under the hood we're still traversing and now I'm not that sure if the approach would be vectorizable

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21712#discussion_r1822176694


More information about the hotspot-runtime-dev mailing list