<i18n dev> RFR: 8261418: Reduce decoder creation overheads for sun.nio.cs.ext Charsets

Naoto Sato naoto at openjdk.java.net
Tue Feb 9 19:52:40 UTC 2021


On Tue, 9 Feb 2021 19:43:06 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP.java.template line 116:
>> 
>>> 114:             int sp = src.arrayOffset() + src.position();
>>> 115:             int sl = src.arrayOffset() + src.limit();
>>> 116: 
>> 
>> I see these are removed from encode/decodeArrayLoop(s). Any reason behind those?
>
> My IDE was marking the next line as redundant since `sp <= sl` will always be true. `buffer.position() <= buffer.limit()` is an invariant that I don't think we need to assert against here, and I think it's just been copy-pasted around mindlessly.

Thanks, got it. I was wondering any possibility of sp > sl case.

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

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


More information about the i18n-dev mailing list