mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8374078: C2_MacroAssembler::verify_int_in_range has incorrect early return condition
Reviewed-by: kvn, dlong
This commit is contained in:
parent
fe5911c769
commit
8ab7d3b89f
@ -2547,26 +2547,22 @@ void C2_MacroAssembler::verify_int_in_range(uint idx, const TypeInt* t, Register
|
||||
if (t == TypeInt::INT) {
|
||||
return;
|
||||
}
|
||||
|
||||
BLOCK_COMMENT("verify_int_in_range {");
|
||||
Label L_success, L_failure;
|
||||
|
||||
jint lo = t->_lo;
|
||||
jint hi = t->_hi;
|
||||
|
||||
if (lo != min_jint && hi != max_jint) {
|
||||
if (lo != min_jint) {
|
||||
subsw(rtmp, rval, lo);
|
||||
br(Assembler::LT, L_failure);
|
||||
subsw(rtmp, rval, hi);
|
||||
br(Assembler::LE, L_success);
|
||||
} else if (lo != min_jint) {
|
||||
subsw(rtmp, rval, lo);
|
||||
br(Assembler::GE, L_success);
|
||||
} else if (hi != max_jint) {
|
||||
subsw(rtmp, rval, hi);
|
||||
br(Assembler::LE, L_success);
|
||||
} else {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
if (hi != max_jint) {
|
||||
subsw(rtmp, rval, hi);
|
||||
br(Assembler::GT, L_failure);
|
||||
}
|
||||
b(L_success);
|
||||
|
||||
bind(L_failure);
|
||||
movw(c_rarg0, idx);
|
||||
@ -2590,26 +2586,22 @@ void C2_MacroAssembler::verify_long_in_range(uint idx, const TypeLong* t, Regist
|
||||
if (t == TypeLong::LONG) {
|
||||
return;
|
||||
}
|
||||
|
||||
BLOCK_COMMENT("verify_long_in_range {");
|
||||
Label L_success, L_failure;
|
||||
|
||||
jlong lo = t->_lo;
|
||||
jlong hi = t->_hi;
|
||||
|
||||
if (lo != min_jlong && hi != max_jlong) {
|
||||
if (lo != min_jlong) {
|
||||
subs(rtmp, rval, lo);
|
||||
br(Assembler::LT, L_failure);
|
||||
subs(rtmp, rval, hi);
|
||||
br(Assembler::LE, L_success);
|
||||
} else if (lo != min_jlong) {
|
||||
subs(rtmp, rval, lo);
|
||||
br(Assembler::GE, L_success);
|
||||
} else if (hi != max_jlong) {
|
||||
subs(rtmp, rval, hi);
|
||||
br(Assembler::LE, L_success);
|
||||
} else {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
if (hi != max_jlong) {
|
||||
subs(rtmp, rval, hi);
|
||||
br(Assembler::GT, L_failure);
|
||||
}
|
||||
b(L_success);
|
||||
|
||||
bind(L_failure);
|
||||
movw(c_rarg0, idx);
|
||||
|
||||
@ -617,17 +617,16 @@ void C2_MacroAssembler::verify_int_in_range(uint idx, const TypeInt* t, Register
|
||||
BLOCK_COMMENT("CastII {");
|
||||
Label fail;
|
||||
Label succeed;
|
||||
if (hi == max_jint) {
|
||||
|
||||
if (lo != min_jint) {
|
||||
cmpl(val, lo);
|
||||
jccb(Assembler::greaterEqual, succeed);
|
||||
} else {
|
||||
if (lo != min_jint) {
|
||||
cmpl(val, lo);
|
||||
jccb(Assembler::less, fail);
|
||||
}
|
||||
cmpl(val, hi);
|
||||
jccb(Assembler::lessEqual, succeed);
|
||||
jccb(Assembler::less, fail);
|
||||
}
|
||||
if (hi != max_jint) {
|
||||
cmpl(val, hi);
|
||||
jccb(Assembler::greater, fail);
|
||||
}
|
||||
jmpb(succeed);
|
||||
|
||||
bind(fail);
|
||||
movl(c_rarg0, idx);
|
||||
@ -666,17 +665,15 @@ void C2_MacroAssembler::verify_long_in_range(uint idx, const TypeLong* t, Regist
|
||||
}
|
||||
};
|
||||
|
||||
if (hi == max_jlong) {
|
||||
if (lo != min_jlong) {
|
||||
cmp_val(lo);
|
||||
jccb(Assembler::greaterEqual, succeed);
|
||||
} else {
|
||||
if (lo != min_jlong) {
|
||||
cmp_val(lo);
|
||||
jccb(Assembler::less, fail);
|
||||
}
|
||||
cmp_val(hi);
|
||||
jccb(Assembler::lessEqual, succeed);
|
||||
jccb(Assembler::less, fail);
|
||||
}
|
||||
if (hi != max_jlong) {
|
||||
cmp_val(hi);
|
||||
jccb(Assembler::greater, fail);
|
||||
}
|
||||
jmpb(succeed);
|
||||
|
||||
bind(fail);
|
||||
movl(c_rarg0, idx);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user