< prev index next >

src/hotspot/share/opto/ifnode.cpp

Print this page

1255     }
1256   }
1257   return false;
1258 }
1259 
1260 bool IfNode::is_null_check(ProjNode* proj, PhaseIterGVN* igvn) {
1261   Node* other = in(1)->in(1)->in(2);
1262   if (other->in(MemNode::Address) != nullptr &&
1263       proj->in(0)->in(1) != nullptr &&
1264       proj->in(0)->in(1)->is_Bool() &&
1265       proj->in(0)->in(1)->in(1) != nullptr &&
1266       proj->in(0)->in(1)->in(1)->Opcode() == Op_CmpP &&
1267       proj->in(0)->in(1)->in(1)->in(2) != nullptr &&
1268       proj->in(0)->in(1)->in(1)->in(1) == other->in(MemNode::Address)->in(AddPNode::Address)->uncast() &&
1269       igvn->type(proj->in(0)->in(1)->in(1)->in(2)) == TypePtr::NULL_PTR) {
1270     return true;
1271   }
1272   return false;
1273 }
1274 

















1275 // Check that the If that is in between the 2 integer comparisons has
1276 // no side effect
1277 bool IfNode::is_side_effect_free_test(ProjNode* proj, PhaseIterGVN* igvn) {
1278   if (proj == nullptr) {
1279     return false;
1280   }
1281   CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern();
1282   if (unc != nullptr && proj->outcnt() <= 2) {
1283     if (proj->outcnt() == 1 ||
1284         // Allow simple null check from LoadRange
1285         (is_cmp_with_loadrange(proj) && is_null_check(proj, igvn))) {
1286       CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern();
1287       CallStaticJavaNode* dom_unc = proj->in(0)->in(0)->as_Proj()->is_uncommon_trap_if_pattern();
1288       assert(dom_unc != nullptr, "is_uncommon_trap_if_pattern returned null");
1289 
1290       // reroute_side_effect_free_unc changes the state of this
1291       // uncommon trap to restart execution at the previous
1292       // CmpI. Check that this change in a previous compilation didn't
1293       // cause too many traps.
1294       int trap_request = unc->uncommon_trap_request();

1255     }
1256   }
1257   return false;
1258 }
1259 
1260 bool IfNode::is_null_check(ProjNode* proj, PhaseIterGVN* igvn) {
1261   Node* other = in(1)->in(1)->in(2);
1262   if (other->in(MemNode::Address) != nullptr &&
1263       proj->in(0)->in(1) != nullptr &&
1264       proj->in(0)->in(1)->is_Bool() &&
1265       proj->in(0)->in(1)->in(1) != nullptr &&
1266       proj->in(0)->in(1)->in(1)->Opcode() == Op_CmpP &&
1267       proj->in(0)->in(1)->in(1)->in(2) != nullptr &&
1268       proj->in(0)->in(1)->in(1)->in(1) == other->in(MemNode::Address)->in(AddPNode::Address)->uncast() &&
1269       igvn->type(proj->in(0)->in(1)->in(1)->in(2)) == TypePtr::NULL_PTR) {
1270     return true;
1271   }
1272   return false;
1273 }
1274 
1275 // Returns true if this IfNode belongs to a flat array check
1276 // and returns the corresponding array in the 'array' parameter.
1277 bool IfNode::is_flat_array_check(PhaseTransform* phase, Node** array) {
1278   Node* bol = in(1);
1279   if (!bol->is_Bool()) {
1280     return false;
1281   }
1282   Node* cmp = bol->in(1);
1283   if (cmp->isa_FlatArrayCheck()) {
1284     if (array != nullptr) {
1285       *array = cmp->in(FlatArrayCheckNode::ArrayOrKlass);
1286     }
1287     return true;
1288   }
1289   return false;
1290 }
1291 
1292 // Check that the If that is in between the 2 integer comparisons has
1293 // no side effect
1294 bool IfNode::is_side_effect_free_test(ProjNode* proj, PhaseIterGVN* igvn) {
1295   if (proj == nullptr) {
1296     return false;
1297   }
1298   CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern();
1299   if (unc != nullptr && proj->outcnt() <= 2) {
1300     if (proj->outcnt() == 1 ||
1301         // Allow simple null check from LoadRange
1302         (is_cmp_with_loadrange(proj) && is_null_check(proj, igvn))) {
1303       CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern();
1304       CallStaticJavaNode* dom_unc = proj->in(0)->in(0)->as_Proj()->is_uncommon_trap_if_pattern();
1305       assert(dom_unc != nullptr, "is_uncommon_trap_if_pattern returned null");
1306 
1307       // reroute_side_effect_free_unc changes the state of this
1308       // uncommon trap to restart execution at the previous
1309       // CmpI. Check that this change in a previous compilation didn't
1310       // cause too many traps.
1311       int trap_request = unc->uncommon_trap_request();
< prev index next >