RFR: 8319822: Use a linear-time algorithm for assert_different_registers() [v12]
Thomas Stuefe
stuefe at openjdk.org
Mon Jun 3 16:52:05 UTC 2024
On Mon, 3 Jun 2024 15:23:32 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> So I'm getting this bizarre failure on arm32. I'm guessing it's actually a compiler bug, but I suppose it might be some dusty corner of C++ to do with template arg substitution. Any thoughts?
>>
>>
>> In file included from /home/runner/work/jdk/jdk/src/hotspot/share/utilities/globalDefinitions.hpp:29,
>> from /home/runner/work/jdk/jdk/src/hotspot/share/nmt/memflags.hpp:28,
>> from /home/runner/work/jdk/jdk/src/hotspot/share/memory/allocation.hpp:29,
>> from ad_arm.hpp:30,
>> from ad_arm.cpp:28:
>> /home/runner/work/jdk/jdk/src/hotspot/share/asm/register.hpp: In instantiation of ‘class AbstractRegSet<RegisterImpl*>’:
>> /home/runner/work/jdk/jdk/src/hotspot/share/asm/register.hpp:272:30: required from ‘constexpr bool different_registers(R, Rx ...) [with R = RegisterImpl*; Rx = {RegisterImpl*, RegisterImpl*}]’
>> /home/runner/work/jdk/jdk/src/hotspot/share/asm/register.hpp:278:27: required from ‘void assert_different_registers(R, Rx ...) [with R = RegisterImpl*; Rx = {RegisterImpl*, RegisterImpl*}]’
>> /home/runner/work/jdk/jdk/src/hotspot/cpu/arm/arm.ad:8984:52: required from here
>> /home/runner/work/jdk/jdk/src/hotspot/share/asm/register.hpp:96:26: error: ‘number_of_registers’ is not a member of ‘RegisterImpl*’
>> 96 | STATIC_ASSERT(RegImpl::number_of_registers <= 64);
>> | ^~~~~~~~~~~~~~~~~~~
>> /home/runner/work/jdk/jdk/src/hotspot/share/utilities/debug.hpp:287:44: note: in definition of macro ‘STATIC_ASSERT’
>> 287 | #define STATIC_ASSERT(Cond) static_assert((Cond), #Cond)
>> | ^~~~
>
> I just changed the static assert to a regular assert, in the hope that it might work better on arm32.
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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16617#discussion_r1624768687
More information about the hotspot-compiler-dev
mailing list