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