< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64StringLatin1Substitutions.java
Print this page
rev 56282 : [mq]: graal
*** 1,7 ****
/*
! * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 132,143 ****
// The empty string contains nothing except the empty string.
return -1;
}
if (targetCount == 1) {
return AMD64ArrayIndexOf.indexOf1Byte(source, sourceCount, fromIndex, target[0]);
- } else if (targetCount == 2) {
- return AMD64ArrayIndexOf.indexOfTwoConsecutiveBytes(source, sourceCount, fromIndex, target[0], target[1]);
} else {
int haystackLength = sourceCount - (targetCount - 2);
int offset = fromIndex;
while (offset < haystackLength) {
int indexOfResult = AMD64ArrayIndexOf.indexOfTwoConsecutiveBytes(source, haystackLength, offset, target[0], target[1]);
--- 132,141 ----
*** 145,155 ****
return -1;
}
offset = indexOfResult;
Pointer cmpSourcePointer = byteOffsetPointer(source, offset);
Pointer targetPointer = pointer(target);
! if (ArrayRegionEqualsNode.regionEquals(cmpSourcePointer, targetPointer, targetCount, JavaKind.Byte)) {
return offset;
}
offset++;
}
return -1;
--- 143,153 ----
return -1;
}
offset = indexOfResult;
Pointer cmpSourcePointer = byteOffsetPointer(source, offset);
Pointer targetPointer = pointer(target);
! if (targetCount == 2 || ArrayRegionEqualsNode.regionEquals(cmpSourcePointer, targetPointer, targetCount, JavaKind.Byte)) {
return offset;
}
offset++;
}
return -1;
< prev index next >