mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-10 23:18:45 +00:00
8181741: C2 compilation fails with "assert(i<_max) failed: oob"
PhaseIdealLoop should not use type() or type_or_null(). Reviewed-by: roland, kvn
This commit is contained in:
parent
872c310c4f
commit
620b398ba3
@ -35,7 +35,7 @@
|
||||
//=============================================================================
|
||||
// If input is already higher or equal to cast type, then this is an identity.
|
||||
Node* ConstraintCastNode::Identity(PhaseGVN* phase) {
|
||||
Node* dom = dominating_cast(phase);
|
||||
Node* dom = dominating_cast(phase, phase);
|
||||
if (dom != NULL) {
|
||||
return dom;
|
||||
}
|
||||
@ -108,7 +108,7 @@ Node* ConstraintCastNode::make_cast(int opcode, Node* c, Node *n, const Type *t,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TypeNode* ConstraintCastNode::dominating_cast(PhaseTransform *phase) const {
|
||||
TypeNode* ConstraintCastNode::dominating_cast(PhaseGVN* gvn, PhaseTransform* pt) const {
|
||||
Node* val = in(1);
|
||||
Node* ctl = in(0);
|
||||
int opc = Opcode();
|
||||
@ -121,7 +121,7 @@ TypeNode* ConstraintCastNode::dominating_cast(PhaseTransform *phase) const {
|
||||
if (is_CastII() && as_CastII()->has_range_check()) {
|
||||
return NULL;
|
||||
}
|
||||
if (type()->isa_rawptr() && (phase->type_or_null(val) == NULL || phase->type(val)->isa_oopptr())) {
|
||||
if (type()->isa_rawptr() && (gvn->type_or_null(val) == NULL || gvn->type(val)->isa_oopptr())) {
|
||||
return NULL;
|
||||
}
|
||||
for (DUIterator_Fast imax, i = val->fast_outs(imax); i < imax; i++) {
|
||||
@ -131,7 +131,7 @@ TypeNode* ConstraintCastNode::dominating_cast(PhaseTransform *phase) const {
|
||||
u->Opcode() == opc &&
|
||||
u->in(0) != NULL &&
|
||||
u->bottom_type()->higher_equal(type())) {
|
||||
if (phase->is_dominator(u->in(0), ctl)) {
|
||||
if (pt->is_dominator(u->in(0), ctl)) {
|
||||
return u->as_Type();
|
||||
}
|
||||
if (is_CheckCastPP() && u->in(1)->is_Proj() && u->in(1)->in(0)->is_Allocate() &&
|
||||
@ -283,7 +283,7 @@ void CastIINode::dump_spec(outputStream* st) const {
|
||||
//------------------------------Identity---------------------------------------
|
||||
// If input is already higher or equal to cast type, then this is an identity.
|
||||
Node* CheckCastPPNode::Identity(PhaseGVN* phase) {
|
||||
Node* dom = dominating_cast(phase);
|
||||
Node* dom = dominating_cast(phase, phase);
|
||||
if (dom != NULL) {
|
||||
return dom;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ class ConstraintCastNode: public TypeNode {
|
||||
virtual uint ideal_reg() const = 0;
|
||||
virtual bool depends_only_on_test() const { return !_carry_dependency; }
|
||||
bool carry_dependency() const { return _carry_dependency; }
|
||||
TypeNode* dominating_cast(PhaseTransform *phase) const;
|
||||
TypeNode* dominating_cast(PhaseGVN* gvn, PhaseTransform* pt) const;
|
||||
static Node* make_cast(int opcode, Node* c, Node *n, const Type *t, bool carry_dependency);
|
||||
|
||||
#ifndef PRODUCT
|
||||
|
||||
@ -912,7 +912,7 @@ Node *PhaseIdealLoop::split_if_with_blocks_pre( Node *n ) {
|
||||
if( m ) return m;
|
||||
|
||||
if (n->is_ConstraintCast()) {
|
||||
Node* dom_cast = n->as_ConstraintCast()->dominating_cast(this);
|
||||
Node* dom_cast = n->as_ConstraintCast()->dominating_cast(&_igvn, this);
|
||||
if (dom_cast != NULL) {
|
||||
_igvn.replace_node(n, dom_cast);
|
||||
return dom_cast;
|
||||
|
||||
@ -211,6 +211,7 @@ public:
|
||||
// If you want the type of a very new (untransformed) node,
|
||||
// you must use type_or_null, and test the result for NULL.
|
||||
const Type* type(const Node* n) const {
|
||||
assert(_pnum != Ideal_Loop, "should not be used from PhaseIdealLoop");
|
||||
assert(n != NULL, "must not be null");
|
||||
const Type* t = _types.fast_lookup(n->_idx);
|
||||
assert(t != NULL, "must set before get");
|
||||
@ -219,6 +220,7 @@ public:
|
||||
// Get a previously recorded type for the node n,
|
||||
// or else return NULL if there is none.
|
||||
const Type* type_or_null(const Node* n) const {
|
||||
assert(_pnum != Ideal_Loop, "should not be used from PhaseIdealLoop");
|
||||
return _types.fast_lookup(n->_idx);
|
||||
}
|
||||
// Record a type for a node.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user