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

Kim Barrett kbarrett at openjdk.org
Wed May 29 20:06:08 UTC 2024


On Fri, 10 May 2024 14:24:56 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> src/hotspot/share/asm/register.hpp line 257:
>> 
>>> 255: 
>>> 256: template<typename R, typename... Rx>
>>> 257: inline constexpr bool different_registers(AbstractRegSet<R> allocated_regs, R first_register) {
>> 
>> different_registers is only used by debug-only code in assert_different_registers.  Shouldn't all the overloads
>> for different_registers be within an `#ifdef ASSERT` block?
>
> I could do so, but that would lose the ability to do `static_assert(different_registers(...`. I don't think that  `static_assert` depends on `ASSERT`. I'm happy to make this patch debug-only, though, if you prefer.

Good point about static_assert.  Don't make it debug-only.

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

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


More information about the hotspot-compiler-dev mailing list