< prev index next >

src/share/vm/opto/cfgnode.cpp

Print this page




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




1190   //                      phi               /    --
1191 
1192   Node* r = in(0);                      // RegionNode
1193   if (r == NULL)  return in(1);         // Already degraded to a Copy
1194   Node* input = NULL; // The unique direct input (maybe uncasted = ConstraintCasts removed)
1195 
1196   for (uint i = 1, cnt = req(); i < cnt; ++i) {
1197     Node* rc = r->in(i);
1198     if (rc == NULL || phase->type(rc) == Type::TOP)
1199       continue;                 // ignore unreachable control path
1200     Node* n = in(i);
1201     if (n == NULL)
1202       continue;
1203     Node* un = n;
1204     if (uncast) {
1205 #ifdef ASSERT
1206       Node* m = un->uncast();
1207 #endif
1208       while (un != NULL && un->req() == 2 && un->is_ConstraintCast()) {
1209         Node* next = un->in(1);
1210         // Make sure we don't lose type information
1211         if (!phase->type(next)->higher_equal(phase->type(un))) {
1212           break;
1213         }
1214         un = next;
1215       }

1216     }
1217     if (un == NULL || un == this || phase->type(un) == Type::TOP) {
1218       continue; // ignore if top, or in(i) and "this" are in a data cycle
1219     }
1220     // Check for a unique input (maybe uncasted)
1221     if (input == NULL) {
1222       input = un;
1223     } else if (input != un) {
1224       input = NodeSentinel; // no unique input
1225     }
1226   }
1227   if (input == NULL) {
1228     return phase->C->top();        // no inputs
1229   }
1230 
1231   if (input != NodeSentinel) {
1232     return input;           // one unique direct input
1233   }
1234 
1235   // Nothing.


< prev index next >