< prev index next >

src/hotspot/share/opto/memnode.cpp

Print this page

1118         if (ld_off != st_off)                                  return NULL;
1119         if (ld_off == Type::OffsetBot)                         return NULL;
1120         // Same base, same offset.
1121         // Possible improvement for arrays: check index value instead of absolute offset.
1122 
1123         // At this point we have proven something like this setup:
1124         //   B = << base >>
1125         //   L =  LoadQ(AddP(Check/CastPP(B), #Off))
1126         //   S = StoreQ(AddP(             B , #Off), V)
1127         // (Actually, we haven't yet proven the Q's are the same.)
1128         // In other words, we are loading from a casted version of
1129         // the same pointer-and-offset that we stored to.
1130         // Casted version may carry a dependency and it is respected.
1131         // Thus, we are able to replace L by V.
1132       }
1133       // Now prove that we have a LoadQ matched to a StoreQ, for some Q.
1134       if (store_Opcode() != st->Opcode()) {
1135         return NULL;
1136       }
1137       // LoadVector/StoreVector needs additional check to ensure the types match.
1138       if (store_Opcode() == Op_StoreVector) {
1139         const TypeVect*  in_vt = st->as_StoreVector()->vect_type();
1140         const TypeVect* out_vt = as_LoadVector()->vect_type();
1141         if (in_vt != out_vt) {
1142           return NULL;
1143         }
1144       }
1145       return st->in(MemNode::ValueIn);
1146     }
1147 
1148     // A load from a freshly-created object always returns zero.
1149     // (This can happen after LoadNode::Ideal resets the load's memory input
1150     // to find_captured_store, which returned InitializeNode::zero_memory.)
1151     if (st->is_Proj() && st->in(0)->is_Allocate() &&
1152         (st->in(0) == ld_alloc) &&
1153         (ld_off >= st->in(0)->as_Allocate()->minimum_header_size())) {
1154       // return a zero value for the load's basic type
1155       // (This is one of the few places where a generic PhaseTransform
1156       // can create new nodes.  Think of it as lazily manifesting
1157       // virtually pre-existing constants.)
1158       if (memory_type() != T_VOID) {

1118         if (ld_off != st_off)                                  return NULL;
1119         if (ld_off == Type::OffsetBot)                         return NULL;
1120         // Same base, same offset.
1121         // Possible improvement for arrays: check index value instead of absolute offset.
1122 
1123         // At this point we have proven something like this setup:
1124         //   B = << base >>
1125         //   L =  LoadQ(AddP(Check/CastPP(B), #Off))
1126         //   S = StoreQ(AddP(             B , #Off), V)
1127         // (Actually, we haven't yet proven the Q's are the same.)
1128         // In other words, we are loading from a casted version of
1129         // the same pointer-and-offset that we stored to.
1130         // Casted version may carry a dependency and it is respected.
1131         // Thus, we are able to replace L by V.
1132       }
1133       // Now prove that we have a LoadQ matched to a StoreQ, for some Q.
1134       if (store_Opcode() != st->Opcode()) {
1135         return NULL;
1136       }
1137       // LoadVector/StoreVector needs additional check to ensure the types match.
1138       if (st->is_StoreVector()) {
1139         const TypeVect*  in_vt = st->as_StoreVector()->vect_type();
1140         const TypeVect* out_vt = as_LoadVector()->vect_type();
1141         if (in_vt != out_vt) {
1142           return NULL;
1143         }
1144       }
1145       return st->in(MemNode::ValueIn);
1146     }
1147 
1148     // A load from a freshly-created object always returns zero.
1149     // (This can happen after LoadNode::Ideal resets the load's memory input
1150     // to find_captured_store, which returned InitializeNode::zero_memory.)
1151     if (st->is_Proj() && st->in(0)->is_Allocate() &&
1152         (st->in(0) == ld_alloc) &&
1153         (ld_off >= st->in(0)->as_Allocate()->minimum_header_size())) {
1154       // return a zero value for the load's basic type
1155       // (This is one of the few places where a generic PhaseTransform
1156       // can create new nodes.  Think of it as lazily manifesting
1157       // virtually pre-existing constants.)
1158       if (memory_type() != T_VOID) {
< prev index next >