RFR: JDK-8266503: [UL] Make Decorations safely copy-able and reduce their size [v2]

Thomas Stuefe stuefe at openjdk.java.net
Thu May 6 18:32:57 UTC 2021


On Wed, 5 May 2021 18:27:41 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
>> 
>>  - Merge
>>  - Remove harfbuzz build fix
>>  - Volker feedback
>>  - start
>>  - cherry-picked JDK-8266536
>>  - harfbuzz-buildfix
>
> src/hotspot/share/logging/logDecorations.cpp line 39:
> 
>> 37:     if (os::get_host_name(buffer, sizeof(buffer))) {
>> 38:       // Use raw malloc here
>> 39:       return ::strdup(buffer);
> 
> I don't think `strdup` is necessary. If you decide to use static variable, you can use `static char buffer[1024]` in the function.

Hi Xin, I think you review an old version, I reverted that coding.

But the point about using a pointer and resolving hostname lazily on first access is to prevent paying anything if logging is off or logging is on but the hostname decorator is not used. For a static char array you always have to pay.

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

PR: https://git.openjdk.java.net/jdk/pull/3874


More information about the hotspot-runtime-dev mailing list