comparison src/share/vm/opto/escape.cpp @ 14909:4ca6dc0799b6

Backout jdk9 merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 01 Apr 2014 13:57:07 +0200
parents 3e98456aab94
children 52b4284cb496
comparison
equal deleted inserted replaced
14908:8db6e76cb658 14909:4ca6dc0799b6
1577 field->fields_escape_state() == PointsToNode::NoEscape, "sanity"); 1577 field->fields_escape_state() == PointsToNode::NoEscape, "sanity");
1578 if (field->offset() == Type::OffsetBot) { 1578 if (field->offset() == Type::OffsetBot) {
1579 jobj->set_scalar_replaceable(false); 1579 jobj->set_scalar_replaceable(false);
1580 return; 1580 return;
1581 } 1581 }
1582 // 2. An object is not scalar replaceable if the field into which it is
1583 // stored has multiple bases one of which is null.
1584 if (field->base_count() > 1) {
1585 for (BaseIterator i(field); i.has_next(); i.next()) {
1586 PointsToNode* base = i.get();
1587 if (base == null_obj) {
1588 jobj->set_scalar_replaceable(false);
1589 return;
1590 }
1591 }
1592 }
1593 } 1582 }
1594 assert(use->is_Field() || use->is_LocalVar(), "sanity"); 1583 assert(use->is_Field() || use->is_LocalVar(), "sanity");
1595 // 3. An object is not scalar replaceable if it is merged with other objects. 1584 // 2. An object is not scalar replaceable if it is merged with other objects.
1596 for (EdgeIterator j(use); j.has_next(); j.next()) { 1585 for (EdgeIterator j(use); j.has_next(); j.next()) {
1597 PointsToNode* ptn = j.get(); 1586 PointsToNode* ptn = j.get();
1598 if (ptn->is_JavaObject() && ptn != jobj) { 1587 if (ptn->is_JavaObject() && ptn != jobj) {
1599 // Mark all objects. 1588 // Mark all objects.
1600 jobj->set_scalar_replaceable(false); 1589 jobj->set_scalar_replaceable(false);
1609 for (EdgeIterator j(jobj); j.has_next(); j.next()) { 1598 for (EdgeIterator j(jobj); j.has_next(); j.next()) {
1610 // Non-escaping object node should point only to field nodes. 1599 // Non-escaping object node should point only to field nodes.
1611 FieldNode* field = j.get()->as_Field(); 1600 FieldNode* field = j.get()->as_Field();
1612 int offset = field->as_Field()->offset(); 1601 int offset = field->as_Field()->offset();
1613 1602
1614 // 4. An object is not scalar replaceable if it has a field with unknown 1603 // 3. An object is not scalar replaceable if it has a field with unknown
1615 // offset (array's element is accessed in loop). 1604 // offset (array's element is accessed in loop).
1616 if (offset == Type::OffsetBot) { 1605 if (offset == Type::OffsetBot) {
1617 jobj->set_scalar_replaceable(false); 1606 jobj->set_scalar_replaceable(false);
1618 return; 1607 return;
1619 } 1608 }
1620 // 5. Currently an object is not scalar replaceable if a LoadStore node 1609 // 4. Currently an object is not scalar replaceable if a LoadStore node
1621 // access its field since the field value is unknown after it. 1610 // access its field since the field value is unknown after it.
1622 // 1611 //
1623 Node* n = field->ideal_node(); 1612 Node* n = field->ideal_node();
1624 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { 1613 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
1625 if (n->fast_out(i)->is_LoadStore()) { 1614 if (n->fast_out(i)->is_LoadStore()) {
1626 jobj->set_scalar_replaceable(false); 1615 jobj->set_scalar_replaceable(false);
1627 return; 1616 return;
1628 } 1617 }
1629 } 1618 }
1630 1619
1631 // 6. Or the address may point to more then one object. This may produce 1620 // 5. Or the address may point to more then one object. This may produce
1632 // the false positive result (set not scalar replaceable) 1621 // the false positive result (set not scalar replaceable)
1633 // since the flow-insensitive escape analysis can't separate 1622 // since the flow-insensitive escape analysis can't separate
1634 // the case when stores overwrite the field's value from the case 1623 // the case when stores overwrite the field's value from the case
1635 // when stores happened on different control branches. 1624 // when stores happened on different control branches.
1636 // 1625 //