RFR: 8364128: Improve gathering of cpu feature names using FormatBuffer
Ashutosh Mehra
asmehra at openjdk.org
Tue Jul 29 18:22:03 UTC 2025
On Tue, 29 Jul 2025 07:00:10 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>> src/hotspot/cpu/x86/vm_version_x86.cpp line 1113:
>>
>>> 1111: insert_features_names(_features, info_buffer);
>>> 1112:
>>> 1113: _cpu_info_string = os::strdup(info_buffer);
>>
>> Sorry, I'm going to need some help here :-). How can passing a `FormatBuffer` to `os::strdup` not fail to compile?
>
> And here we do `os::strdup`, so now we do have dynamic allocation, so maybe just use a `stringStream`?
> Sorry, I'm going to need some help here :-). How can passing a FormatBuffer to os::strdup not fail to compile?
It works because of this trick in its base class FormatBufferBase:
operator const char *() const { return _buf; }
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26515#discussion_r2240612588
More information about the hotspot-dev
mailing list