RFR: 8369685: RISC-V: refactor code related to RVFeatureValue::enabled

Robbin Ehn rehn at openjdk.org
Wed Oct 15 06:11:05 UTC 2025


On Wed, 15 Oct 2025 02:56:30 GMT, Fei Yang <fyang at openjdk.org> wrote:

>> Hi,
>> Can you help to review this patch?
>> @RealFYang 
>> 
>> Original discussion is here: https://github.com/openjdk/jdk/pull/27562#discussion_r2415984981.
>> Although seems we can not remove it, but we can still remove some of the redundant check like `mvendorid.enabled()`.
>> And also do some simple refactoring related to enable/disable/enabled and so on.
>> 
>> Thanks
>
> src/hotspot/cpu/riscv/vm_version_riscv.cpp line 201:
> 
>> 199:   if (UseZicboz && zicboz_block_size.enabled()) {
>> 200:     assert(is_power_of_2(zicboz_block_size.value()) &&
>> 201:            zicboz_block_size.value() > 0, "Sanity");
> 
> Note the previous discussion about why we need this `> 0` check [1].
> @robehn mentions that the kernel seems to have a bug: if it can't retrive those value it will return 0 as value for those.
> 
> So maybe simply do:
> 
> if (UseZicboz && zicboz_block_size.value() > 0) {
>   assert(is_power_of_2(zicboz_block_size.value()), "Sanity");
>   ......
> 
> 
> [1] https://github.com/openjdk/jdk/pull/27155#issuecomment-3270608461

Yes, it seems like we need to check these for a non 0 value.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27771#discussion_r2431223102


More information about the hotspot-dev mailing list