< prev index next >

src/hotspot/share/opto/ifnode.cpp

Print this page

1595     }
1596   }
1597   return false;
1598 }
1599 
1600 bool IfNode::is_null_check(IfProjNode* proj, PhaseIterGVN* igvn) const {
1601   Node* other = in(1)->in(1)->in(2);
1602   if (other->in(MemNode::Address) != nullptr &&
1603       proj->in(0)->in(1) != nullptr &&
1604       proj->in(0)->in(1)->is_Bool() &&
1605       proj->in(0)->in(1)->in(1) != nullptr &&
1606       proj->in(0)->in(1)->in(1)->Opcode() == Op_CmpP &&
1607       proj->in(0)->in(1)->in(1)->in(2) != nullptr &&
1608       proj->in(0)->in(1)->in(1)->in(1) == other->in(MemNode::Address)->in(AddPNode::Address)->uncast() &&
1609       igvn->type(proj->in(0)->in(1)->in(1)->in(2)) == TypePtr::NULL_PTR) {
1610     return true;
1611   }
1612   return false;
1613 }
1614 

















1615 // Check that the If that is in between the 2 integer comparisons has
1616 // no side effect
1617 bool IfNode::is_side_effect_free_test(IfProjNode* proj, PhaseIterGVN* igvn) const {
1618   if (proj == nullptr) {
1619     return false;
1620   }
1621   CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern();
1622   if (unc != nullptr && proj->outcnt() <= 2) {
1623     if (proj->outcnt() == 1 ||
1624         // Allow simple null check from LoadRange
1625         (is_cmp_with_loadrange(proj) && is_null_check(proj, igvn))) {
1626       CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern();
1627       CallStaticJavaNode* dom_unc = proj->in(0)->in(0)->as_Proj()->is_uncommon_trap_if_pattern();
1628       assert(dom_unc != nullptr, "is_uncommon_trap_if_pattern returned null");
1629 
1630       // reroute_side_effect_free_unc changes the state of this
1631       // uncommon trap to restart execution at the previous
1632       // CmpI. Check that this change in a previous compilation didn't
1633       // cause too many traps.
1634       int trap_request = unc->uncommon_trap_request();

1595     }
1596   }
1597   return false;
1598 }
1599 
1600 bool IfNode::is_null_check(IfProjNode* proj, PhaseIterGVN* igvn) const {
1601   Node* other = in(1)->in(1)->in(2);
1602   if (other->in(MemNode::Address) != nullptr &&
1603       proj->in(0)->in(1) != nullptr &&
1604       proj->in(0)->in(1)->is_Bool() &&
1605       proj->in(0)->in(1)->in(1) != nullptr &&
1606       proj->in(0)->in(1)->in(1)->Opcode() == Op_CmpP &&
1607       proj->in(0)->in(1)->in(1)->in(2) != nullptr &&
1608       proj->in(0)->in(1)->in(1)->in(1) == other->in(MemNode::Address)->in(AddPNode::Address)->uncast() &&
1609       igvn->type(proj->in(0)->in(1)->in(1)->in(2)) == TypePtr::NULL_PTR) {
1610     return true;
1611   }
1612   return false;
1613 }
1614 
1615 // Returns true if this IfNode belongs to a flat array check
1616 // and returns the corresponding array in the 'array' parameter.
1617 bool IfNode::is_flat_array_check(PhaseTransform* phase, Node** array) {
1618   Node* bol = in(1);
1619   if (!bol->is_Bool()) {
1620     return false;
1621   }
1622   Node* cmp = bol->in(1);
1623   if (cmp->isa_FlatArrayCheck()) {
1624     if (array != nullptr) {
1625       *array = cmp->in(FlatArrayCheckNode::ArrayOrKlass);
1626     }
1627     return true;
1628   }
1629   return false;
1630 }
1631 
1632 // Check that the If that is in between the 2 integer comparisons has
1633 // no side effect
1634 bool IfNode::is_side_effect_free_test(IfProjNode* proj, PhaseIterGVN* igvn) const {
1635   if (proj == nullptr) {
1636     return false;
1637   }
1638   CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern();
1639   if (unc != nullptr && proj->outcnt() <= 2) {
1640     if (proj->outcnt() == 1 ||
1641         // Allow simple null check from LoadRange
1642         (is_cmp_with_loadrange(proj) && is_null_check(proj, igvn))) {
1643       CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern();
1644       CallStaticJavaNode* dom_unc = proj->in(0)->in(0)->as_Proj()->is_uncommon_trap_if_pattern();
1645       assert(dom_unc != nullptr, "is_uncommon_trap_if_pattern returned null");
1646 
1647       // reroute_side_effect_free_unc changes the state of this
1648       // uncommon trap to restart execution at the previous
1649       // CmpI. Check that this change in a previous compilation didn't
1650       // cause too many traps.
1651       int trap_request = unc->uncommon_trap_request();
< prev index next >