RFR: 8367103: RISC-V: store cpu features in a bitmap [v5]

Ludovic Henry luhenry at openjdk.org
Mon Sep 22 10:28:56 UTC 2025


On Mon, 22 Sep 2025 09:22:39 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> Hi,
>> Can you help to review this patch?
>> 
>> Currently, the cpu features of riscv are stored in separate RVFeature subclasses.
>> But to support the store/restore CPU features for aot in the future, we need to store the cpu features in a continuous memory.
>> As the riscv extensions are introduced continuously, I think it's better to do it via an simple bitmap at the beginning.
>> Currently, just suppose the non-extension features will not be stored in aot image, so I also split the extension and non-extenion features. When we implement the related aot feature in the short future, we can revisit the way of splitting the features. Currently, just change the storage way of cpu features, lay the foundation for future aot.
>> 
>> Thanks
>
> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
> 
>   simplify names

src/hotspot/cpu/riscv/vm_version_riscv.hpp line 68:

> 66:     }
> 67:     const char* pretty()         { return _pretty; }
> 68:     uint64_t feature_bit()       { return _linux_feature_bit; }

Why the renaming?

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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27152#discussion_r2367502775
PR Review Comment: https://git.openjdk.org/jdk/pull/27152#discussion_r2367493775


More information about the hotspot-dev mailing list