RFR: 8367103: RISC-V: store cpu features in a bitmap [v5]
Hamlin Li
mli at openjdk.org
Wed Sep 24 10:55:58 UTC 2025
On Mon, 22 Sep 2025 11:19:01 GMT, Hamlin Li <mli at openjdk.org> wrote:
>> src/hotspot/cpu/riscv/vm_version_riscv.hpp line 275:
>>
>>> 273: public:
>>> 274: enum RVFeatureIndex {
>>> 275: #define DECLARE_RV_FEATURE_ENUM(NAME, PRETTY, LINUX_BIT, CPU_FEATURE_INDEX, FSTRING, FLAGF) CPU_##NAME=(CPU_FEATURE_INDEX),
>>
>> Instead of explicitly setting the feature index, can't we use the implicit numbering of the enum and remove the `cpu feature index` from `RV_EXT_FEATURE_FLAGS` entirely? The only other use I can see of `CPU_FEATURE_INDEX` is at https://github.com/openjdk/jdk/pull/27152/files#diff-7b173d6e5834de13749c8333192fef5a874628a67b90a5d8d06235d507542ac4R39 and I wonder if we can't use the enum `CPU_#NAME` there directy.
>
> Yes, it'll be good if we can just remove the explicit numbering of the enum, but seems there is no good way to pass in the enum value to the constructor of `NAME##RVExtFeatureValue` in `DEF_RV_EXT_FEATURE`. We could do it with an static member of RVExtFeatureValue, increment it in RVExtFeatureValue constructor, but seems it's not straight and clear.
> So my preference is to keep the explicit enum value in `RV_EXT_FEATURE_FLAGS`.
> How do you think about it?
We also need this feature index when construct a `NAME##RVExtFeatureValue` instance in vm_version_riscv.cpp
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27152#discussion_r2375373809
More information about the hotspot-dev
mailing list