8386861: [lworld] emit_opSubstitutabilityCheck speedup

This commit is contained in:
Daisuke Yamazaki 2026-07-04 05:19:05 +09:00
parent 6b590fd86d
commit de9f998062
2 changed files with 14 additions and 10 deletions

View File

@ -1587,8 +1587,12 @@ void LIR_Assembler::emit_opSubstitutabilityCheck(LIR_OpSubstitutabilityCheck* op
Register left = op->left()->as_register();
Register right = op->right()->as_register();
__ cmp(left, right);
__ br(Assembler::EQ, L_oops_equal);
if (left == right) {
__ b(L_oops_equal);
} else {
__ cmp(left, right);
__ br(Assembler::EQ, L_oops_equal);
}
// (1) Null check -- if one of the operands is null, the other must not be null (because
// the two references are not equal), so they are not substitutable,

View File

@ -1595,8 +1595,12 @@ void LIR_Assembler::emit_opSubstitutabilityCheck(LIR_OpSubstitutabilityCheck* op
Register left = op->left()->as_register();
Register right = op->right()->as_register();
__ cmpptr(left, right);
__ jcc(Assembler::equal, L_oops_equal);
if (left == right) {
__ jmp(L_oops_equal);
} else {
__ cmpptr(left, right);
__ jcc(Assembler::equal, L_oops_equal);
}
// (1) Null check -- if one of the operands is null, the other must not be null (because
// the two references are not equal), so they are not substitutable,
@ -1628,12 +1632,8 @@ void LIR_Assembler::emit_opSubstitutabilityCheck(LIR_OpSubstitutabilityCheck* op
} else {
Register tmp1 = op->tmp1()->as_register();
Register tmp2 = op->tmp2()->as_register();
if (left == right) { // same operand, so clearly the same klasses, let's save the check
__ jmp (*op->stub()->entry()); // -> do slow check
} else {
__ cmp_klasses_from_objects(left, right, tmp1, tmp2);
__ jcc(Assembler::equal, *op->stub()->entry()); // same klass -> do slow check
}
__ cmp_klasses_from_objects(left, right, tmp1, tmp2);
__ jcc(Assembler::equal, *op->stub()->entry()); // same klass -> do slow check
// fall through to L_oops_not_equal
}