< prev index next >

src/hotspot/share/opto/ifnode.cpp

Print this page

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

















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

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