Mercurial > hg > truffle
comparison src/share/vm/opto/escape.cpp @ 223:1dd146f17531
6716441: error in meet with +DoEscapeAnalysis
Summary: Set instance_id to InstanceBot for InstPtr->meet(AryPtr) when types are not related.
Reviewed-by: jrose, never
author | kvn |
---|---|
date | Thu, 26 Jun 2008 13:34:00 -0700 |
parents | 1e026f8da827 |
children | 9c2ecc2ffb12 524eca34ea76 |
comparison
equal
deleted
inserted
replaced
222:2a1a77d3458f | 223:1dd146f17531 |
---|---|
481 // Adjust the type and inputs of an AddP which computes the | 481 // Adjust the type and inputs of an AddP which computes the |
482 // address of a field of an instance | 482 // address of a field of an instance |
483 // | 483 // |
484 void ConnectionGraph::split_AddP(Node *addp, Node *base, PhaseGVN *igvn) { | 484 void ConnectionGraph::split_AddP(Node *addp, Node *base, PhaseGVN *igvn) { |
485 const TypeOopPtr *base_t = igvn->type(base)->isa_oopptr(); | 485 const TypeOopPtr *base_t = igvn->type(base)->isa_oopptr(); |
486 assert(base_t != NULL && base_t->is_instance(), "expecting instance oopptr"); | 486 assert(base_t != NULL && base_t->is_known_instance(), "expecting instance oopptr"); |
487 const TypeOopPtr *t = igvn->type(addp)->isa_oopptr(); | 487 const TypeOopPtr *t = igvn->type(addp)->isa_oopptr(); |
488 if (t == NULL) { | 488 if (t == NULL) { |
489 // We are computing a raw address for a store captured by an Initialize | 489 // We are computing a raw address for a store captured by an Initialize |
490 // compute an appropriate address type. | 490 // compute an appropriate address type. |
491 assert(igvn->type(addp) == TypeRawPtr::NOTNULL, "must be raw pointer"); | 491 assert(igvn->type(addp) == TypeRawPtr::NOTNULL, "must be raw pointer"); |
492 assert(addp->in(AddPNode::Address)->is_Proj(), "base of raw address must be result projection from allocation"); | 492 assert(addp->in(AddPNode::Address)->is_Proj(), "base of raw address must be result projection from allocation"); |
493 int offs = (int)igvn->find_intptr_t_con(addp->in(AddPNode::Offset), Type::OffsetBot); | 493 int offs = (int)igvn->find_intptr_t_con(addp->in(AddPNode::Offset), Type::OffsetBot); |
494 assert(offs != Type::OffsetBot, "offset must be a constant"); | 494 assert(offs != Type::OffsetBot, "offset must be a constant"); |
495 t = base_t->add_offset(offs)->is_oopptr(); | 495 t = base_t->add_offset(offs)->is_oopptr(); |
496 } | 496 } |
497 uint inst_id = base_t->instance_id(); | 497 int inst_id = base_t->instance_id(); |
498 assert(!t->is_instance() || t->instance_id() == inst_id, | 498 assert(!t->is_known_instance() || t->instance_id() == inst_id, |
499 "old type must be non-instance or match new type"); | 499 "old type must be non-instance or match new type"); |
500 const TypeOopPtr *tinst = base_t->add_offset(t->offset())->is_oopptr(); | 500 const TypeOopPtr *tinst = base_t->add_offset(t->offset())->is_oopptr(); |
501 // Do NOT remove the next call: ensure an new alias index is allocated | 501 // Do NOT remove the next call: ensure an new alias index is allocated |
502 // for the instance type | 502 // for the instance type |
503 int alias_idx = _compile->get_alias_index(tinst); | 503 int alias_idx = _compile->get_alias_index(tinst); |
507 // if the Address input is not the appropriate instance type | 507 // if the Address input is not the appropriate instance type |
508 // (due to intervening casts,) insert a cast | 508 // (due to intervening casts,) insert a cast |
509 Node *adr = addp->in(AddPNode::Address); | 509 Node *adr = addp->in(AddPNode::Address); |
510 const TypeOopPtr *atype = igvn->type(adr)->isa_oopptr(); | 510 const TypeOopPtr *atype = igvn->type(adr)->isa_oopptr(); |
511 if (atype != NULL && atype->instance_id() != inst_id) { | 511 if (atype != NULL && atype->instance_id() != inst_id) { |
512 assert(!atype->is_instance(), "no conflicting instances"); | 512 assert(!atype->is_known_instance(), "no conflicting instances"); |
513 const TypeOopPtr *new_atype = base_t->add_offset(atype->offset())->isa_oopptr(); | 513 const TypeOopPtr *new_atype = base_t->add_offset(atype->offset())->isa_oopptr(); |
514 Node *acast = new (_compile, 2) CastPPNode(adr, new_atype); | 514 Node *acast = new (_compile, 2) CastPPNode(adr, new_atype); |
515 acast->set_req(0, adr->in(0)); | 515 acast->set_req(0, adr->in(0)); |
516 igvn->set_type(acast, new_atype); | 516 igvn->set_type(acast, new_atype); |
517 record_for_optimizer(acast); | 517 record_for_optimizer(acast); |
661 Node* ConnectionGraph::find_inst_mem(Node *orig_mem, int alias_idx, GrowableArray<PhiNode *> &orig_phis, PhaseGVN *phase) { | 661 Node* ConnectionGraph::find_inst_mem(Node *orig_mem, int alias_idx, GrowableArray<PhiNode *> &orig_phis, PhaseGVN *phase) { |
662 if (orig_mem == NULL) | 662 if (orig_mem == NULL) |
663 return orig_mem; | 663 return orig_mem; |
664 Compile* C = phase->C; | 664 Compile* C = phase->C; |
665 const TypeOopPtr *tinst = C->get_adr_type(alias_idx)->isa_oopptr(); | 665 const TypeOopPtr *tinst = C->get_adr_type(alias_idx)->isa_oopptr(); |
666 bool is_instance = (tinst != NULL) && tinst->is_instance(); | 666 bool is_instance = (tinst != NULL) && tinst->is_known_instance(); |
667 Node *prev = NULL; | 667 Node *prev = NULL; |
668 Node *result = orig_mem; | 668 Node *result = orig_mem; |
669 while (prev != result) { | 669 while (prev != result) { |
670 prev = result; | 670 prev = result; |
671 if (result->is_Mem()) { | 671 if (result->is_Mem()) { |
691 } | 691 } |
692 } else if (proj_in->is_Initialize()) { | 692 } else if (proj_in->is_Initialize()) { |
693 AllocateNode* alloc = proj_in->as_Initialize()->allocation(); | 693 AllocateNode* alloc = proj_in->as_Initialize()->allocation(); |
694 // Stop if this is the initialization for the object instance which | 694 // Stop if this is the initialization for the object instance which |
695 // which contains this memory slice, otherwise skip over it. | 695 // which contains this memory slice, otherwise skip over it. |
696 if (alloc == NULL || alloc->_idx != tinst->instance_id()) { | 696 if (alloc == NULL || alloc->_idx != (uint)tinst->instance_id()) { |
697 result = proj_in->in(TypeFunc::Memory); | 697 result = proj_in->in(TypeFunc::Memory); |
698 } | 698 } |
699 } else if (proj_in->is_MemBar()) { | 699 } else if (proj_in->is_MemBar()) { |
700 result = proj_in->in(TypeFunc::Memory); | 700 result = proj_in->in(TypeFunc::Memory); |
701 } | 701 } |
885 set_map(alloc->_idx, n); | 885 set_map(alloc->_idx, n); |
886 set_map(n->_idx, alloc); | 886 set_map(n->_idx, alloc); |
887 const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); | 887 const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); |
888 if (t == NULL) | 888 if (t == NULL) |
889 continue; // not a TypeInstPtr | 889 continue; // not a TypeInstPtr |
890 tinst = t->cast_to_instance(ni); | 890 tinst = t->cast_to_instance_id(ni); |
891 igvn->hash_delete(n); | 891 igvn->hash_delete(n); |
892 igvn->set_type(n, tinst); | 892 igvn->set_type(n, tinst); |
893 n->raise_bottom_type(tinst); | 893 n->raise_bottom_type(tinst); |
894 igvn->hash_insert(n); | 894 igvn->hash_insert(n); |
895 record_for_optimizer(n); | 895 record_for_optimizer(n); |
957 if (elem == _phantom_object) | 957 if (elem == _phantom_object) |
958 continue; // Assume the value was set outside this method. | 958 continue; // Assume the value was set outside this method. |
959 Node *val = get_map(elem); // CheckCastPP node | 959 Node *val = get_map(elem); // CheckCastPP node |
960 TypeNode *tn = n->as_Type(); | 960 TypeNode *tn = n->as_Type(); |
961 tinst = igvn->type(val)->isa_oopptr(); | 961 tinst = igvn->type(val)->isa_oopptr(); |
962 assert(tinst != NULL && tinst->is_instance() && | 962 assert(tinst != NULL && tinst->is_known_instance() && |
963 tinst->instance_id() == elem , "instance type expected."); | 963 (uint)tinst->instance_id() == elem , "instance type expected."); |
964 | 964 |
965 const Type *tn_type = igvn->type(tn); | 965 const Type *tn_type = igvn->type(tn); |
966 const TypeOopPtr *tn_t = tn_type->make_ptr()->isa_oopptr(); | 966 const TypeOopPtr *tn_t; |
967 if (tn_type->isa_narrowoop()) { | |
968 tn_t = tn_type->make_ptr()->isa_oopptr(); | |
969 } else { | |
970 tn_t = tn_type->isa_oopptr(); | |
971 } | |
967 | 972 |
968 if (tn_t != NULL && | 973 if (tn_t != NULL && |
969 tinst->cast_to_instance(TypeOopPtr::UNKNOWN_INSTANCE)->higher_equal(tn_t)) { | 974 tinst->cast_to_instance_id(TypeOopPtr::InstanceBot)->higher_equal(tn_t)) { |
970 if (tn_type->isa_narrowoop()) { | 975 if (tn_type->isa_narrowoop()) { |
971 tn_type = tinst->make_narrowoop(); | 976 tn_type = tinst->make_narrowoop(); |
972 } else { | 977 } else { |
973 tn_type = tinst; | 978 tn_type = tinst; |
974 } | 979 } |