Mercurial > hg > truffle
comparison src/share/vm/opto/escape.cpp @ 235:9c2ecc2ffb12 jdk7-b31
Merge
author | trims |
---|---|
date | Fri, 11 Jul 2008 01:14:44 -0700 |
parents | d1605aabd0a1 1dd146f17531 |
children | 4a4c365f777d |
comparison
equal
deleted
inserted
replaced
197:de141433919f | 235:9c2ecc2ffb12 |
---|---|
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 TypeOopPtr *tn_t = NULL; | |
966 const Type *tn_type = igvn->type(tn); | 965 const Type *tn_type = igvn->type(tn); |
966 const TypeOopPtr *tn_t; | |
967 if (tn_type->isa_narrowoop()) { | 967 if (tn_type->isa_narrowoop()) { |
968 tn_t = tn_type->is_narrowoop()->make_oopptr()->isa_oopptr(); | 968 tn_t = tn_type->make_ptr()->isa_oopptr(); |
969 } else { | 969 } else { |
970 tn_t = tn_type->isa_oopptr(); | 970 tn_t = tn_type->isa_oopptr(); |
971 } | 971 } |
972 | 972 |
973 if (tn_t != NULL && | 973 if (tn_t != NULL && |
974 tinst->cast_to_instance(TypeOopPtr::UNKNOWN_INSTANCE)->higher_equal(tn_t)) { | 974 tinst->cast_to_instance_id(TypeOopPtr::InstanceBot)->higher_equal(tn_t)) { |
975 if (tn_type->isa_narrowoop()) { | 975 if (tn_type->isa_narrowoop()) { |
976 tn_type = tinst->make_narrowoop(); | 976 tn_type = tinst->make_narrowoop(); |
977 } else { | 977 } else { |
978 tn_type = tinst; | 978 tn_type = tinst; |
979 } | 979 } |
1919 } | 1919 } |
1920 case Op_StoreP: | 1920 case Op_StoreP: |
1921 case Op_StoreN: | 1921 case Op_StoreN: |
1922 { | 1922 { |
1923 const Type *adr_type = phase->type(n->in(MemNode::Address)); | 1923 const Type *adr_type = phase->type(n->in(MemNode::Address)); |
1924 if (adr_type->isa_narrowoop()) { | 1924 adr_type = adr_type->make_ptr(); |
1925 adr_type = adr_type->is_narrowoop()->make_oopptr(); | |
1926 } | |
1927 if (adr_type->isa_oopptr()) { | 1925 if (adr_type->isa_oopptr()) { |
1928 add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); | 1926 add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); |
1929 } else { | 1927 } else { |
1930 Node* adr = n->in(MemNode::Address); | 1928 Node* adr = n->in(MemNode::Address); |
1931 if (adr->is_AddP() && phase->type(adr) == TypeRawPtr::NOTNULL && | 1929 if (adr->is_AddP() && phase->type(adr) == TypeRawPtr::NOTNULL && |
1946 case Op_StorePConditional: | 1944 case Op_StorePConditional: |
1947 case Op_CompareAndSwapP: | 1945 case Op_CompareAndSwapP: |
1948 case Op_CompareAndSwapN: | 1946 case Op_CompareAndSwapN: |
1949 { | 1947 { |
1950 const Type *adr_type = phase->type(n->in(MemNode::Address)); | 1948 const Type *adr_type = phase->type(n->in(MemNode::Address)); |
1951 if (adr_type->isa_narrowoop()) { | 1949 adr_type = adr_type->make_ptr(); |
1952 adr_type = adr_type->is_narrowoop()->make_oopptr(); | |
1953 } | |
1954 if (adr_type->isa_oopptr()) { | 1950 if (adr_type->isa_oopptr()) { |
1955 add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); | 1951 add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); |
1956 } else { | 1952 } else { |
1957 _processed.set(n->_idx); | 1953 _processed.set(n->_idx); |
1958 return; | 1954 return; |
2129 case Op_StorePConditional: | 2125 case Op_StorePConditional: |
2130 case Op_CompareAndSwapP: | 2126 case Op_CompareAndSwapP: |
2131 case Op_CompareAndSwapN: | 2127 case Op_CompareAndSwapN: |
2132 { | 2128 { |
2133 Node *adr = n->in(MemNode::Address); | 2129 Node *adr = n->in(MemNode::Address); |
2134 const Type *adr_type = phase->type(adr); | 2130 const Type *adr_type = phase->type(adr)->make_ptr(); |
2135 if (adr_type->isa_narrowoop()) { | |
2136 adr_type = adr_type->is_narrowoop()->make_oopptr(); | |
2137 } | |
2138 #ifdef ASSERT | 2131 #ifdef ASSERT |
2139 if (!adr_type->isa_oopptr()) | 2132 if (!adr_type->isa_oopptr()) |
2140 assert(phase->type(adr) == TypeRawPtr::NOTNULL, "Op_StoreP"); | 2133 assert(phase->type(adr) == TypeRawPtr::NOTNULL, "Op_StoreP"); |
2141 #endif | 2134 #endif |
2142 | 2135 |