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

Andrew Haley aph at openjdk.org
Fri May 10 16:16:07 UTC 2024


On Fri, 10 May 2024 15:26:29 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> At the present time, `assert_different_registers()` uses an O(N**2) algorithm in assert_different_registers(). We can utilize RegSet to do it in O(N) time. This would be a useful optimization for all builds with assertions enabled.
>> 
>> In addition, it would be useful to be able to static_assert different registers. 
>> 
>> Also, I've taken the opportunity to expand the maximum size of a RegSet to 64 on 64-bit platforms.
>> 
>> I also fixed a bug: sometimes `noreg` is passed to `assert_different_registers()`, but it may only be passed once or a spurious assertion is triggered.
>
> Andrew Haley has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review feedback

> From the summary:
> 
> > In addition, it would be useful to be able to static_assert different registers.
> 
> As mentioned in [#16617 (comment)](https://github.com/openjdk/jdk/pull/16617#issuecomment-1807933886) this doesn't work unless we make the proposed small tweak. Do you want to make it in this PR, or should I propose that in a separate PR?

Let's do it separately. I would, but GCC has a very relaxed attitude to `static_assert` which means I can't test anything here. Everything to do with `static_assert` just seems to work.

Exhuming this one after a long time. Please review, thanks.

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

PR Comment: https://git.openjdk.org/jdk/pull/16617#issuecomment-2104872804
PR Comment: https://git.openjdk.org/jdk/pull/16617#issuecomment-2104873418


More information about the hotspot-compiler-dev mailing list