8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed

Type methods shouldn't always operate on speculative part

Reviewed-by: kvn, twisti
This commit is contained in:
Roland Westrelin 2014-01-24 09:31:53 +01:00
parent 91573b8695
commit c19a7e0fa3
18 changed files with 290 additions and 121 deletions

View file

@ -3919,16 +3919,18 @@ void Compile::remove_speculative_types(PhaseIterGVN &igvn) {
// which may optimize it out.
for (uint next = 0; next < worklist.size(); ++next) {
Node *n = worklist.at(next);
if (n->is_Type() && n->as_Type()->type()->isa_oopptr() != NULL &&
n->as_Type()->type()->is_oopptr()->speculative() != NULL) {
if (n->is_Type()) {
TypeNode* tn = n->as_Type();
const TypeOopPtr* t = tn->type()->is_oopptr();
bool in_hash = igvn.hash_delete(n);
assert(in_hash, "node should be in igvn hash table");
tn->set_type(t->remove_speculative());
igvn.hash_insert(n);
igvn._worklist.push(n); // give it a chance to go away
modified++;
const Type* t = tn->type();
const Type* t_no_spec = t->remove_speculative();
if (t_no_spec != t) {
bool in_hash = igvn.hash_delete(n);
assert(in_hash, "node should be in igvn hash table");
tn->set_type(t_no_spec);
igvn.hash_insert(n);
igvn._worklist.push(n); // give it a chance to go away
modified++;
}
}
uint max = n->len();
for( uint i = 0; i < max; ++i ) {
@ -3942,6 +3944,27 @@ void Compile::remove_speculative_types(PhaseIterGVN &igvn) {
if (modified > 0) {
igvn.optimize();
}
#ifdef ASSERT
// Verify that after the IGVN is over no speculative type has resurfaced
worklist.clear();
worklist.push(root());
for (uint next = 0; next < worklist.size(); ++next) {
Node *n = worklist.at(next);
const Type* t = igvn.type(n);
assert(t == t->remove_speculative(), "no more speculative types");
if (n->is_Type()) {
t = n->as_Type()->type();
assert(t == t->remove_speculative(), "no more speculative types");
}
uint max = n->len();
for( uint i = 0; i < max; ++i ) {
Node *m = n->in(i);
if (not_a_node(m)) continue;
worklist.push(m);
}
}
igvn.check_no_speculative_types();
#endif
}
}