< prev index next >

src/hotspot/share/opto/ifnode.cpp

Print this page

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

















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

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