8321468: Remove StringUTF16::equals
Reviewed-by: rriggs, kvn
This commit is contained in:
parent
19e92201b4
commit
55c1446b68
src
hotspot
cpu
aarch64
ppc
riscv
s390
share
java.base/share/classes/java/lang
@ -17105,23 +17105,7 @@ instruct string_equalsL(iRegP_R1 str1, iRegP_R3 str2, iRegI_R4 cnt,
|
||||
ins_encode %{
|
||||
// Count is in 8-bit bytes; non-Compact chars are 16 bits.
|
||||
__ string_equals($str1$$Register, $str2$$Register,
|
||||
$result$$Register, $cnt$$Register, 1);
|
||||
%}
|
||||
ins_pipe(pipe_class_memory);
|
||||
%}
|
||||
|
||||
instruct string_equalsU(iRegP_R1 str1, iRegP_R3 str2, iRegI_R4 cnt,
|
||||
iRegI_R0 result, rFlagsReg cr)
|
||||
%{
|
||||
predicate(((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::UU);
|
||||
match(Set result (StrEquals (Binary str1 str2) cnt));
|
||||
effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt, KILL cr);
|
||||
|
||||
format %{ "String Equals $str1,$str2,$cnt -> $result" %}
|
||||
ins_encode %{
|
||||
// Count is in 8-bit bytes; non-Compact chars are 16 bits.
|
||||
__ string_equals($str1$$Register, $str2$$Register,
|
||||
$result$$Register, $cnt$$Register, 2);
|
||||
$result$$Register, $cnt$$Register);
|
||||
%}
|
||||
ins_pipe(pipe_class_memory);
|
||||
%}
|
||||
|
@ -5346,28 +5346,25 @@ address MacroAssembler::arrays_equals(Register a1, Register a2, Register tmp3,
|
||||
|
||||
// For Strings we're passed the address of the first characters in a1
|
||||
// and a2 and the length in cnt1.
|
||||
// elem_size is the element size in bytes: either 1 or 2.
|
||||
// There are two implementations. For arrays >= 8 bytes, all
|
||||
// comparisons (including the final one, which may overlap) are
|
||||
// performed 8 bytes at a time. For strings < 8 bytes, we compare a
|
||||
// halfword, then a short, and then a byte.
|
||||
|
||||
void MacroAssembler::string_equals(Register a1, Register a2,
|
||||
Register result, Register cnt1, int elem_size)
|
||||
Register result, Register cnt1)
|
||||
{
|
||||
Label SAME, DONE, SHORT, NEXT_WORD;
|
||||
Register tmp1 = rscratch1;
|
||||
Register tmp2 = rscratch2;
|
||||
Register cnt2 = tmp2; // cnt2 only used in array length compare
|
||||
|
||||
assert(elem_size == 1 || elem_size == 2, "must be 2 or 1 byte");
|
||||
assert_different_registers(a1, a2, result, cnt1, rscratch1, rscratch2);
|
||||
|
||||
#ifndef PRODUCT
|
||||
{
|
||||
const char kind = (elem_size == 2) ? 'U' : 'L';
|
||||
char comment[64];
|
||||
snprintf(comment, sizeof comment, "{string_equals%c", kind);
|
||||
snprintf(comment, sizeof comment, "{string_equalsL");
|
||||
BLOCK_COMMENT(comment);
|
||||
}
|
||||
#endif
|
||||
@ -5415,14 +5412,12 @@ void MacroAssembler::string_equals(Register a1, Register a2,
|
||||
cbnzw(tmp1, DONE);
|
||||
}
|
||||
bind(TAIL01);
|
||||
if (elem_size == 1) { // Only needed when comparing 1-byte elements
|
||||
tbz(cnt1, 0, SAME); // 0-1 bytes left.
|
||||
tbz(cnt1, 0, SAME); // 0-1 bytes left.
|
||||
{
|
||||
ldrb(tmp1, a1);
|
||||
ldrb(tmp2, a2);
|
||||
eorw(tmp1, tmp1, tmp2);
|
||||
cbnzw(tmp1, DONE);
|
||||
}
|
||||
ldrb(tmp1, a1);
|
||||
ldrb(tmp2, a2);
|
||||
eorw(tmp1, tmp1, tmp2);
|
||||
cbnzw(tmp1, DONE);
|
||||
}
|
||||
// Arrays are equal.
|
||||
bind(SAME);
|
||||
|
@ -1399,8 +1399,7 @@ public:
|
||||
address arrays_equals(Register a1, Register a2, Register result, Register cnt1,
|
||||
Register tmp1, Register tmp2, Register tmp3, int elem_size);
|
||||
|
||||
void string_equals(Register a1, Register a2, Register result, Register cnt1,
|
||||
int elem_size);
|
||||
void string_equals(Register a1, Register a2, Register result, Register cnt1);
|
||||
|
||||
void fill_words(Register base, Register cnt, Register value);
|
||||
address zero_words(Register base, uint64_t cnt);
|
||||
|
@ -12318,21 +12318,6 @@ instruct string_equalsL(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt, iRegIdst
|
||||
ins_pipe(pipe_class_default);
|
||||
%}
|
||||
|
||||
instruct string_equalsU(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt, iRegIdst result,
|
||||
iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
|
||||
predicate(((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::UU);
|
||||
match(Set result (StrEquals (Binary str1 str2) cnt));
|
||||
effect(TEMP_DEF result, USE_KILL str1, USE_KILL str2, USE_KILL cnt, TEMP tmp, KILL ctr, KILL cr0);
|
||||
ins_cost(300);
|
||||
format %{ "String Equals char[] $str1,$str2,$cnt -> $result \t// KILL $tmp" %}
|
||||
ins_encode %{
|
||||
__ array_equals(false, $str1$$Register, $str2$$Register,
|
||||
$cnt$$Register, $tmp$$Register,
|
||||
$result$$Register, false /* byte */);
|
||||
%}
|
||||
ins_pipe(pipe_class_default);
|
||||
%}
|
||||
|
||||
instruct array_equalsB(rarg1RegP ary1, rarg2RegP ary2, iRegIdst result,
|
||||
iRegIdst tmp1, iRegIdst tmp2, regCTR ctr, flagsRegCR0 cr0, flagsRegCR0 cr1) %{
|
||||
predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::LL);
|
||||
|
@ -1358,7 +1358,6 @@ void C2_MacroAssembler::arrays_equals(Register a1, Register a2, Register tmp3,
|
||||
|
||||
// For Strings we're passed the address of the first characters in a1
|
||||
// and a2 and the length in cnt1.
|
||||
// elem_size is the element size in bytes: either 1 or 2.
|
||||
// There are two implementations. For arrays >= 8 bytes, all
|
||||
// comparisons (for hw supporting unaligned access: including the final one,
|
||||
// which may overlap) are performed 8 bytes at a time.
|
||||
@ -1367,13 +1366,12 @@ void C2_MacroAssembler::arrays_equals(Register a1, Register a2, Register tmp3,
|
||||
// halfword, then a short, and then a byte.
|
||||
|
||||
void C2_MacroAssembler::string_equals(Register a1, Register a2,
|
||||
Register result, Register cnt1, int elem_size)
|
||||
Register result, Register cnt1)
|
||||
{
|
||||
Label SAME, DONE, SHORT, NEXT_WORD;
|
||||
Register tmp1 = t0;
|
||||
Register tmp2 = t1;
|
||||
|
||||
assert(elem_size == 1 || elem_size == 2, "must be 2 or 1 byte");
|
||||
assert_different_registers(a1, a2, result, cnt1, tmp1, tmp2);
|
||||
|
||||
BLOCK_COMMENT("string_equals {");
|
||||
@ -1439,15 +1437,13 @@ void C2_MacroAssembler::string_equals(Register a1, Register a2,
|
||||
}
|
||||
|
||||
bind(TAIL01);
|
||||
if (elem_size == 1) { // Only needed when comparing 1-byte elements
|
||||
// 0-1 bytes left.
|
||||
test_bit(tmp1, cnt1, 0);
|
||||
beqz(tmp1, SAME);
|
||||
{
|
||||
lbu(tmp1, Address(a1, 0));
|
||||
lbu(tmp2, Address(a2, 0));
|
||||
bne(tmp1, tmp2, DONE);
|
||||
}
|
||||
// 0-1 bytes left.
|
||||
test_bit(tmp1, cnt1, 0);
|
||||
beqz(tmp1, SAME);
|
||||
{
|
||||
lbu(tmp1, Address(a1, 0));
|
||||
lbu(tmp2, Address(a2, 0));
|
||||
bne(tmp1, tmp2, DONE);
|
||||
}
|
||||
|
||||
// Arrays are equal.
|
||||
@ -1985,7 +1981,7 @@ void C2_MacroAssembler::element_compare(Register a1, Register a2, Register resul
|
||||
mv(result, true);
|
||||
}
|
||||
|
||||
void C2_MacroAssembler::string_equals_v(Register a1, Register a2, Register result, Register cnt, int elem_size) {
|
||||
void C2_MacroAssembler::string_equals_v(Register a1, Register a2, Register result, Register cnt) {
|
||||
Label DONE;
|
||||
Register tmp1 = t0;
|
||||
Register tmp2 = t1;
|
||||
@ -1994,11 +1990,7 @@ void C2_MacroAssembler::string_equals_v(Register a1, Register a2, Register resul
|
||||
|
||||
mv(result, false);
|
||||
|
||||
if (elem_size == 2) {
|
||||
srli(cnt, cnt, 1);
|
||||
}
|
||||
|
||||
element_compare(a1, a2, result, cnt, tmp1, tmp2, v2, v4, v2, elem_size == 1, DONE);
|
||||
element_compare(a1, a2, result, cnt, tmp1, tmp2, v2, v4, v2, true, DONE);
|
||||
|
||||
bind(DONE);
|
||||
BLOCK_COMMENT("} string_equals_v");
|
||||
|
@ -92,8 +92,7 @@
|
||||
void arrays_hashcode_elload(Register dst, Address src, BasicType eltype);
|
||||
|
||||
void string_equals(Register r1, Register r2,
|
||||
Register result, Register cnt1,
|
||||
int elem_size);
|
||||
Register result, Register cnt1);
|
||||
|
||||
// refer to conditional_branches and float_conditional_branches
|
||||
static const int bool_test_bits = 3;
|
||||
@ -188,8 +187,7 @@
|
||||
void expand_bits_l_v(Register dst, Register src, Register mask);
|
||||
|
||||
void string_equals_v(Register r1, Register r2,
|
||||
Register result, Register cnt1,
|
||||
int elem_size);
|
||||
Register result, Register cnt1);
|
||||
|
||||
void arrays_equals_v(Register r1, Register r2,
|
||||
Register result, Register cnt1,
|
||||
|
@ -10375,23 +10375,7 @@ instruct string_equalsL(iRegP_R11 str1, iRegP_R13 str2, iRegI_R14 cnt,
|
||||
ins_encode %{
|
||||
// Count is in 8-bit bytes; non-Compact chars are 16 bits.
|
||||
__ string_equals($str1$$Register, $str2$$Register,
|
||||
$result$$Register, $cnt$$Register, 1);
|
||||
%}
|
||||
ins_pipe(pipe_class_memory);
|
||||
%}
|
||||
|
||||
instruct string_equalsU(iRegP_R11 str1, iRegP_R13 str2, iRegI_R14 cnt,
|
||||
iRegI_R10 result, rFlagsReg cr)
|
||||
%{
|
||||
predicate(!UseRVV && ((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::UU);
|
||||
match(Set result (StrEquals (Binary str1 str2) cnt));
|
||||
effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt, KILL cr);
|
||||
|
||||
format %{ "String Equals $str1, $str2, $cnt -> $result\t#@string_equalsU" %}
|
||||
ins_encode %{
|
||||
// Count is in 8-bit bytes; non-Compact chars are 16 bits.
|
||||
__ string_equals($str1$$Register, $str2$$Register,
|
||||
$result$$Register, $cnt$$Register, 2);
|
||||
$result$$Register, $cnt$$Register);
|
||||
%}
|
||||
ins_pipe(pipe_class_memory);
|
||||
%}
|
||||
|
@ -2614,24 +2614,7 @@ instruct vstring_equalsL(iRegP_R11 str1, iRegP_R13 str2, iRegI_R14 cnt,
|
||||
ins_encode %{
|
||||
// Count is in 8-bit bytes; non-Compact chars are 16 bits.
|
||||
__ string_equals_v($str1$$Register, $str2$$Register,
|
||||
$result$$Register, $cnt$$Register, 1);
|
||||
%}
|
||||
ins_pipe(pipe_class_memory);
|
||||
%}
|
||||
|
||||
instruct vstring_equalsU(iRegP_R11 str1, iRegP_R13 str2, iRegI_R14 cnt,
|
||||
iRegI_R10 result, vReg_V2 v2,
|
||||
vReg_V3 v3, vReg_V4 v4, vReg_V5 v5, rFlagsReg cr)
|
||||
%{
|
||||
predicate(UseRVV && ((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::UU);
|
||||
match(Set result (StrEquals (Binary str1 str2) cnt));
|
||||
effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt, TEMP v2, TEMP v3, TEMP v4, TEMP v5, KILL cr);
|
||||
|
||||
format %{ "String Equals $str1, $str2, $cnt -> $result\t#@string_equalsU" %}
|
||||
ins_encode %{
|
||||
// Count is in 8-bit bytes; non-Compact chars are 16 bits.
|
||||
__ string_equals_v($str1$$Register, $str2$$Register,
|
||||
$result$$Register, $cnt$$Register, 2);
|
||||
$result$$Register, $cnt$$Register);
|
||||
%}
|
||||
ins_pipe(pipe_class_memory);
|
||||
%}
|
||||
@ -3217,7 +3200,7 @@ instruct vcvtBtoX(vReg dst, vReg src) %{
|
||||
__ csrwi(CSR_FRM, C2_MacroAssembler::rne);
|
||||
__ vfcvt_f_x_v(as_VectorRegister($dst$$reg), as_VectorRegister($dst$$reg));
|
||||
} else {
|
||||
__ integer_extend_v(as_VectorRegister($dst$$reg), bt,
|
||||
__ integer_extend_v(as_VectorRegister($dst$$reg), bt,
|
||||
Matcher::vector_length(this), as_VectorRegister($src$$reg), T_BYTE);
|
||||
}
|
||||
%}
|
||||
|
@ -9843,24 +9843,10 @@ instruct string_equalsL(iRegP str1, iRegP str2, iRegI cnt, iRegI result, roddReg
|
||||
ins_pipe(pipe_class_dummy);
|
||||
%}
|
||||
|
||||
instruct string_equalsU(iRegP str1, iRegP str2, iRegI cnt, iRegI result, roddRegL oddReg, revenRegL evenReg, flagsReg cr) %{
|
||||
match(Set result (StrEquals (Binary str1 str2) cnt));
|
||||
effect(TEMP oddReg, TEMP evenReg, KILL cr); // R0, R1 are killed, too.
|
||||
predicate(((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::UU || ((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::none);
|
||||
ins_cost(300);
|
||||
format %{ "String Equals char[] $str1,$str2,$cnt -> $result" %}
|
||||
ins_encode %{
|
||||
__ array_equals(false, $str1$$Register, $str2$$Register,
|
||||
$cnt$$Register, $oddReg$$Register, $evenReg$$Register,
|
||||
$result$$Register, false /* byte */);
|
||||
%}
|
||||
ins_pipe(pipe_class_dummy);
|
||||
%}
|
||||
|
||||
instruct string_equals_imm(iRegP str1, iRegP str2, uimmI8 cnt, iRegI result, flagsReg cr) %{
|
||||
match(Set result (StrEquals (Binary str1 str2) cnt));
|
||||
effect(KILL cr); // R0 is killed, too.
|
||||
predicate(((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::LL || ((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::UU);
|
||||
predicate(((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::LL);
|
||||
ins_cost(100);
|
||||
format %{ "String Equals byte[] $str1,$str2,$cnt -> $result" %}
|
||||
ins_encode %{
|
||||
|
@ -222,7 +222,6 @@ bool vmIntrinsics::disabled_by_jvm_flags(vmIntrinsics::ID id) {
|
||||
case vmIntrinsics::_compareToLU:
|
||||
case vmIntrinsics::_compareToUL:
|
||||
case vmIntrinsics::_equalsL:
|
||||
case vmIntrinsics::_equalsU:
|
||||
case vmIntrinsics::_equalsC:
|
||||
case vmIntrinsics::_vectorizedHashCode:
|
||||
case vmIntrinsics::_getCharStringU:
|
||||
@ -532,7 +531,6 @@ bool vmIntrinsics::disabled_by_jvm_flags(vmIntrinsics::ID id) {
|
||||
if (!SpecialStringIndexOf) return true;
|
||||
break;
|
||||
case vmIntrinsics::_equalsL:
|
||||
case vmIntrinsics::_equalsU:
|
||||
if (!SpecialStringEquals) return true;
|
||||
break;
|
||||
case vmIntrinsics::_vectorizedHashCode:
|
||||
|
@ -402,7 +402,6 @@ class methodHandle;
|
||||
do_signature(indexOfI_signature, "([BI[BII)I") \
|
||||
do_signature(indexOfChar_signature, "([BIII)I") \
|
||||
do_intrinsic(_equalsL, java_lang_StringLatin1,equals_name, equalsB_signature, F_S) \
|
||||
do_intrinsic(_equalsU, java_lang_StringUTF16, equals_name, equalsB_signature, F_S) \
|
||||
\
|
||||
do_intrinsic(_isDigit, java_lang_CharacterDataLatin1, isDigit_name, int_bool_signature, F_R) \
|
||||
do_name( isDigit_name, "isDigit") \
|
||||
|
@ -245,7 +245,6 @@ bool C2Compiler::is_intrinsic_supported(vmIntrinsics::ID id) {
|
||||
if (!Matcher::match_rule_supported(Op_StrComp)) return false;
|
||||
break;
|
||||
case vmIntrinsics::_equalsL:
|
||||
case vmIntrinsics::_equalsU:
|
||||
if (!Matcher::match_rule_supported(Op_StrEquals)) return false;
|
||||
break;
|
||||
case vmIntrinsics::_vectorizedHashCode:
|
||||
|
@ -311,7 +311,6 @@ bool LibraryCallKit::try_to_inline(int predicate) {
|
||||
case vmIntrinsics::_indexOfL_char: return inline_string_indexOfChar(StrIntrinsicNode::L);
|
||||
|
||||
case vmIntrinsics::_equalsL: return inline_string_equals(StrIntrinsicNode::LL);
|
||||
case vmIntrinsics::_equalsU: return inline_string_equals(StrIntrinsicNode::UU);
|
||||
|
||||
case vmIntrinsics::_vectorizedHashCode: return inline_vectorizedHashCode();
|
||||
|
||||
|
@ -451,20 +451,6 @@ final class StringUTF16 {
|
||||
}
|
||||
}
|
||||
|
||||
@IntrinsicCandidate
|
||||
public static boolean equals(byte[] value, byte[] other) {
|
||||
if (value.length == other.length) {
|
||||
int len = value.length >> 1;
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (getChar(value, i) != getChar(other, i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@IntrinsicCandidate
|
||||
public static int compareTo(byte[] value, byte[] other) {
|
||||
int len1 = length(value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user