[11] RFR 8193085 Vectorize the nio Buffer equals and compareTo implementations
Paul Sandoz
paul.sandoz at oracle.com
Tue Dec 19 19:39:01 UTC 2017
> On 19 Dec 2017, at 11:35, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
> On 18/12/2017 20:55, Paul Sandoz wrote:
>> :
>> There is already an assert, perhaps i can simplify this:
>>
>> 1) StringCharBuffer does not require special overrides.
>>
>> 2) Update the mismatch method:
>>
>> static int mismatch(CharBuffer a, int aOff, CharBuffer b, int bOff, int length) {
>> int i = 0;
>> // Ensure only heap or off-heap buffer instances use the
>> // vectorized mismatch. If either buffer is a StringCharBuffer
>> // (order is null) then the slow path is taken
>> if (length > 3 && a.charRegionOrder() == b.charRegionOrder()
>> && a.charRegionOrder() != null && b.charRegionOrder() != null) {
>>
>> I updated the webrev in place (i also updated the test to test big vs. little endian).
> When I looked at it yesterday the CharBuffer version of mismatch wasn't checking both bases (or maybe I just mis-read it).
>
You did not misread it. Previously it strictly did not need to check both (only argument a) because the StringCharBuffer equals/compareTo did not call the mismatch method.
> Anyway, it looks good now and I see the other bug updated to list clarifying the compareTo specs too.
>
Thanks,
Paul.
More information about the core-libs-dev
mailing list