< prev index next >

src/hotspot/share/opto/ifnode.cpp

Print this page

1214     }
1215   }
1216   return false;
1217 }
1218 
1219 bool IfNode::is_null_check(ProjNode* proj, PhaseIterGVN* igvn) {
1220   Node* other = in(1)->in(1)->in(2);
1221   if (other->in(MemNode::Address) != NULL &&
1222       proj->in(0)->in(1) != NULL &&
1223       proj->in(0)->in(1)->is_Bool() &&
1224       proj->in(0)->in(1)->in(1) != NULL &&
1225       proj->in(0)->in(1)->in(1)->Opcode() == Op_CmpP &&
1226       proj->in(0)->in(1)->in(1)->in(2) != NULL &&
1227       proj->in(0)->in(1)->in(1)->in(1) == other->in(MemNode::Address)->in(AddPNode::Address)->uncast() &&
1228       igvn->type(proj->in(0)->in(1)->in(1)->in(2)) == TypePtr::NULL_PTR) {
1229     return true;
1230   }
1231   return false;
1232 }
1233 

















1234 // Check that the If that is in between the 2 integer comparisons has
1235 // no side effect
1236 bool IfNode::is_side_effect_free_test(ProjNode* proj, PhaseIterGVN* igvn) {
1237   if (proj == NULL) {
1238     return false;
1239   }
1240   CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
1241   if (unc != NULL && proj->outcnt() <= 2) {
1242     if (proj->outcnt() == 1 ||
1243         // Allow simple null check from LoadRange
1244         (is_cmp_with_loadrange(proj) && is_null_check(proj, igvn))) {
1245       CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
1246       CallStaticJavaNode* dom_unc = proj->in(0)->in(0)->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
1247       assert(dom_unc != NULL, "is_uncommon_trap_if_pattern returned NULL");
1248 
1249       // reroute_side_effect_free_unc changes the state of this
1250       // uncommon trap to restart execution at the previous
1251       // CmpI. Check that this change in a previous compilation didn't
1252       // cause too many traps.
1253       int trap_request = unc->uncommon_trap_request();

1214     }
1215   }
1216   return false;
1217 }
1218 
1219 bool IfNode::is_null_check(ProjNode* proj, PhaseIterGVN* igvn) {
1220   Node* other = in(1)->in(1)->in(2);
1221   if (other->in(MemNode::Address) != NULL &&
1222       proj->in(0)->in(1) != NULL &&
1223       proj->in(0)->in(1)->is_Bool() &&
1224       proj->in(0)->in(1)->in(1) != NULL &&
1225       proj->in(0)->in(1)->in(1)->Opcode() == Op_CmpP &&
1226       proj->in(0)->in(1)->in(1)->in(2) != NULL &&
1227       proj->in(0)->in(1)->in(1)->in(1) == other->in(MemNode::Address)->in(AddPNode::Address)->uncast() &&
1228       igvn->type(proj->in(0)->in(1)->in(1)->in(2)) == TypePtr::NULL_PTR) {
1229     return true;
1230   }
1231   return false;
1232 }
1233 
1234 // Returns true if this IfNode belongs to a flat array check
1235 // and returns the corresponding array in the 'array' parameter.
1236 bool IfNode::is_flat_array_check(PhaseTransform* phase, Node** array) {
1237   Node* bol = in(1);
1238   if (!bol->is_Bool()) {
1239     return false;
1240   }
1241   Node* cmp = bol->in(1);
1242   if (cmp->isa_FlatArrayCheck()) {
1243     if (array != NULL) {
1244       *array = cmp->in(FlatArrayCheckNode::ArrayOrKlass);
1245     }
1246     return true;
1247   }
1248   return false;
1249 }
1250 
1251 // Check that the If that is in between the 2 integer comparisons has
1252 // no side effect
1253 bool IfNode::is_side_effect_free_test(ProjNode* proj, PhaseIterGVN* igvn) {
1254   if (proj == NULL) {
1255     return false;
1256   }
1257   CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
1258   if (unc != NULL && proj->outcnt() <= 2) {
1259     if (proj->outcnt() == 1 ||
1260         // Allow simple null check from LoadRange
1261         (is_cmp_with_loadrange(proj) && is_null_check(proj, igvn))) {
1262       CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
1263       CallStaticJavaNode* dom_unc = proj->in(0)->in(0)->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
1264       assert(dom_unc != NULL, "is_uncommon_trap_if_pattern returned NULL");
1265 
1266       // reroute_side_effect_free_unc changes the state of this
1267       // uncommon trap to restart execution at the previous
1268       // CmpI. Check that this change in a previous compilation didn't
1269       // cause too many traps.
1270       int trap_request = unc->uncommon_trap_request();
< prev index next >