RFR: 8288298: Resolve multiline message parsing ambiguities in UL [v2]
David Holmes
dholmes at openjdk.org
Thu Oct 31 01:52:42 UTC 2024
On Wed, 30 Oct 2024 09:14:34 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>> 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
>
> I'm still fine with what we have.
> The JVM IO printing functions need a null terminated string
No they don't. Instead of using:
jio_fprintf(_stream, "%s\n", msg)
you use
jio_fprintf(_stream, "%*s\n", msg_len, msg)
So by advancing a cursor to the new newline you can print all the characters prior, since the last print and so step along the string.
I'm not saying we have to make this change but I do worry that with larger strings the allocation and copying overhead may become an issue.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21712#discussion_r1823674576
More information about the hotspot-runtime-dev
mailing list