Mercurial > hg > truffle
comparison src/share/vm/opto/node.cpp @ 7957:0d26ce8e9251
Merge
author | acorn |
---|---|
date | Mon, 28 Jan 2013 10:34:07 -0500 |
parents | a7114d3d712e |
children | 8b3da8d14c93 |
comparison
equal
deleted
inserted
replaced
7956:16fb9f942703 | 7957:0d26ce8e9251 |
---|---|
1474 } | 1474 } |
1475 return true; | 1475 return true; |
1476 } | 1476 } |
1477 | 1477 |
1478 #ifdef ASSERT | 1478 #ifdef ASSERT |
1479 static void dump_orig(Node* orig) { | 1479 static void dump_orig(Node* orig, outputStream *st) { |
1480 Compile* C = Compile::current(); | 1480 Compile* C = Compile::current(); |
1481 if (NotANode(orig)) orig = NULL; | 1481 if (NotANode(orig)) orig = NULL; |
1482 if (orig != NULL && !C->node_arena()->contains(orig)) orig = NULL; | 1482 if (orig != NULL && !C->node_arena()->contains(orig)) orig = NULL; |
1483 if (orig == NULL) return; | 1483 if (orig == NULL) return; |
1484 tty->print(" !orig="); | 1484 st->print(" !orig="); |
1485 Node* fast = orig->debug_orig(); // tortoise & hare algorithm to detect loops | 1485 Node* fast = orig->debug_orig(); // tortoise & hare algorithm to detect loops |
1486 if (NotANode(fast)) fast = NULL; | 1486 if (NotANode(fast)) fast = NULL; |
1487 while (orig != NULL) { | 1487 while (orig != NULL) { |
1488 bool discon = is_disconnected(orig); // if discon, print [123] else 123 | 1488 bool discon = is_disconnected(orig); // if discon, print [123] else 123 |
1489 if (discon) tty->print("["); | 1489 if (discon) st->print("["); |
1490 if (!Compile::current()->node_arena()->contains(orig)) | 1490 if (!Compile::current()->node_arena()->contains(orig)) |
1491 tty->print("o"); | 1491 st->print("o"); |
1492 tty->print("%d", orig->_idx); | 1492 st->print("%d", orig->_idx); |
1493 if (discon) tty->print("]"); | 1493 if (discon) st->print("]"); |
1494 orig = orig->debug_orig(); | 1494 orig = orig->debug_orig(); |
1495 if (NotANode(orig)) orig = NULL; | 1495 if (NotANode(orig)) orig = NULL; |
1496 if (orig != NULL && !C->node_arena()->contains(orig)) orig = NULL; | 1496 if (orig != NULL && !C->node_arena()->contains(orig)) orig = NULL; |
1497 if (orig != NULL) tty->print(","); | 1497 if (orig != NULL) st->print(","); |
1498 if (fast != NULL) { | 1498 if (fast != NULL) { |
1499 // Step fast twice for each single step of orig: | 1499 // Step fast twice for each single step of orig: |
1500 fast = fast->debug_orig(); | 1500 fast = fast->debug_orig(); |
1501 if (NotANode(fast)) fast = NULL; | 1501 if (NotANode(fast)) fast = NULL; |
1502 if (fast != NULL && fast != orig) { | 1502 if (fast != NULL && fast != orig) { |
1503 fast = fast->debug_orig(); | 1503 fast = fast->debug_orig(); |
1504 if (NotANode(fast)) fast = NULL; | 1504 if (NotANode(fast)) fast = NULL; |
1505 } | 1505 } |
1506 if (fast == orig) { | 1506 if (fast == orig) { |
1507 tty->print("..."); | 1507 st->print("..."); |
1508 break; | 1508 break; |
1509 } | 1509 } |
1510 } | 1510 } |
1511 } | 1511 } |
1512 } | 1512 } |
1529 } | 1529 } |
1530 #endif //ASSERT | 1530 #endif //ASSERT |
1531 | 1531 |
1532 //------------------------------dump------------------------------------------ | 1532 //------------------------------dump------------------------------------------ |
1533 // Dump a Node | 1533 // Dump a Node |
1534 void Node::dump() const { | 1534 void Node::dump(const char* suffix, outputStream *st) const { |
1535 Compile* C = Compile::current(); | 1535 Compile* C = Compile::current(); |
1536 bool is_new = C->node_arena()->contains(this); | 1536 bool is_new = C->node_arena()->contains(this); |
1537 _in_dump_cnt++; | 1537 _in_dump_cnt++; |
1538 tty->print("%c%d\t%s\t=== ", | 1538 st->print("%c%d\t%s\t=== ", is_new ? ' ' : 'o', _idx, Name()); |
1539 is_new ? ' ' : 'o', _idx, Name()); | |
1540 | 1539 |
1541 // Dump the required and precedence inputs | 1540 // Dump the required and precedence inputs |
1542 dump_req(); | 1541 dump_req(st); |
1543 dump_prec(); | 1542 dump_prec(st); |
1544 // Dump the outputs | 1543 // Dump the outputs |
1545 dump_out(); | 1544 dump_out(st); |
1546 | 1545 |
1547 if (is_disconnected(this)) { | 1546 if (is_disconnected(this)) { |
1548 #ifdef ASSERT | 1547 #ifdef ASSERT |
1549 tty->print(" [%d]",debug_idx()); | 1548 st->print(" [%d]",debug_idx()); |
1550 dump_orig(debug_orig()); | 1549 dump_orig(debug_orig(), st); |
1551 #endif | 1550 #endif |
1552 tty->cr(); | 1551 st->cr(); |
1553 _in_dump_cnt--; | 1552 _in_dump_cnt--; |
1554 return; // don't process dead nodes | 1553 return; // don't process dead nodes |
1555 } | 1554 } |
1556 | 1555 |
1557 // Dump node-specific info | 1556 // Dump node-specific info |
1558 dump_spec(tty); | 1557 dump_spec(st); |
1559 #ifdef ASSERT | 1558 #ifdef ASSERT |
1560 // Dump the non-reset _debug_idx | 1559 // Dump the non-reset _debug_idx |
1561 if( Verbose && WizardMode ) { | 1560 if (Verbose && WizardMode) { |
1562 tty->print(" [%d]",debug_idx()); | 1561 st->print(" [%d]",debug_idx()); |
1563 } | 1562 } |
1564 #endif | 1563 #endif |
1565 | 1564 |
1566 const Type *t = bottom_type(); | 1565 const Type *t = bottom_type(); |
1567 | 1566 |
1568 if (t != NULL && (t->isa_instptr() || t->isa_klassptr())) { | 1567 if (t != NULL && (t->isa_instptr() || t->isa_klassptr())) { |
1569 const TypeInstPtr *toop = t->isa_instptr(); | 1568 const TypeInstPtr *toop = t->isa_instptr(); |
1570 const TypeKlassPtr *tkls = t->isa_klassptr(); | 1569 const TypeKlassPtr *tkls = t->isa_klassptr(); |
1571 ciKlass* klass = toop ? toop->klass() : (tkls ? tkls->klass() : NULL ); | 1570 ciKlass* klass = toop ? toop->klass() : (tkls ? tkls->klass() : NULL ); |
1572 if( klass && klass->is_loaded() && klass->is_interface() ) { | 1571 if (klass && klass->is_loaded() && klass->is_interface()) { |
1573 tty->print(" Interface:"); | 1572 st->print(" Interface:"); |
1574 } else if( toop ) { | 1573 } else if (toop) { |
1575 tty->print(" Oop:"); | 1574 st->print(" Oop:"); |
1576 } else if( tkls ) { | 1575 } else if (tkls) { |
1577 tty->print(" Klass:"); | 1576 st->print(" Klass:"); |
1578 } | 1577 } |
1579 t->dump(); | 1578 t->dump_on(st); |
1580 } else if( t == Type::MEMORY ) { | 1579 } else if (t == Type::MEMORY) { |
1581 tty->print(" Memory:"); | 1580 st->print(" Memory:"); |
1582 MemNode::dump_adr_type(this, adr_type(), tty); | 1581 MemNode::dump_adr_type(this, adr_type(), st); |
1583 } else if( Verbose || WizardMode ) { | 1582 } else if (Verbose || WizardMode) { |
1584 tty->print(" Type:"); | 1583 st->print(" Type:"); |
1585 if( t ) { | 1584 if (t) { |
1586 t->dump(); | 1585 t->dump_on(st); |
1587 } else { | 1586 } else { |
1588 tty->print("no type"); | 1587 st->print("no type"); |
1589 } | 1588 } |
1590 } else if (t->isa_vect() && this->is_MachSpillCopy()) { | 1589 } else if (t->isa_vect() && this->is_MachSpillCopy()) { |
1591 // Dump MachSpillcopy vector type. | 1590 // Dump MachSpillcopy vector type. |
1592 t->dump(); | 1591 t->dump_on(st); |
1593 } | 1592 } |
1594 if (is_new) { | 1593 if (is_new) { |
1595 debug_only(dump_orig(debug_orig())); | 1594 debug_only(dump_orig(debug_orig(), st)); |
1596 Node_Notes* nn = C->node_notes_at(_idx); | 1595 Node_Notes* nn = C->node_notes_at(_idx); |
1597 if (nn != NULL && !nn->is_clear()) { | 1596 if (nn != NULL && !nn->is_clear()) { |
1598 if (nn->jvms() != NULL) { | 1597 if (nn->jvms() != NULL) { |
1599 tty->print(" !jvms:"); | 1598 st->print(" !jvms:"); |
1600 nn->jvms()->dump_spec(tty); | 1599 nn->jvms()->dump_spec(st); |
1601 } | 1600 } |
1602 } | 1601 } |
1603 } | 1602 } |
1604 tty->cr(); | 1603 if (suffix) st->print(suffix); |
1605 _in_dump_cnt--; | 1604 _in_dump_cnt--; |
1606 } | 1605 } |
1607 | 1606 |
1608 //------------------------------dump_req-------------------------------------- | 1607 //------------------------------dump_req-------------------------------------- |
1609 void Node::dump_req() const { | 1608 void Node::dump_req(outputStream *st) const { |
1610 // Dump the required input edges | 1609 // Dump the required input edges |
1611 for (uint i = 0; i < req(); i++) { // For all required inputs | 1610 for (uint i = 0; i < req(); i++) { // For all required inputs |
1612 Node* d = in(i); | 1611 Node* d = in(i); |
1613 if (d == NULL) { | 1612 if (d == NULL) { |
1614 tty->print("_ "); | 1613 st->print("_ "); |
1615 } else if (NotANode(d)) { | 1614 } else if (NotANode(d)) { |
1616 tty->print("NotANode "); // uninitialized, sentinel, garbage, etc. | 1615 st->print("NotANode "); // uninitialized, sentinel, garbage, etc. |
1617 } else { | 1616 } else { |
1618 tty->print("%c%d ", Compile::current()->node_arena()->contains(d) ? ' ' : 'o', d->_idx); | 1617 st->print("%c%d ", Compile::current()->node_arena()->contains(d) ? ' ' : 'o', d->_idx); |
1619 } | 1618 } |
1620 } | 1619 } |
1621 } | 1620 } |
1622 | 1621 |
1623 | 1622 |
1624 //------------------------------dump_prec------------------------------------- | 1623 //------------------------------dump_prec------------------------------------- |
1625 void Node::dump_prec() const { | 1624 void Node::dump_prec(outputStream *st) const { |
1626 // Dump the precedence edges | 1625 // Dump the precedence edges |
1627 int any_prec = 0; | 1626 int any_prec = 0; |
1628 for (uint i = req(); i < len(); i++) { // For all precedence inputs | 1627 for (uint i = req(); i < len(); i++) { // For all precedence inputs |
1629 Node* p = in(i); | 1628 Node* p = in(i); |
1630 if (p != NULL) { | 1629 if (p != NULL) { |
1631 if( !any_prec++ ) tty->print(" |"); | 1630 if (!any_prec++) st->print(" |"); |
1632 if (NotANode(p)) { tty->print("NotANode "); continue; } | 1631 if (NotANode(p)) { st->print("NotANode "); continue; } |
1633 tty->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx); | 1632 st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx); |
1634 } | 1633 } |
1635 } | 1634 } |
1636 } | 1635 } |
1637 | 1636 |
1638 //------------------------------dump_out-------------------------------------- | 1637 //------------------------------dump_out-------------------------------------- |
1639 void Node::dump_out() const { | 1638 void Node::dump_out(outputStream *st) const { |
1640 // Delimit the output edges | 1639 // Delimit the output edges |
1641 tty->print(" [["); | 1640 st->print(" [["); |
1642 // Dump the output edges | 1641 // Dump the output edges |
1643 for (uint i = 0; i < _outcnt; i++) { // For all outputs | 1642 for (uint i = 0; i < _outcnt; i++) { // For all outputs |
1644 Node* u = _out[i]; | 1643 Node* u = _out[i]; |
1645 if (u == NULL) { | 1644 if (u == NULL) { |
1646 tty->print("_ "); | 1645 st->print("_ "); |
1647 } else if (NotANode(u)) { | 1646 } else if (NotANode(u)) { |
1648 tty->print("NotANode "); | 1647 st->print("NotANode "); |
1649 } else { | 1648 } else { |
1650 tty->print("%c%d ", Compile::current()->node_arena()->contains(u) ? ' ' : 'o', u->_idx); | 1649 st->print("%c%d ", Compile::current()->node_arena()->contains(u) ? ' ' : 'o', u->_idx); |
1651 } | 1650 } |
1652 } | 1651 } |
1653 tty->print("]] "); | 1652 st->print("]] "); |
1654 } | 1653 } |
1655 | 1654 |
1656 //------------------------------dump_nodes------------------------------------- | 1655 //------------------------------dump_nodes------------------------------------- |
1657 static void dump_nodes(const Node* start, int d, bool only_ctrl) { | 1656 static void dump_nodes(const Node* start, int d, bool only_ctrl) { |
1658 Node* s = (Node*)start; // remove const | 1657 Node* s = (Node*)start; // remove const |