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

Andrew Haley aph at openjdk.org
Fri May 10 14:58:54 UTC 2024


On Fri, 10 May 2024 14:28:59 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:
> 
>   Update src/hotspot/share/asm/register.hpp
>   
>   Co-authored-by: Emanuel Peter <emanuel.peter at oracle.com>

> I started to review the patch and was wondering if this could be simplify to something like this?: [stefank at f38c791](https://github.com/stefank/jdk/commit/f38c791793440b899ce6c4c9723470a5d4b18050)
> 
> I tested this with this small section of temporary static_asserts: [stefank at 30da4d6](https://github.com/stefank/jdk/commit/30da4d6abeee14e4e4f44034295f1bb0ad2e3016)
> 
> Unfortunately, that didn't compile and I had make this change to get it to work: [stefank at d6bda1a](https://github.com/stefank/jdk/commit/d6bda1a25e297865fd6b5da21184273d8825b922)

OK, so I'm not going to do that, then.

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

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


More information about the hotspot-compiler-dev mailing list