author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 35255 | jdk/src/java.base/share/classes/java/util/ArraysSupport.java@6f0bf592d149 |
permissions | -rw-r--r-- |
35255
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
1 |
/* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
4 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
10 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
15 |
* accompanied this code). |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
16 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
20 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
23 |
* questions. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
24 |
*/ |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
25 |
package java.util; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
26 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
27 |
import jdk.internal.HotSpotIntrinsicCandidate; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
28 |
import jdk.internal.misc.Unsafe; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
29 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
30 |
/** |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
31 |
* Utility methods to find a mismatch between two primitive arrays. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
32 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
33 |
* <p>Array equality and lexicographical comparison can be built on top of |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
34 |
* array mismatch functionality. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
35 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
36 |
* <p>The mismatch method implementation, {@link #vectorizedMismatch}, leverages |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
37 |
* vector-based techniques to access and compare the contents of two arrays. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
38 |
* The Java implementation uses {@code Unsafe.getLongUnaligned} to access the |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
39 |
* content of an array, thus access is supported on platforms that do not |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
40 |
* support unaligned access. For a byte[] array, 8 bytes (64 bits) can be |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
41 |
* accessed and compared as a unit rather than individually, which increases |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
42 |
* the performance when the method is compiled by the HotSpot VM. On supported |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
43 |
* platforms the mismatch implementation is intrinsified to leverage SIMD |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
44 |
* instructions. So for a byte[] array, 16 bytes (128 bits), 32 bytes |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
45 |
* (256 bits), and perhaps in the future even 64 bytes (512 bits), platform |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
46 |
* permitting, can be accessed and compared as a unit, which further increases |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
47 |
* the performance over the Java implementation. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
48 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
49 |
* <p>None of the mismatch methods perform array bounds checks. It is the |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
50 |
* responsibility of the caller (direct or otherwise) to perform such checks |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
51 |
* before calling this method. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
52 |
*/ |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
53 |
class ArraysSupport { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
54 |
static final Unsafe U = Unsafe.getUnsafe(); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
55 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
56 |
private static final boolean BIG_ENDIAN = U.isBigEndian(); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
57 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
58 |
private static final int LOG2_ARRAY_BOOLEAN_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
59 |
private static final int LOG2_ARRAY_BYTE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BYTE_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
60 |
private static final int LOG2_ARRAY_CHAR_INDEX_SCALE = exactLog2(Unsafe.ARRAY_CHAR_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
61 |
private static final int LOG2_ARRAY_SHORT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_SHORT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
62 |
private static final int LOG2_ARRAY_INT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_INT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
63 |
private static final int LOG2_ARRAY_LONG_INDEX_SCALE = exactLog2(Unsafe.ARRAY_LONG_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
64 |
private static final int LOG2_ARRAY_FLOAT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_FLOAT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
65 |
private static final int LOG2_ARRAY_DOUBLE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_DOUBLE_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
66 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
67 |
private static final int LOG2_BYTE_BIT_SIZE = exactLog2(Byte.SIZE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
68 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
69 |
private static int exactLog2(int scale) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
70 |
if ((scale & (scale - 1)) != 0) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
71 |
throw new Error("data type scale not a power of two"); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
72 |
return Integer.numberOfTrailingZeros(scale); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
73 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
74 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
75 |
private ArraysSupport() {} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
76 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
77 |
/** |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
78 |
* Find the relative index of the first mismatching pair of elements in two |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
79 |
* primitive arrays of the same component type. Pairs of elements will be |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
80 |
* tested in order relative to given offsets into both arrays. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
81 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
82 |
* <p>This method does not perform type checks or bounds checks. It is the |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
83 |
* responsibility of the caller to perform such checks before calling this |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
84 |
* method. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
85 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
86 |
* <p>The given offsets, in bytes, need not be aligned according to the |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
87 |
* given log<sub>2</sub> size the array elements. More specifically, an |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
88 |
* offset modulus the size need not be zero. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
89 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
90 |
* @param a the first array to be tested for mismatch, or {@code null} for |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
91 |
* direct memory access |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
92 |
* @param aOffset the relative offset, in bytes, from the base address of |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
93 |
* the first array to test from, otherwise if the first array is |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
94 |
* {@code null}, an absolute address pointing to the first element to test. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
95 |
* @param b the second array to be tested for mismatch, or {@code null} for |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
96 |
* direct memory access |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
97 |
* @param bOffset the relative offset, in bytes, from the base address of |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
98 |
* the second array to test from, otherwise if the second array is |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
99 |
* {@code null}, an absolute address pointing to the first element to test. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
100 |
* @param length the number of array elements to test |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
101 |
* @param log2ArrayIndexScale log<sub>2</sub> of the array index scale, that |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
102 |
* corresponds to the size, in bytes, of an array element. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
103 |
* @return if a mismatch is found a relative index, between 0 (inclusive) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
104 |
* and {@code length} (exclusive), of the first mismatching pair of elements |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
105 |
* in the two arrays. Otherwise, if a mismatch is not found the bitwise |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
106 |
* compliment of the number of remaining pairs of elements to be checked in |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
107 |
* the tail of the two arrays. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
108 |
*/ |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
109 |
@HotSpotIntrinsicCandidate |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
110 |
static int vectorizedMismatch(Object a, long aOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
111 |
Object b, long bOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
112 |
int length, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
113 |
int log2ArrayIndexScale) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
114 |
// assert a.getClass().isArray(); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
115 |
// assert b.getClass().isArray(); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
116 |
// assert 0 <= length <= sizeOf(a) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
117 |
// assert 0 <= length <= sizeOf(b) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
118 |
// assert 0 <= log2ArrayIndexScale <= 3 |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
119 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
120 |
int log2ValuesPerWidth = LOG2_ARRAY_LONG_INDEX_SCALE - log2ArrayIndexScale; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
121 |
int wi = 0; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
122 |
for (; wi < length >> log2ValuesPerWidth; wi++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
123 |
long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
124 |
long av = U.getLongUnaligned(a, aOffset + bi); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
125 |
long bv = U.getLongUnaligned(b, bOffset + bi); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
126 |
if (av != bv) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
127 |
long x = av ^ bv; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
128 |
int o = BIG_ENDIAN |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
129 |
? Long.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
130 |
: Long.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
131 |
return (wi << log2ValuesPerWidth) + o; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
132 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
133 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
134 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
135 |
// Calculate the tail of remaining elements to check |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
136 |
int tail = length - (wi << log2ValuesPerWidth); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
137 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
138 |
if (log2ArrayIndexScale < LOG2_ARRAY_INT_INDEX_SCALE) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
139 |
int wordTail = 1 << (LOG2_ARRAY_INT_INDEX_SCALE - log2ArrayIndexScale); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
140 |
// Handle 4 bytes or 2 chars in the tail using int width |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
141 |
if (tail >= wordTail) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
142 |
long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
143 |
int av = U.getIntUnaligned(a, aOffset + bi); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
144 |
int bv = U.getIntUnaligned(b, bOffset + bi); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
145 |
if (av != bv) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
146 |
int x = av ^ bv; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
147 |
int o = BIG_ENDIAN |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
148 |
? Integer.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
149 |
: Integer.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
150 |
return (wi << log2ValuesPerWidth) + o; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
151 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
152 |
tail -= wordTail; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
153 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
154 |
return ~tail; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
155 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
156 |
else { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
157 |
return ~tail; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
158 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
159 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
160 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
161 |
// Booleans |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
162 |
// Each boolean element takes up one byte |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
163 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
164 |
static int mismatch(boolean[] a, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
165 |
boolean[] b, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
166 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
167 |
int i = 0; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
168 |
if (length > 7) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
169 |
i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
170 |
a, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
171 |
b, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
172 |
length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
173 |
if (i >= 0) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
174 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
175 |
i = length - ~i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
176 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
177 |
for (; i < length; i++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
178 |
if (a[i] != b[i]) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
179 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
180 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
181 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
182 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
183 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
184 |
static int mismatch(boolean[] a, int aFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
185 |
boolean[] b, int bFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
186 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
187 |
int i = 0; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
188 |
if (length > 7) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
189 |
int aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
190 |
int bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
191 |
i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
192 |
a, aOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
193 |
b, bOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
194 |
length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
195 |
if (i >= 0) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
196 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
197 |
i = length - ~i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
198 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
199 |
for (; i < length; i++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
200 |
if (a[aFromIndex + i] != b[bFromIndex + i]) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
201 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
202 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
203 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
204 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
205 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
206 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
207 |
// Bytes |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
208 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
209 |
/** |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
210 |
* Find the index of a mismatch between two arrays. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
211 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
212 |
* <p>This method does not perform bounds checks. It is the responsibility |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
213 |
* of the caller to perform such bounds checks before calling this method. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
214 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
215 |
* @param a the first array to be tested for a mismatch |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
216 |
* @param b the second array to be tested for a mismatch |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
217 |
* @param length the number of bytes from each array to check |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
218 |
* @return the index of a mismatch between the two arrays, otherwise -1 if |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
219 |
* no mismatch. The index will be within the range of (inclusive) 0 to |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
220 |
* (exclusive) the smaller of the two array lengths. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
221 |
*/ |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
222 |
static int mismatch(byte[] a, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
223 |
byte[] b, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
224 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
225 |
// ISSUE: defer to index receiving methods if performance is good |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
226 |
// assert length <= a.length |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
227 |
// assert length <= b.length |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
228 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
229 |
int i = 0; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
230 |
if (length > 7) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
231 |
i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
232 |
a, Unsafe.ARRAY_BYTE_BASE_OFFSET, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
233 |
b, Unsafe.ARRAY_BYTE_BASE_OFFSET, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
234 |
length, LOG2_ARRAY_BYTE_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
235 |
if (i >= 0) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
236 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
237 |
// Align to tail |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
238 |
i = length - ~i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
239 |
// assert i >= 0 && i <= 7; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
240 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
241 |
// Tail < 8 bytes |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
242 |
for (; i < length; i++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
243 |
if (a[i] != b[i]) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
244 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
245 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
246 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
247 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
248 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
249 |
/** |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
250 |
* Find the relative index of a mismatch between two arrays starting from |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
251 |
* given indexes. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
252 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
253 |
* <p>This method does not perform bounds checks. It is the responsibility |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
254 |
* of the caller to perform such bounds checks before calling this method. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
255 |
* |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
256 |
* @param a the first array to be tested for a mismatch |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
257 |
* @param aFromIndex the index of the first element (inclusive) in the first |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
258 |
* array to be compared |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
259 |
* @param b the second array to be tested for a mismatch |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
260 |
* @param bFromIndex the index of the first element (inclusive) in the |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
261 |
* second array to be compared |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
262 |
* @param length the number of bytes from each array to check |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
263 |
* @return the relative index of a mismatch between the two arrays, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
264 |
* otherwise -1 if no mismatch. The index will be within the range of |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
265 |
* (inclusive) 0 to (exclusive) the smaller of the two array bounds. |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
266 |
*/ |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
267 |
static int mismatch(byte[] a, int aFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
268 |
byte[] b, int bFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
269 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
270 |
// assert 0 <= aFromIndex < a.length |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
271 |
// assert 0 <= aFromIndex + length <= a.length |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
272 |
// assert 0 <= bFromIndex < b.length |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
273 |
// assert 0 <= bFromIndex + length <= b.length |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
274 |
// assert length >= 0 |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
275 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
276 |
int i = 0; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
277 |
if (length > 7) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
278 |
int aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
279 |
int bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
280 |
i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
281 |
a, aOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
282 |
b, bOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
283 |
length, LOG2_ARRAY_BYTE_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
284 |
if (i >= 0) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
285 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
286 |
i = length - ~i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
287 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
288 |
for (; i < length; i++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
289 |
if (a[aFromIndex + i] != b[bFromIndex + i]) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
290 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
291 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
292 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
293 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
294 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
295 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
296 |
// Chars |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
297 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
298 |
static int mismatch(char[] a, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
299 |
char[] b, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
300 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
301 |
int i = 0; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
302 |
if (length > 3) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
303 |
i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
304 |
a, Unsafe.ARRAY_CHAR_BASE_OFFSET, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
305 |
b, Unsafe.ARRAY_CHAR_BASE_OFFSET, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
306 |
length, LOG2_ARRAY_CHAR_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
307 |
if (i >= 0) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
308 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
309 |
i = length - ~i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
310 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
311 |
for (; i < length; i++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
312 |
if (a[i] != b[i]) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
313 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
314 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
315 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
316 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
317 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
318 |
static int mismatch(char[] a, int aFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
319 |
char[] b, int bFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
320 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
321 |
int i = 0; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
322 |
if (length > 3) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
323 |
int aOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
324 |
int bOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
325 |
i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
326 |
a, aOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
327 |
b, bOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
328 |
length, LOG2_ARRAY_CHAR_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
329 |
if (i >= 0) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
330 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
331 |
i = length - ~i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
332 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
333 |
for (; i < length; i++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
334 |
if (a[aFromIndex + i] != b[bFromIndex + i]) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
335 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
336 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
337 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
338 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
339 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
340 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
341 |
// Shorts |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
342 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
343 |
static int mismatch(short[] a, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
344 |
short[] b, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
345 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
346 |
int i = 0; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
347 |
if (length > 3) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
348 |
i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
349 |
a, Unsafe.ARRAY_SHORT_BASE_OFFSET, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
350 |
b, Unsafe.ARRAY_SHORT_BASE_OFFSET, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
351 |
length, LOG2_ARRAY_SHORT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
352 |
if (i >= 0) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
353 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
354 |
i = length - ~i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
355 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
356 |
for (; i < length; i++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
357 |
if (a[i] != b[i]) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
358 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
359 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
360 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
361 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
362 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
363 |
static int mismatch(short[] a, int aFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
364 |
short[] b, int bFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
365 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
366 |
int i = 0; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
367 |
if (length > 3) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
368 |
int aOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
369 |
int bOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
370 |
i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
371 |
a, aOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
372 |
b, bOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
373 |
length, LOG2_ARRAY_SHORT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
374 |
if (i >= 0) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
375 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
376 |
i = length - ~i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
377 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
378 |
for (; i < length; i++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
379 |
if (a[aFromIndex + i] != b[bFromIndex + i]) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
380 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
381 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
382 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
383 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
384 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
385 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
386 |
// Ints |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
387 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
388 |
static int mismatch(int[] a, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
389 |
int[] b, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
390 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
391 |
int i = 0; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
392 |
if (length > 1) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
393 |
i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
394 |
a, Unsafe.ARRAY_INT_BASE_OFFSET, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
395 |
b, Unsafe.ARRAY_INT_BASE_OFFSET, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
396 |
length, LOG2_ARRAY_INT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
397 |
if (i >= 0) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
398 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
399 |
i = length - ~i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
400 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
401 |
for (; i < length; i++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
402 |
if (a[i] != b[i]) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
403 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
404 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
405 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
406 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
407 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
408 |
static int mismatch(int[] a, int aFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
409 |
int[] b, int bFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
410 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
411 |
int i = 0; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
412 |
if (length > 1) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
413 |
int aOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_INT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
414 |
int bOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_INT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
415 |
i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
416 |
a, aOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
417 |
b, bOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
418 |
length, LOG2_ARRAY_INT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
419 |
if (i >= 0) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
420 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
421 |
i = length - ~i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
422 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
423 |
for (; i < length; i++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
424 |
if (a[aFromIndex + i] != b[bFromIndex + i]) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
425 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
426 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
427 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
428 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
429 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
430 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
431 |
// Floats |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
432 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
433 |
static int mismatch(float[] a, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
434 |
float[] b, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
435 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
436 |
return mismatch(a, 0, b, 0, length); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
437 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
438 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
439 |
static int mismatch(float[] a, int aFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
440 |
float[] b, int bFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
441 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
442 |
int i = 0; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
443 |
if (length > 1) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
444 |
int aOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
445 |
int bOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
446 |
i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
447 |
a, aOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
448 |
b, bOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
449 |
length, LOG2_ARRAY_FLOAT_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
450 |
// Mismatched |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
451 |
if (i >= 0) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
452 |
// Check if mismatch is not associated with two NaN values |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
453 |
if (!Float.isNaN(a[aFromIndex + i]) || !Float.isNaN(b[bFromIndex + i])) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
454 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
455 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
456 |
// Mismatch on two different NaN values that are normalized to match |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
457 |
// Fall back to slow mechanism |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
458 |
// ISSUE: Consider looping over vectorizedMismatch adjusting ranges |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
459 |
// However, requires that returned value be relative to input ranges |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
460 |
i++; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
461 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
462 |
// Matched |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
463 |
else { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
464 |
i = length - ~i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
465 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
466 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
467 |
for (; i < length; i++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
468 |
if (Float.floatToIntBits(a[aFromIndex + i]) != Float.floatToIntBits(b[bFromIndex + i])) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
469 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
470 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
471 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
472 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
473 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
474 |
// 64 bit sizes |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
475 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
476 |
// Long |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
477 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
478 |
static int mismatch(long[] a, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
479 |
long[] b, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
480 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
481 |
if (length == 0) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
482 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
483 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
484 |
int i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
485 |
a, Unsafe.ARRAY_LONG_BASE_OFFSET, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
486 |
b, Unsafe.ARRAY_LONG_BASE_OFFSET, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
487 |
length, LOG2_ARRAY_LONG_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
488 |
return i >= 0 ? i : -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
489 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
490 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
491 |
static int mismatch(long[] a, int aFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
492 |
long[] b, int bFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
493 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
494 |
if (length == 0) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
495 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
496 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
497 |
int aOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
498 |
int bOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
499 |
int i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
500 |
a, aOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
501 |
b, bOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
502 |
length, LOG2_ARRAY_LONG_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
503 |
return i >= 0 ? i : -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
504 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
505 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
506 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
507 |
// Double |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
508 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
509 |
static int mismatch(double[] a, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
510 |
double[] b, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
511 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
512 |
return mismatch(a, 0, b, 0, length); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
513 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
514 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
515 |
static int mismatch(double[] a, int aFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
516 |
double[] b, int bFromIndex, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
517 |
int length) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
518 |
if (length == 0) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
519 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
520 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
521 |
int aOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
522 |
int bOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
523 |
int i = vectorizedMismatch( |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
524 |
a, aOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
525 |
b, bOffset, |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
526 |
length, LOG2_ARRAY_DOUBLE_INDEX_SCALE); |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
527 |
if (i >= 0) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
528 |
// Check if mismatch is not associated with two NaN values |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
529 |
if (!Double.isNaN(a[aFromIndex + i]) || !Double.isNaN(b[bFromIndex + i])) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
530 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
531 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
532 |
// Mismatch on two different NaN values that are normalized to match |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
533 |
// Fall back to slow mechanism |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
534 |
// ISSUE: Consider looping over vectorizedMismatch adjusting ranges |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
535 |
// However, requires that returned value be relative to input ranges |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
536 |
i++; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
537 |
for (; i < length; i++) { |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
538 |
if (Double.doubleToLongBits(a[aFromIndex + i]) != Double.doubleToLongBits(b[bFromIndex + i])) |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
539 |
return i; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
540 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
541 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
542 |
|
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
543 |
return -1; |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
544 |
} |
6f0bf592d149
8136924: Vectorized support for array equals/compare/mismatch using Unsafe
psandoz
parents:
diff
changeset
|
545 |
} |