Description
assert_different_registers (hotspot/share/asm/register.hpp) is defined using a bunch of different overloads for different arities, with large amounts of code duplication, and with relatively poor error reporting.
The error reporting just prints the "values" of the registers, because this is all done with AbstractRegister parameters. By instead using a deduced template parameter for the type of the arguments, the names of the registers become available for use in the error message. All concrete register types provide such a function, and this function is always called with all the arguments being the type.
The code duplication could be reduced by having a an overload call the next smaller arity overload as a helper function. But better would be to use a single variadic function template.
The error reporting just prints the "values" of the registers, because this is all done with AbstractRegister parameters. By instead using a deduced template parameter for the type of the arguments, the names of the registers become available for use in the error message. All concrete register types provide such a function, and this function is always called with all the arguments being the type.
The code duplication could be reduced by having a an overload call the next smaller arity overload as a helper function. But better would be to use a single variadic function template.
Attachments
Issue Links
- relates to
-
JDK-8270140 Improve Register class implementation
-
- Open
-