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

Andrew Haley aph at openjdk.org
Mon Jun 3 15:26:16 UTC 2024


On Mon, 3 Jun 2024 15:15:09 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> Okay. Well, if we have a static assert, we will notice if we have more registers than fit the bitset.
>
> 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.

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

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


More information about the hotspot-compiler-dev mailing list