RFR: 8364128: Improve gathering of cpu feature names using FormatBuffer
Ashutosh Mehra
asmehra at openjdk.org
Tue Jul 29 16:57:56 UTC 2025
On Tue, 29 Jul 2025 06:48:59 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>> This PR implements the code for cpu features names string using FormatBuffer. It also improves and extends FormatBuffer with an additional method that appends comma separated strings to the buffer. This is useful in creating the cpu features names string.
>> This code will also be useful in Leyden to implement cpu feature check for AOTCodeCache [0].
>> Platforms affected: x86-64 and aarch64
>> Other platforms can be done if and when Leyden changes are ported to them.
>>
>> [0] https://github.com/openjdk/leyden/pull/84
>
> src/hotspot/share/runtime/abstract_vm_version.hpp line 50:
>
>> 48: template<size_t bufsz> class FormatBuffer;
>> 49:
>> 50: using CpuInfoBuffer = FormatBuffer<CPU_INFO_BUF_SIZE>;
>
> Is it important that we avoid dynamic allocation at this stage of VM initialization? Is that why we can't use `stringStream` instead?
Yeah, I think stringStream can be used as well. Dynamic allocation shouldn't be a concern. I can set the initial size to be same as the CPU_INFO_BUF_SIZE to reduce churn a bit. I will try this out. Thanks for the suggestion.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26515#discussion_r2240438860
More information about the hotspot-dev
mailing list