RFR: 8319822: Use a linear-time algorithm for assert_different_registers() [v12]

Andrew Haley aph at openjdk.org
Mon Jun 3 17:19:08 UTC 2024


On Mon, 3 Jun 2024 16:53:57 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Urgh. 
>> 
>> Seems on arm32 (and on zero, but I guess that does not matter) Register is a typedef to a pointer:
>> 
>> https://github.com/openjdk/jdk/blob/9686e804a2b058955ff88149c54a0a7896c0a2eb/src/hotspot/cpu/arm/register_arm.hpp#L136
>> 
>> and RegImpl is a pointer type, so it cannot have members.
>> 
>> On all other platforms, Register is a class (and that works since it overrides operator->() )
>> 
>> I don't see a quick fix other than to make the assert dependent on !arm !zero. Or, leave it for a followup fix.
>> 
>> ---
>> 
>> BTW, note that on Arm32, we can have 64 float registers:
>> 
>> https://github.com/openjdk/jdk/blob/9686e804a2b058955ff88149c54a0a7896c0a2eb/src/hotspot/cpu/arm/register_arm.hpp#L178
>> 
>> So, I would make the underlying type 64-bit for 32-bit builds too.
>
> BTW Would the runtime assert not prevent this from used as constexpr?

It doesn't, and I just saw the problem: on Arm, `Register` is a pointer type, whereas on other ports it's a class type.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16617#discussion_r1624806190


More information about the hotspot-compiler-dev mailing list