RFR: 8363943: ARM32: Represent Registers as values [v2]

Ivan duke at openjdk.org
Tue Nov 11 22:37:04 UTC 2025


On Mon, 10 Nov 2025 11:10:42 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Ivan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Proposed review changes were applied
>
> src/hotspot/cpu/arm/register_arm.hpp line 86:
> 
>> 84:   enum {
>> 85:     number_of_registers = 16,
>> 86:     max_slots_per_register = 1 << (LogBytesPerWord - LogBytesPerInt) // LogBytesPerWord depends on _LP64
> 
> ARM32 is only 32-bit, so we can skip any _LP64-based computations, and just do the literal constant.

Yes, of course.
One thing concerns me, according to the globalDefinitions.hpp, max_slots_per_register evaluates to 1, but in one of the other comments you mentioned that it is 2. Did I misunderstood the definitions, or there is a mistake?

const int LogBytesPerInt     = 2;
#ifdef _LP64
constexpr int LogBytesPerWord    = 3;
#else
constexpr int LogBytesPerWord    = 2;
#endif

> src/hotspot/cpu/arm/register_arm.hpp line 101:
> 
>> 99: 
>> 100:     // testers
>> 101:     bool is_valid() const {return 0 <= raw_encoding() && raw_encoding() < number_of_registers;}
> 
> Suggestion:
> 
>     // accessors and testers
>     int raw_encoding() const { return this - first(); } 
>     int encoding() const     { assert(is_valid(), "invalid register"); return raw_encoding(); }
>     bool is_valid() const    { return 0 <= raw_encoding() && raw_encoding() < number_of_registers; }

Applied in `962b01b602c0f42b95f8a3ad4f58d84b17db3c6f` commit

> src/hotspot/cpu/arm/register_arm.hpp line 202:
> 
>> 200: 
>> 201:     // testers
>> 202:     bool is_valid() const {return 0 <= raw_encoding() && raw_encoding() < number_of_registers;}
> 
> Suggestion:
> 
>     // accessors and testers
>     int raw_encoding() const { return this - first(); }
>     int encoding() const     { assert(is_valid(), "invalid register"); return raw_encoding(); }
>     bool is_valid() const    { return 0 <= raw_encoding() && raw_encoding() < number_of_registers; }

Applied in `962b01b602c0f42b95f8a3ad4f58d84b17db3c6f` commit

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26525#discussion_r2516017292
PR Review Comment: https://git.openjdk.org/jdk/pull/26525#discussion_r2516021112
PR Review Comment: https://git.openjdk.org/jdk/pull/26525#discussion_r2516021904


More information about the hotspot-dev mailing list