756 if (n != NULL && !n->is_top()) { 757 for(uint i=0; i<m; i++ ) { 758 n->add_out((Node *)this); 759 } 760 } 761 } 762 763 //------------------------------del_req---------------------------------------- 764 // Delete the required edge and compact the edge array 765 void Node::del_req( uint idx ) { 766 assert( idx < _cnt, "oob"); 767 assert( !VerifyHashTableKeys || _hash_lock == 0, 768 "remove node from hash table before modifying it"); 769 // First remove corresponding def-use edge 770 Node *n = in(idx); 771 if (n != NULL) n->del_out((Node *)this); 772 _in[idx] = in(--_cnt); // Compact the array 773 _in[_cnt] = NULL; // NULL out emptied slot 774 } 775 776 //------------------------------ins_req---------------------------------------- 777 // Insert a new required input at the end 778 void Node::ins_req( uint idx, Node *n ) { 779 assert( is_not_dead(n), "can not use dead node"); 780 add_req(NULL); // Make space 781 assert( idx < _max, "Must have allocated enough space"); 782 // Slide over 783 if(_cnt-idx-1 > 0) { 784 Copy::conjoint_words_to_higher((HeapWord*)&_in[idx], (HeapWord*)&_in[idx+1], ((_cnt-idx-1)*sizeof(Node*))); 785 } 786 _in[idx] = n; // Stuff over old required edge 787 if (n != NULL) n->add_out((Node *)this); // Add reciprocal def-use edge 788 } 789 790 //-----------------------------find_edge--------------------------------------- 791 int Node::find_edge(Node* n) { 792 for (uint i = 0; i < len(); i++) { 793 if (_in[i] == n) return i; 794 } 795 return -1; | 756 if (n != NULL && !n->is_top()) { 757 for(uint i=0; i<m; i++ ) { 758 n->add_out((Node *)this); 759 } 760 } 761 } 762 763 //------------------------------del_req---------------------------------------- 764 // Delete the required edge and compact the edge array 765 void Node::del_req( uint idx ) { 766 assert( idx < _cnt, "oob"); 767 assert( !VerifyHashTableKeys || _hash_lock == 0, 768 "remove node from hash table before modifying it"); 769 // First remove corresponding def-use edge 770 Node *n = in(idx); 771 if (n != NULL) n->del_out((Node *)this); 772 _in[idx] = in(--_cnt); // Compact the array 773 _in[_cnt] = NULL; // NULL out emptied slot 774 } 775 776 //------------------------------del_req_ordered-------------------------------- 777 // Delete the required edge and compact the edge array with preserved order 778 void Node::del_req_ordered( uint idx ) { 779 assert( idx < _cnt, "oob"); 780 assert( !VerifyHashTableKeys || _hash_lock == 0, 781 "remove node from hash table before modifying it"); 782 // First remove corresponding def-use edge 783 Node *n = in(idx); 784 if (n != NULL) n->del_out((Node *)this); 785 if (idx < _cnt - 1) { // Not last edge ? 786 Copy::conjoint_words_to_lower((HeapWord*)&_in[idx+1], (HeapWord*)&_in[idx], ((_cnt-idx-1)*sizeof(Node*))); 787 } 788 _in[--_cnt] = NULL; // NULL out emptied slot 789 } 790 791 //------------------------------ins_req---------------------------------------- 792 // Insert a new required input at the end 793 void Node::ins_req( uint idx, Node *n ) { 794 assert( is_not_dead(n), "can not use dead node"); 795 add_req(NULL); // Make space 796 assert( idx < _max, "Must have allocated enough space"); 797 // Slide over 798 if(_cnt-idx-1 > 0) { 799 Copy::conjoint_words_to_higher((HeapWord*)&_in[idx], (HeapWord*)&_in[idx+1], ((_cnt-idx-1)*sizeof(Node*))); 800 } 801 _in[idx] = n; // Stuff over old required edge 802 if (n != NULL) n->add_out((Node *)this); // Add reciprocal def-use edge 803 } 804 805 //-----------------------------find_edge--------------------------------------- 806 int Node::find_edge(Node* n) { 807 for (uint i = 0; i < len(); i++) { 808 if (_in[i] == n) return i; 809 } 810 return -1; |