On Wed, 1 Apr 2026 08:24:06 GMT, SendaoYan <[email protected]> wrote:

>> Roman Kennke has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Improve truncation code on BSD and Windows, add comment to Linux
>
> src/hotspot/share/runtime/os.hpp line 420:
> 
>> 418:   static void set_native_thread_name(const char *name, size_t len);
>> 419:   static inline void set_native_thread_name(const char *name) {
>> 420:     set_native_thread_name(name, strlen(name));
> 
> Hi, why we calculate the length of name before invoke set_native_thread_name, 
> does this performance better than calculate inside set_native_thread_name.

Some paths use the variant with the length directly, this allows to use the 
String's array without copying. This version is here as a fallback.

> test/micro/org/openjdk/bench/java/lang/ThreadSetName.java line 59:
> 
>> 57: 
>> 58:     @Benchmark
>> 59:     public void setNameSame() {
> 
> Seems you removed the same name optimise during reviews. Maybe  the 
> `setNameSame` test not needed

Right. Removed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30374#discussion_r3021162501
PR Review Comment: https://git.openjdk.org/jdk/pull/30374#discussion_r3021153819

Reply via email to