mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
8247696: Incorrect tail computation for large segments in AbstractMemorySegmentImpl::mismatch
Reviewed-by: psandoz, mcimadamore
This commit is contained in:
parent
6469685285
commit
7f69acc778
4 changed files with 99 additions and 18 deletions
|
@ -163,19 +163,24 @@ public class ArraysSupport {
|
|||
/**
|
||||
* Mismatch over long lengths.
|
||||
*/
|
||||
public static long vectorizedMismatchLarge(Object a, long aOffset,
|
||||
Object b, long bOffset,
|
||||
long length,
|
||||
int log2ArrayIndexScale) {
|
||||
public static long vectorizedMismatchLargeForBytes(Object a, long aOffset,
|
||||
Object b, long bOffset,
|
||||
long length) {
|
||||
long off = 0;
|
||||
long remaining = length;
|
||||
int i ;
|
||||
while (remaining > 7) {
|
||||
int size = (int) Math.min(Integer.MAX_VALUE, remaining);
|
||||
int i, size;
|
||||
boolean lastSubRange = false;
|
||||
while (remaining > 7 && !lastSubRange) {
|
||||
if (remaining > Integer.MAX_VALUE) {
|
||||
size = Integer.MAX_VALUE;
|
||||
} else {
|
||||
size = (int) remaining;
|
||||
lastSubRange = true;
|
||||
}
|
||||
i = vectorizedMismatch(
|
||||
a, aOffset + off,
|
||||
b, bOffset + off,
|
||||
size, log2ArrayIndexScale);
|
||||
size, LOG2_ARRAY_BYTE_INDEX_SCALE);
|
||||
if (i >= 0)
|
||||
return off + i;
|
||||
|
||||
|
@ -183,7 +188,7 @@ public class ArraysSupport {
|
|||
off += i;
|
||||
remaining -= i;
|
||||
}
|
||||
return ~off;
|
||||
return ~remaining;
|
||||
}
|
||||
|
||||
// Booleans
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue