src/share/vm/opto/cfgnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/cfgnode.cpp

Print this page
rev 10020 : raw ptr fix


1154   Node* uin = unique_input(phase, false);
1155   if (uin != NULL) {
1156     return uin;
1157   }
1158 
1159   int true_path = is_diamond_phi();
1160   if (true_path != 0) {
1161     Node* id = is_cmove_id(phase, true_path);
1162     if (id != NULL)  return id;
1163   }
1164 
1165   return this;                     // No identity
1166 }
1167 
1168 //-----------------------------unique_input------------------------------------
1169 // Find the unique value, discounting top, self-loops, and casts.
1170 // Return top if there are no inputs, and self if there are multiple.
1171 Node* PhiNode::unique_input(PhaseTransform* phase, bool uncast) {
1172   //  1) One unique direct input,
1173   // or if uncast is true:
1174   //  2) some of the inputs have an intervening ConstraintCast and
1175   //     the type of input is the same or sharper (more specific)
1176   //     than the phi's type.
1177   //  3) an input is a self loop
1178   //
1179   //  1) input   or   2) input     or   3) input __
1180   //     /   \           /   \               \  /  \
1181   //     \   /          |    cast             phi  cast
1182   //      phi            \   /               /  \  /
1183   //                      phi               /    --
1184 
1185   Node* r = in(0);                      // RegionNode
1186   if (r == NULL)  return in(1);         // Already degraded to a Copy
1187   Node* input = NULL; // The unique direct input (maybe uncasted = ConstraintCasts removed)
1188 
1189   for (uint i = 1, cnt = req(); i < cnt; ++i) {
1190     Node* rc = r->in(i);
1191     if (rc == NULL || phase->type(rc) == Type::TOP)
1192       continue;                 // ignore unreachable control path
1193     Node* n = in(i);
1194     if (n == NULL)
1195       continue;
1196     Node* un = uncast ? n->uncast() : n;














1197     if (un == NULL || un == this || phase->type(un) == Type::TOP) {
1198       continue; // ignore if top, or in(i) and "this" are in a data cycle
1199     }
1200     // Check for a unique input (maybe uncasted)
1201     if (input == NULL) {
1202       input = un;
1203     } else if (input != un) {
1204       input = NodeSentinel; // no unique input
1205     }
1206   }
1207   if (input == NULL) {
1208     return phase->C->top();        // no inputs
1209   }
1210 
1211   if (input != NodeSentinel) {
1212     return input;           // one unique direct input
1213   }
1214 
1215   // Nothing.
1216   return NULL;




1154   Node* uin = unique_input(phase, false);
1155   if (uin != NULL) {
1156     return uin;
1157   }
1158 
1159   int true_path = is_diamond_phi();
1160   if (true_path != 0) {
1161     Node* id = is_cmove_id(phase, true_path);
1162     if (id != NULL)  return id;
1163   }
1164 
1165   return this;                     // No identity
1166 }
1167 
1168 //-----------------------------unique_input------------------------------------
1169 // Find the unique value, discounting top, self-loops, and casts.
1170 // Return top if there are no inputs, and self if there are multiple.
1171 Node* PhiNode::unique_input(PhaseTransform* phase, bool uncast) {
1172   //  1) One unique direct input,
1173   // or if uncast is true:
1174   //  2) some of the inputs have an intervening ConstraintCast


1175   //  3) an input is a self loop
1176   //
1177   //  1) input   or   2) input     or   3) input __
1178   //     /   \           /   \               \  /  \
1179   //     \   /          |    cast             phi  cast
1180   //      phi            \   /               /  \  /
1181   //                      phi               /    --
1182 
1183   Node* r = in(0);                      // RegionNode
1184   if (r == NULL)  return in(1);         // Already degraded to a Copy
1185   Node* input = NULL; // The unique direct input (maybe uncasted = ConstraintCasts removed)
1186 
1187   for (uint i = 1, cnt = req(); i < cnt; ++i) {
1188     Node* rc = r->in(i);
1189     if (rc == NULL || phase->type(rc) == Type::TOP)
1190       continue;                 // ignore unreachable control path
1191     Node* n = in(i);
1192     if (n == NULL)
1193       continue;
1194     Node* un = n;
1195     if (uncast) {
1196 #ifdef ASSERT
1197       Node* m = un->uncast();
1198 #endif
1199       while (un != NULL && un->req() == 2 && un->is_ConstraintCast()) {
1200         Node* next = un->in(1);
1201         if (phase->type(next)->isa_rawptr() && phase->type(un)->isa_oopptr()) {
1202           // risk exposing raw ptr at safepoint
1203           break;
1204         }
1205         un = next;
1206       }
1207       assert(m == un || un->in(1) == m, "Only expected at CheckCastPP from allocation");
1208     }
1209     if (un == NULL || un == this || phase->type(un) == Type::TOP) {
1210       continue; // ignore if top, or in(i) and "this" are in a data cycle
1211     }
1212     // Check for a unique input (maybe uncasted)
1213     if (input == NULL) {
1214       input = un;
1215     } else if (input != un) {
1216       input = NodeSentinel; // no unique input
1217     }
1218   }
1219   if (input == NULL) {
1220     return phase->C->top();        // no inputs
1221   }
1222 
1223   if (input != NodeSentinel) {
1224     return input;           // one unique direct input
1225   }
1226 
1227   // Nothing.
1228   return NULL;


src/share/vm/opto/cfgnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File