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

Andrew Haley aph at openjdk.org
Tue May 28 15:57:19 UTC 2024


On Mon, 13 May 2024 14:36:24 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> Andrew Haley has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review feedback
>
> src/hotspot/share/asm/register.hpp line 263:
> 
>> 261: template<typename R, typename... Rx>
>> 262: inline constexpr bool different_registers(AbstractRegSet<R> allocated_regs, R first_register, Rx... more_registers) {
>> 263:   if (allocated_regs.contains(first_register)) {
> 
> FWIW, while first reading this I was looking for the base case of the recursion (the previous versions had some extra specializations). To me it looks like the base case is written in both this function and the function above. I would prefer to have the implementation inside one function only and change this function to use:
> 
>   if (!different_registers(allocated_regs, first_register)) {
> 
> I think this could make it a bit clearer, but if you prefer the current style, I think that's fine as well.

I'd prefer to stick with what I have, because it's a bit more direct and slightly simpler runtime code.

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

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


More information about the hotspot-compiler-dev mailing list