RFR: 8274243: Implement fast-path for ASCII-compatible CharsetEncoders on aarch64 [v2]

Andrew Haley aph at openjdk.java.net
Wed Jan 5 18:24:19 UTC 2022


On Wed, 5 Jan 2022 14:35:26 GMT, Patric Hedlin <phedlin at openjdk.org> wrote:

>> src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 4956:
>> 
>>> 4954:   movw(cnt, len);
>>> 4955: 
>>> 4956: #define ASCII(insn) if (ascii) { insn; }
>> 
>> Suggestion:
>> 
>> #define ASCII(insn) do { if (ascii) { insn; } } while 0
>> 
>> It's almost always good practice to use an "else safe" macro.
>
> With the limited use and scope, I see no need to.

That's unfortunate.
As a general rule, it's good to err on the side of robustness, if only fo the sake of solid code and defence in depth. Especially where, as here, the compile-time cost is nearly zero, and the runtime cost exactly zero. I presume you're thinking about some kind of cost/benefit balance, but I am at a loss to understand what the downside of following the common pattern may be.

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

PR: https://git.openjdk.java.net/jdk/pull/6945


More information about the hotspot-compiler-dev mailing list