< prev index next >

src/hotspot/share/opto/ifnode.cpp

Print this page
rev 48506 : imported patch JDK-8194982


1178 }
1179 
1180 bool IfNode::is_null_check(ProjNode* proj, PhaseIterGVN* igvn) {
1181   Node* other = in(1)->in(1)->in(2);
1182   if (other->in(MemNode::Address) != NULL &&
1183       proj->in(0)->in(1) != NULL &&
1184       proj->in(0)->in(1)->is_Bool() &&
1185       proj->in(0)->in(1)->in(1) != NULL &&
1186       proj->in(0)->in(1)->in(1)->Opcode() == Op_CmpP &&
1187       proj->in(0)->in(1)->in(1)->in(2) != NULL &&
1188       proj->in(0)->in(1)->in(1)->in(1) == other->in(MemNode::Address)->in(AddPNode::Address)->uncast() &&
1189       igvn->type(proj->in(0)->in(1)->in(1)->in(2)) == TypePtr::NULL_PTR) {
1190     return true;
1191   }
1192   return false;
1193 }
1194 
1195 // Check that the If that is in between the 2 integer comparisons has
1196 // no side effect
1197 bool IfNode::is_side_effect_free_test(ProjNode* proj, PhaseIterGVN* igvn) {
1198   if (proj != NULL &&
1199       proj->is_uncommon_trap_if_pattern(Deoptimization::Reason_none) &&
1200       proj->outcnt() <= 2) {


1201     if (proj->outcnt() == 1 ||
1202         // Allow simple null check from LoadRange
1203         (is_cmp_with_loadrange(proj) && is_null_check(proj, igvn))) {
1204       CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
1205       CallStaticJavaNode* dom_unc = proj->in(0)->in(0)->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);

1206 
1207       // reroute_side_effect_free_unc changes the state of this
1208       // uncommon trap to restart execution at the previous
1209       // CmpI. Check that this change in a previous compilation didn't
1210       // cause too many traps.
1211       int trap_request = unc->uncommon_trap_request();
1212       Deoptimization::DeoptReason reason = Deoptimization::trap_request_reason(trap_request);
1213 
1214       if (igvn->C->too_many_traps(dom_unc->jvms()->method(), dom_unc->jvms()->bci(), reason)) {
1215         return false;
1216       }
1217 
1218       return true;
1219     }
1220   }
1221   return false;
1222 }
1223 
1224 // Make the If between the 2 integer comparisons trap at the state of
1225 // the first If: the last CmpI is the one replaced by a CmpU and the




1178 }
1179 
1180 bool IfNode::is_null_check(ProjNode* proj, PhaseIterGVN* igvn) {
1181   Node* other = in(1)->in(1)->in(2);
1182   if (other->in(MemNode::Address) != NULL &&
1183       proj->in(0)->in(1) != NULL &&
1184       proj->in(0)->in(1)->is_Bool() &&
1185       proj->in(0)->in(1)->in(1) != NULL &&
1186       proj->in(0)->in(1)->in(1)->Opcode() == Op_CmpP &&
1187       proj->in(0)->in(1)->in(1)->in(2) != NULL &&
1188       proj->in(0)->in(1)->in(1)->in(1) == other->in(MemNode::Address)->in(AddPNode::Address)->uncast() &&
1189       igvn->type(proj->in(0)->in(1)->in(1)->in(2)) == TypePtr::NULL_PTR) {
1190     return true;
1191   }
1192   return false;
1193 }
1194 
1195 // Check that the If that is in between the 2 integer comparisons has
1196 // no side effect
1197 bool IfNode::is_side_effect_free_test(ProjNode* proj, PhaseIterGVN* igvn) {
1198   if (proj == NULL) {
1199     return false;
1200   }
1201   CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
1202   if (unc != NULL && proj->outcnt() <= 2) {
1203     if (proj->outcnt() == 1 ||
1204         // Allow simple null check from LoadRange
1205         (is_cmp_with_loadrange(proj) && is_null_check(proj, igvn))) {
1206       CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
1207       CallStaticJavaNode* dom_unc = proj->in(0)->in(0)->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
1208       assert(dom_unc != NULL, "is_uncommon_trap_if_pattern returned NULL");
1209 
1210       // reroute_side_effect_free_unc changes the state of this
1211       // uncommon trap to restart execution at the previous
1212       // CmpI. Check that this change in a previous compilation didn't
1213       // cause too many traps.
1214       int trap_request = unc->uncommon_trap_request();
1215       Deoptimization::DeoptReason reason = Deoptimization::trap_request_reason(trap_request);
1216 
1217       if (igvn->C->too_many_traps(dom_unc->jvms()->method(), dom_unc->jvms()->bci(), reason)) {
1218         return false;
1219       }
1220 
1221       return true;
1222     }
1223   }
1224   return false;
1225 }
1226 
1227 // Make the If between the 2 integer comparisons trap at the state of
1228 // the first If: the last CmpI is the one replaced by a CmpU and the


< prev index next >