RFR: 8272315: Improve assert_different_registers
Kim Barrett
kbarrett at openjdk.java.net
Wed Aug 11 12:27:25 UTC 2021
On Wed, 11 Aug 2021 11:59:14 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Please review this improvement to assert_different_register.
>>
>> It reduces ~250 lines of repetitive code to ~10 lines, and improves the
>> error message on failure by printing a duplicated registers name.
>>
>> Unfortunately, this isn't enough to eliminate AbstractRegister[Impl].
>> Although it seems to no longer be needed for the Oracle-supported platforms,
>> the linux-arm/ppc64le/s390 platforms all use the value() function provided
>> by AbstractRegisterImpl.
>>
>> Testing:
>> tier1 on Oracle supported platforms.
>> built linux-arm/ppc64le/s390.
>>
>> Locally changed a call to have a duplicate register and verified the error
>> message had a useful register name.
>
> src/hotspot/share/asm/register.hpp line 70:
>
>> 68: // Sort regs, so any equal entries are adjacent.
>> 69: struct Compare { ptrdiff_t operator()(R x, R y) const { return x - y; } };
>> 70: QuickSort::sort(regs, ARRAY_SIZE(regs), Compare(), false);
>
> Sorting is kind of overkill. Maybe I should have just use the obvious nested loop? What do reviewers think?
Answering my own question, sorting imposes additional requirements on the type that might require adjustment for JDK-8270140. So I'm inclined to switch to the nested loop that only requires equality testing as before.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5083
More information about the hotspot-compiler-dev
mailing list