RFR: 8319822: Use a linear-time algorithm for assert_different_registers() [v10]
Stefan Karlsson
stefank at openjdk.org
Wed May 29 07:49:04 UTC 2024
On Tue, 28 May 2024 15:52:26 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> 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.
Sure. We can't all have the seem style preferences. :)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16617#discussion_r1618376956
More information about the hotspot-compiler-dev
mailing list