comparison src/share/vm/opto/live.cpp @ 12167:650868c062a9

8023691: Create interface for nodes in class Block Summary: Create public methods for accessing the nodes in a block Reviewed-by: kvn, roland
author adlertz
date Mon, 26 Aug 2013 12:50:23 +0200
parents adb9a7d94cb5
children 7944aba7ba41 8c83625e3a53
comparison
equal deleted inserted replaced
12161:e1fbb86b47e4 12167:650868c062a9
83 // Compute the local live-in set. Start with any new live-out bits. 83 // Compute the local live-in set. Start with any new live-out bits.
84 IndexSet* use = getset(block); 84 IndexSet* use = getset(block);
85 IndexSet* def = &_defs[block->_pre_order-1]; 85 IndexSet* def = &_defs[block->_pre_order-1];
86 DEBUG_ONLY(IndexSet *def_outside = getfreeset();) 86 DEBUG_ONLY(IndexSet *def_outside = getfreeset();)
87 uint i; 87 uint i;
88 for (i = block->_nodes.size(); i > 1; i--) { 88 for (i = block->number_of_nodes(); i > 1; i--) {
89 Node* n = block->_nodes[i-1]; 89 Node* n = block->get_node(i-1);
90 if (n->is_Phi()) { 90 if (n->is_Phi()) {
91 break; 91 break;
92 } 92 }
93 93
94 uint r = _names[n->_idx]; 94 uint r = _names[n->_idx];
110 def_outside->set_next(_free_IndexSet); 110 def_outside->set_next(_free_IndexSet);
111 _free_IndexSet = def_outside; // Drop onto free list 111 _free_IndexSet = def_outside; // Drop onto free list
112 #endif 112 #endif
113 // Remove anything defined by Phis and the block start instruction 113 // Remove anything defined by Phis and the block start instruction
114 for (uint k = i; k > 0; k--) { 114 for (uint k = i; k > 0; k--) {
115 uint r = _names[block->_nodes[k - 1]->_idx]; 115 uint r = _names[block->get_node(k - 1)->_idx];
116 def->insert(r); 116 def->insert(r);
117 use->remove(r); 117 use->remove(r);
118 } 118 }
119 119
120 // Push these live-in things to predecessors 120 // Push these live-in things to predecessors
122 Block* p = _cfg.get_block_for_node(block->pred(l)); 122 Block* p = _cfg.get_block_for_node(block->pred(l));
123 add_liveout(p, use, first_pass); 123 add_liveout(p, use, first_pass);
124 124
125 // PhiNode uses go in the live-out set of prior blocks. 125 // PhiNode uses go in the live-out set of prior blocks.
126 for (uint k = i; k > 0; k--) { 126 for (uint k = i; k > 0; k--) {
127 add_liveout(p, _names[block->_nodes[k-1]->in(l)->_idx], first_pass); 127 add_liveout(p, _names[block->get_node(k-1)->in(l)->_idx], first_pass);
128 } 128 }
129 } 129 }
130 freeset(block); 130 freeset(block);
131 first_pass.set(block->_pre_order); 131 first_pass.set(block->_pre_order);
132 132
252 #ifndef PRODUCT 252 #ifndef PRODUCT
253 // Dump the live-out set for a block 253 // Dump the live-out set for a block
254 void PhaseLive::dump( const Block *b ) const { 254 void PhaseLive::dump( const Block *b ) const {
255 tty->print("Block %d: ",b->_pre_order); 255 tty->print("Block %d: ",b->_pre_order);
256 tty->print("LiveOut: "); _live[b->_pre_order-1].dump(); 256 tty->print("LiveOut: "); _live[b->_pre_order-1].dump();
257 uint cnt = b->_nodes.size(); 257 uint cnt = b->number_of_nodes();
258 for( uint i=0; i<cnt; i++ ) { 258 for( uint i=0; i<cnt; i++ ) {
259 tty->print("L%d/", _names[b->_nodes[i]->_idx] ); 259 tty->print("L%d/", _names[b->get_node(i)->_idx] );
260 b->_nodes[i]->dump(); 260 b->get_node(i)->dump();
261 } 261 }
262 tty->print("\n"); 262 tty->print("\n");
263 } 263 }
264 264
265 // Verify that base pointers and derived pointers are still sane. 265 // Verify that base pointers and derived pointers are still sane.
267 #ifdef ASSERT 267 #ifdef ASSERT
268 Unique_Node_List worklist(a); 268 Unique_Node_List worklist(a);
269 for (uint i = 0; i < _cfg.number_of_blocks(); i++) { 269 for (uint i = 0; i < _cfg.number_of_blocks(); i++) {
270 Block* block = _cfg.get_block(i); 270 Block* block = _cfg.get_block(i);
271 for (uint j = block->end_idx() + 1; j > 1; j--) { 271 for (uint j = block->end_idx() + 1; j > 1; j--) {
272 Node* n = block->_nodes[j-1]; 272 Node* n = block->get_node(j-1);
273 if (n->is_Phi()) { 273 if (n->is_Phi()) {
274 break; 274 break;
275 } 275 }
276 // Found a safepoint? 276 // Found a safepoint?
277 if (n->is_MachSafePoint()) { 277 if (n->is_MachSafePoint()) {