1519 Unique_Node_List() : Node_List(), _in_worklist(Thread::current()->resource_area()), _clock_index(0) {} |
1519 Unique_Node_List() : Node_List(), _in_worklist(Thread::current()->resource_area()), _clock_index(0) {} |
1520 Unique_Node_List(Arena *a) : Node_List(a), _in_worklist(a), _clock_index(0) {} |
1520 Unique_Node_List(Arena *a) : Node_List(a), _in_worklist(a), _clock_index(0) {} |
1521 |
1521 |
1522 void remove( Node *n ); |
1522 void remove( Node *n ); |
1523 bool member( Node *n ) { return _in_worklist.test(n->_idx) != 0; } |
1523 bool member( Node *n ) { return _in_worklist.test(n->_idx) != 0; } |
1524 VectorSet &member_set(){ return _in_worklist; } |
1524 VectorSet& member_set(){ return _in_worklist; } |
1525 |
1525 |
1526 void push( Node *b ) { |
1526 void push(Node* b) { |
1527 if( !_in_worklist.test_set(b->_idx) ) |
1527 if( !_in_worklist.test_set(b->_idx) ) |
1528 Node_List::push(b); |
1528 Node_List::push(b); |
1529 } |
1529 } |
1530 Node *pop() { |
1530 Node *pop() { |
1531 if( _clock_index >= size() ) _clock_index = 0; |
1531 if( _clock_index >= size() ) _clock_index = 0; |
1532 Node *b = at(_clock_index); |
1532 Node *b = at(_clock_index); |
1533 map( _clock_index, Node_List::pop()); |
1533 map( _clock_index, Node_List::pop()); |
1534 if (size() != 0) _clock_index++; // Always start from 0 |
1534 if (size() != 0) _clock_index++; // Always start from 0 |
1535 _in_worklist >>= b->_idx; |
1535 _in_worklist.remove(b->_idx); |
1536 return b; |
1536 return b; |
1537 } |
1537 } |
1538 Node *remove( uint i ) { |
1538 Node *remove(uint i) { |
1539 Node *b = Node_List::at(i); |
1539 Node *b = Node_List::at(i); |
1540 _in_worklist >>= b->_idx; |
1540 _in_worklist.remove(b->_idx); |
1541 map(i,Node_List::pop()); |
1541 map(i,Node_List::pop()); |
1542 return b; |
1542 return b; |
1543 } |
1543 } |
1544 void yank( Node *n ) { _in_worklist >>= n->_idx; Node_List::yank(n); } |
1544 void yank(Node *n) { |
|
1545 _in_worklist.remove(n->_idx); |
|
1546 Node_List::yank(n); |
|
1547 } |
1545 void clear() { |
1548 void clear() { |
1546 _in_worklist.Clear(); // Discards storage but grows automatically |
1549 _in_worklist.clear(); // Discards storage but grows automatically |
1547 Node_List::clear(); |
1550 Node_List::clear(); |
1548 _clock_index = 0; |
1551 _clock_index = 0; |
1549 } |
1552 } |
1550 |
1553 |
1551 // Used after parsing to remove useless nodes before Iterative GVN |
1554 // Used after parsing to remove useless nodes before Iterative GVN |
1552 void remove_useless_nodes(VectorSet &useful); |
1555 void remove_useless_nodes(VectorSet& useful); |
1553 |
1556 |
1554 #ifndef PRODUCT |
1557 #ifndef PRODUCT |
1555 void print_set() const { _in_worklist.print(); } |
1558 void print_set() const { _in_worklist.print(); } |
1556 #endif |
1559 #endif |
1557 }; |
1560 }; |