1177
1178 #ifndef PRODUCT
1179
1180 // Used in debugging code to avoid walking across dead or uninitialized edges.
1181 inline bool NotANode(const Node* n) {
1182 if (n == NULL) return true;
1183 if (((intptr_t)n & 1) != 0) return true; // uninitialized, etc.
1184 if (*(address*)n == badAddress) return true; // kill by Node::destruct
1185 return false;
1186 }
1187
1188 #endif
1189
1190
1191 //-----------------------------------------------------------------------------
1192 // Iterators over DU info, and associated Node functions.
1193
1194 #if OPTO_DU_ITERATOR_ASSERT
1195
1196 // Common code for assertion checking on DU iterators.
1197 class DUIterator_Common VALUE_OBJ_CLASS_SPEC {
1198 #ifdef ASSERT
1199 protected:
1200 bool _vdui; // cached value of VerifyDUIterators
1201 const Node* _node; // the node containing the _out array
1202 uint _outcnt; // cached node->_outcnt
1203 uint _del_tick; // cached node->_del_tick
1204 Node* _last; // last value produced by the iterator
1205
1206 void sample(const Node* node); // used by c'tor to set up for verifies
1207 void verify(const Node* node, bool at_end_ok = false);
1208 void verify_resync();
1209 void reset(const DUIterator_Common& that);
1210
1211 // The VDUI_ONLY macro protects code conditionalized on VerifyDUIterators
1212 #define I_VDUI_ONLY(i,x) { if ((i)._vdui) { x; } }
1213 #else
1214 #define I_VDUI_ONLY(i,x) { }
1215 #endif //ASSERT
1216 };
1217
1601 void set_node(Node *n) {
1602 _inode_top->node = n;
1603 }
1604 void set_index(uint i) {
1605 _inode_top->indx = i;
1606 }
1607 uint size_max() const { return (uint)pointer_delta(_inode_max, _inodes, sizeof(INode)); } // Max size
1608 uint size() const { return (uint)pointer_delta((_inode_top+1), _inodes, sizeof(INode)); } // Current size
1609 bool is_nonempty() const { return (_inode_top >= _inodes); }
1610 bool is_empty() const { return (_inode_top < _inodes); }
1611 void clear() { _inode_top = _inodes - 1; } // retain storage
1612
1613 // Node_Stack is used to map nodes.
1614 Node* find(uint idx) const;
1615 };
1616
1617
1618 //-----------------------------Node_Notes--------------------------------------
1619 // Debugging or profiling annotations loosely and sparsely associated
1620 // with some nodes. See Compile::node_notes_at for the accessor.
1621 class Node_Notes VALUE_OBJ_CLASS_SPEC {
1622 friend class VMStructs;
1623 JVMState* _jvms;
1624
1625 public:
1626 Node_Notes(JVMState* jvms = NULL) {
1627 _jvms = jvms;
1628 }
1629
1630 JVMState* jvms() { return _jvms; }
1631 void set_jvms(JVMState* x) { _jvms = x; }
1632
1633 // True if there is nothing here.
1634 bool is_clear() {
1635 return (_jvms == NULL);
1636 }
1637
1638 // Make there be nothing here.
1639 void clear() {
1640 _jvms = NULL;
1641 }
|
1177
1178 #ifndef PRODUCT
1179
1180 // Used in debugging code to avoid walking across dead or uninitialized edges.
1181 inline bool NotANode(const Node* n) {
1182 if (n == NULL) return true;
1183 if (((intptr_t)n & 1) != 0) return true; // uninitialized, etc.
1184 if (*(address*)n == badAddress) return true; // kill by Node::destruct
1185 return false;
1186 }
1187
1188 #endif
1189
1190
1191 //-----------------------------------------------------------------------------
1192 // Iterators over DU info, and associated Node functions.
1193
1194 #if OPTO_DU_ITERATOR_ASSERT
1195
1196 // Common code for assertion checking on DU iterators.
1197 class DUIterator_Common {
1198 #ifdef ASSERT
1199 protected:
1200 bool _vdui; // cached value of VerifyDUIterators
1201 const Node* _node; // the node containing the _out array
1202 uint _outcnt; // cached node->_outcnt
1203 uint _del_tick; // cached node->_del_tick
1204 Node* _last; // last value produced by the iterator
1205
1206 void sample(const Node* node); // used by c'tor to set up for verifies
1207 void verify(const Node* node, bool at_end_ok = false);
1208 void verify_resync();
1209 void reset(const DUIterator_Common& that);
1210
1211 // The VDUI_ONLY macro protects code conditionalized on VerifyDUIterators
1212 #define I_VDUI_ONLY(i,x) { if ((i)._vdui) { x; } }
1213 #else
1214 #define I_VDUI_ONLY(i,x) { }
1215 #endif //ASSERT
1216 };
1217
1601 void set_node(Node *n) {
1602 _inode_top->node = n;
1603 }
1604 void set_index(uint i) {
1605 _inode_top->indx = i;
1606 }
1607 uint size_max() const { return (uint)pointer_delta(_inode_max, _inodes, sizeof(INode)); } // Max size
1608 uint size() const { return (uint)pointer_delta((_inode_top+1), _inodes, sizeof(INode)); } // Current size
1609 bool is_nonempty() const { return (_inode_top >= _inodes); }
1610 bool is_empty() const { return (_inode_top < _inodes); }
1611 void clear() { _inode_top = _inodes - 1; } // retain storage
1612
1613 // Node_Stack is used to map nodes.
1614 Node* find(uint idx) const;
1615 };
1616
1617
1618 //-----------------------------Node_Notes--------------------------------------
1619 // Debugging or profiling annotations loosely and sparsely associated
1620 // with some nodes. See Compile::node_notes_at for the accessor.
1621 class Node_Notes {
1622 friend class VMStructs;
1623 JVMState* _jvms;
1624
1625 public:
1626 Node_Notes(JVMState* jvms = NULL) {
1627 _jvms = jvms;
1628 }
1629
1630 JVMState* jvms() { return _jvms; }
1631 void set_jvms(JVMState* x) { _jvms = x; }
1632
1633 // True if there is nothing here.
1634 bool is_clear() {
1635 return (_jvms == NULL);
1636 }
1637
1638 // Make there be nothing here.
1639 void clear() {
1640 _jvms = NULL;
1641 }
|