< prev index next >

src/hotspot/share/opto/ifnode.cpp

Print this page

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

















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

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