RFR: 8317433: Async UL: Only grab lock once when write():ing [v3]

Xin Liu xliu at openjdk.org
Fri Oct 6 17:21:14 UTC 2023


On Fri, 6 Oct 2023 06:21:48 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Rewrite comment
>
> src/hotspot/share/logging/logAsyncWriter.cpp line 139:
> 
>> 137:       stringStream ss;
>> 138:       ss.print(UINT32_FORMAT_W(6) " messages dropped due to async logging", counter);
>> 139:       output->write_blocking(decorations, ss.freeze());
> 
> Just to check but are we guaranteed that the ss content will be copied eventually?

no, we don't copy the content of ss with ss.freeze() eventually. we just pass its underlying raw pointer to write_blocking. We don't need to copy here because the raw pointer is read-only. We destruct ss after write_blocking().

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16030#discussion_r1349052926


More information about the hotspot-runtime-dev mailing list