comparison src/share/vm/opto/memnode.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
comparison
equal deleted inserted replaced
222:2a1a77d3458f 223:1dd146f17531
89 89
90 #endif 90 #endif
91 91
92 Node *MemNode::optimize_simple_memory_chain(Node *mchain, const TypePtr *t_adr, PhaseGVN *phase) { 92 Node *MemNode::optimize_simple_memory_chain(Node *mchain, const TypePtr *t_adr, PhaseGVN *phase) {
93 const TypeOopPtr *tinst = t_adr->isa_oopptr(); 93 const TypeOopPtr *tinst = t_adr->isa_oopptr();
94 if (tinst == NULL || !tinst->is_instance_field()) 94 if (tinst == NULL || !tinst->is_known_instance_field())
95 return mchain; // don't try to optimize non-instance types 95 return mchain; // don't try to optimize non-instance types
96 uint instance_id = tinst->instance_id(); 96 uint instance_id = tinst->instance_id();
97 Node *prev = NULL; 97 Node *prev = NULL;
98 Node *result = mchain; 98 Node *result = mchain;
99 while (prev != result) { 99 while (prev != result) {
123 return result; 123 return result;
124 } 124 }
125 125
126 Node *MemNode::optimize_memory_chain(Node *mchain, const TypePtr *t_adr, PhaseGVN *phase) { 126 Node *MemNode::optimize_memory_chain(Node *mchain, const TypePtr *t_adr, PhaseGVN *phase) {
127 const TypeOopPtr *t_oop = t_adr->isa_oopptr(); 127 const TypeOopPtr *t_oop = t_adr->isa_oopptr();
128 bool is_instance = (t_oop != NULL) && t_oop->is_instance_field(); 128 bool is_instance = (t_oop != NULL) && t_oop->is_known_instance_field();
129 PhaseIterGVN *igvn = phase->is_IterGVN(); 129 PhaseIterGVN *igvn = phase->is_IterGVN();
130 Node *result = mchain; 130 Node *result = mchain;
131 result = optimize_simple_memory_chain(result, t_adr, phase); 131 result = optimize_simple_memory_chain(result, t_adr, phase);
132 if (is_instance && igvn != NULL && result->is_Phi()) { 132 if (is_instance && igvn != NULL && result->is_Phi()) {
133 PhiNode *mphi = result->as_Phi(); 133 PhiNode *mphi = result->as_Phi();
134 assert(mphi->bottom_type() == Type::MEMORY, "memory phi required"); 134 assert(mphi->bottom_type() == Type::MEMORY, "memory phi required");
135 const TypePtr *t = mphi->adr_type(); 135 const TypePtr *t = mphi->adr_type();
136 if (t == TypePtr::BOTTOM || t == TypeRawPtr::BOTTOM || 136 if (t == TypePtr::BOTTOM || t == TypeRawPtr::BOTTOM ||
137 t->isa_oopptr() && !t->is_oopptr()->is_instance() && 137 t->isa_oopptr() && !t->is_oopptr()->is_known_instance() &&
138 t->is_oopptr()->cast_to_instance(t_oop->instance_id()) == t_oop) { 138 t->is_oopptr()->cast_to_instance_id(t_oop->instance_id()) == t_oop) {
139 // clone the Phi with our address type 139 // clone the Phi with our address type
140 result = mphi->split_out_instance(t_adr, igvn); 140 result = mphi->split_out_instance(t_adr, igvn);
141 } else { 141 } else {
142 assert(phase->C->get_alias_index(t) == phase->C->get_alias_index(t_adr), "correct memory chain"); 142 assert(phase->C->get_alias_index(t) == phase->C->get_alias_index(t_adr), "correct memory chain");
143 } 143 }
468 if (known_identical) { 468 if (known_identical) {
469 // From caller, can_see_stored_value will consult find_captured_store. 469 // From caller, can_see_stored_value will consult find_captured_store.
470 return mem; // let caller handle steps (c), (d) 470 return mem; // let caller handle steps (c), (d)
471 } 471 }
472 472
473 } else if (addr_t != NULL && addr_t->is_instance_field()) { 473 } else if (addr_t != NULL && addr_t->is_known_instance_field()) {
474 // Can't use optimize_simple_memory_chain() since it needs PhaseGVN. 474 // Can't use optimize_simple_memory_chain() since it needs PhaseGVN.
475 if (mem->is_Proj() && mem->in(0)->is_Call()) { 475 if (mem->is_Proj() && mem->in(0)->is_Call()) {
476 CallNode *call = mem->in(0)->as_Call(); 476 CallNode *call = mem->in(0)->as_Call();
477 if (!call->may_modify(addr_t, phase)) { 477 if (!call->may_modify(addr_t, phase)) {
478 mem = call->in(TypeFunc::Memory); 478 mem = call->in(TypeFunc::Memory);
914 bool LoadNode::is_instance_field_load_with_local_phi(Node* ctrl) { 914 bool LoadNode::is_instance_field_load_with_local_phi(Node* ctrl) {
915 if( in(MemNode::Memory)->is_Phi() && in(MemNode::Memory)->in(0) == ctrl && 915 if( in(MemNode::Memory)->is_Phi() && in(MemNode::Memory)->in(0) == ctrl &&
916 in(MemNode::Address)->is_AddP() ) { 916 in(MemNode::Address)->is_AddP() ) {
917 const TypeOopPtr* t_oop = in(MemNode::Address)->bottom_type()->isa_oopptr(); 917 const TypeOopPtr* t_oop = in(MemNode::Address)->bottom_type()->isa_oopptr();
918 // Only instances. 918 // Only instances.
919 if( t_oop != NULL && t_oop->is_instance_field() && 919 if( t_oop != NULL && t_oop->is_known_instance_field() &&
920 t_oop->offset() != Type::OffsetBot && 920 t_oop->offset() != Type::OffsetBot &&
921 t_oop->offset() != Type::OffsetTop) { 921 t_oop->offset() != Type::OffsetTop) {
922 return true; 922 return true;
923 } 923 }
924 } 924 }
1137 Node* address = in(MemNode::Address); 1137 Node* address = in(MemNode::Address);
1138 const TypePtr *addr_t = phase->type(address)->isa_ptr(); 1138 const TypePtr *addr_t = phase->type(address)->isa_ptr();
1139 const TypeOopPtr *t_oop = addr_t->isa_oopptr(); 1139 const TypeOopPtr *t_oop = addr_t->isa_oopptr();
1140 1140
1141 assert(mem->is_Phi() && (t_oop != NULL) && 1141 assert(mem->is_Phi() && (t_oop != NULL) &&
1142 t_oop->is_instance_field(), "invalide conditions"); 1142 t_oop->is_known_instance_field(), "invalide conditions");
1143 1143
1144 Node *region = mem->in(0); 1144 Node *region = mem->in(0);
1145 if (region == NULL) { 1145 if (region == NULL) {
1146 return NULL; // Wait stable graph 1146 return NULL; // Wait stable graph
1147 } 1147 }
1305 set_req(MemNode::Memory, opt_mem); 1305 set_req(MemNode::Memory, opt_mem);
1306 return this; 1306 return this;
1307 } 1307 }
1308 const TypeOopPtr *t_oop = addr_t->isa_oopptr(); 1308 const TypeOopPtr *t_oop = addr_t->isa_oopptr();
1309 if (can_reshape && opt_mem->is_Phi() && 1309 if (can_reshape && opt_mem->is_Phi() &&
1310 (t_oop != NULL) && t_oop->is_instance_field()) { 1310 (t_oop != NULL) && t_oop->is_known_instance_field()) {
1311 // Split instance field load through Phi. 1311 // Split instance field load through Phi.
1312 Node* result = split_through_phi(phase); 1312 Node* result = split_through_phi(phase);
1313 if (result != NULL) return result; 1313 if (result != NULL) return result;
1314 } 1314 }
1315 } 1315 }
1540 if (value != NULL && value->is_Con()) 1540 if (value != NULL && value->is_Con())
1541 return value->bottom_type(); 1541 return value->bottom_type();
1542 } 1542 }
1543 1543
1544 const TypeOopPtr *tinst = tp->isa_oopptr(); 1544 const TypeOopPtr *tinst = tp->isa_oopptr();
1545 if (tinst != NULL && tinst->is_instance_field()) { 1545 if (tinst != NULL && tinst->is_known_instance_field()) {
1546 // If we have an instance type and our memory input is the 1546 // If we have an instance type and our memory input is the
1547 // programs's initial memory state, there is no matching store, 1547 // programs's initial memory state, there is no matching store,
1548 // so just return a zero of the appropriate type 1548 // so just return a zero of the appropriate type
1549 Node *mem = in(MemNode::Memory); 1549 Node *mem = in(MemNode::Memory);
1550 if (mem->is_Parm() && mem->in(0)->is_Start()) { 1550 if (mem->is_Parm() && mem->in(0)->is_Start()) {
2135 bool StoreNode::value_never_loaded( PhaseTransform *phase) const { 2135 bool StoreNode::value_never_loaded( PhaseTransform *phase) const {
2136 Node *adr = in(Address); 2136 Node *adr = in(Address);
2137 const TypeOopPtr *adr_oop = phase->type(adr)->isa_oopptr(); 2137 const TypeOopPtr *adr_oop = phase->type(adr)->isa_oopptr();
2138 if (adr_oop == NULL) 2138 if (adr_oop == NULL)
2139 return false; 2139 return false;
2140 if (!adr_oop->is_instance_field()) 2140 if (!adr_oop->is_known_instance_field())
2141 return false; // if not a distinct instance, there may be aliases of the address 2141 return false; // if not a distinct instance, there may be aliases of the address
2142 for (DUIterator_Fast imax, i = adr->fast_outs(imax); i < imax; i++) { 2142 for (DUIterator_Fast imax, i = adr->fast_outs(imax); i < imax; i++) {
2143 Node *use = adr->fast_out(i); 2143 Node *use = adr->fast_out(i);
2144 int opc = use->Opcode(); 2144 int opc = use->Opcode();
2145 if (use->is_Load() || use->is_LoadStore()) { 2145 if (use->is_Load() || use->is_LoadStore()) {