6675699: need comprehensive fix for unconstrained ConvI2L with narrowed type

Emit CastII to make narrow ConvI2L dependent on the corresponding range check.

Reviewed-by: kvn, roland
This commit is contained in:
Tobias Hartmann 2016-01-18 08:40:25 +01:00
parent 01a4b31e78
commit ca56200977
18 changed files with 344 additions and 44 deletions

View file

@ -3343,6 +3343,11 @@ bool SWPointer::scaled_iv(Node* n) {
return true;
}
} else if (opc == Op_ConvI2L) {
if (n->in(1)->Opcode() == Op_CastII &&
n->in(1)->as_CastII()->has_range_check()) {
// Skip range check dependent CastII nodes
n = n->in(1);
}
if (scaled_iv_plus_offset(n->in(1))) {
NOT_PRODUCT(_tracer.scaled_iv_7(n);)
return true;
@ -3437,6 +3442,12 @@ bool SWPointer::offset_plus_k(Node* n, bool negate) {
if (invariant(n)) {
if (opc == Op_ConvI2L) {
n = n->in(1);
if (n->Opcode() == Op_CastII &&
n->as_CastII()->has_range_check()) {
// Skip range check dependent CastII nodes
assert(invariant(n), "sanity");
n = n->in(1);
}
}
if (n->bottom_type()->isa_int()) {
_negate_invar = negate;