< prev index next >

src/hotspot/share/opto/ifnode.cpp

Print this page

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

















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

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