300 // so (last->is_block_proj() != last) always, then simplify this code
301 // This will not give correct end_idx for block 0 when it only contains root.
302 int last_idx = _nodes.size() - 1;
303 Node *last = _nodes[last_idx];
304 assert(last->is_block_proj() == last || last->is_block_proj() == _nodes[last_idx - _num_succs], "");
305 return (last->is_block_proj() == last) ? last_idx : (last_idx - _num_succs);
306 }
307
308 // Basic blocks have a Node which ends them. This Node determines which
309 // basic block follows this one in the program flow. This Node is either an
310 // IfNode, a GotoNode, a JmpNode, or a ReturnNode.
311 Node *end() const { return _nodes[end_idx()]; }
312
313 // Add an instruction to an existing block. It must go after the head
314 // instruction and before the end instruction.
315 void add_inst( Node *n ) { insert_node(n, end_idx()); }
316 // Find node in block. Fails if node not in block.
317 uint find_node( const Node *n ) const;
318 // Find and remove n from block list
319 void find_remove( const Node *n );
320 // Check wether the node is in the block.
321 bool contains (const Node *n) const;
322
323 // Return the empty status of a block
324 enum { not_empty, empty_with_goto, completely_empty };
325 int is_Empty() const;
326
327 // Forward through connectors
328 Block* non_connector() {
329 Block* s = this;
330 while (s->is_connector()) {
331 s = s->_succs[0];
332 }
333 return s;
334 }
335
336 // Return true if b is a successor of this block
337 bool has_successor(Block* b) const {
338 for (uint i = 0; i < _num_succs; i++ ) {
339 if (non_connector_successor(i) == b) {
340 return true;
|
300 // so (last->is_block_proj() != last) always, then simplify this code
301 // This will not give correct end_idx for block 0 when it only contains root.
302 int last_idx = _nodes.size() - 1;
303 Node *last = _nodes[last_idx];
304 assert(last->is_block_proj() == last || last->is_block_proj() == _nodes[last_idx - _num_succs], "");
305 return (last->is_block_proj() == last) ? last_idx : (last_idx - _num_succs);
306 }
307
308 // Basic blocks have a Node which ends them. This Node determines which
309 // basic block follows this one in the program flow. This Node is either an
310 // IfNode, a GotoNode, a JmpNode, or a ReturnNode.
311 Node *end() const { return _nodes[end_idx()]; }
312
313 // Add an instruction to an existing block. It must go after the head
314 // instruction and before the end instruction.
315 void add_inst( Node *n ) { insert_node(n, end_idx()); }
316 // Find node in block. Fails if node not in block.
317 uint find_node( const Node *n ) const;
318 // Find and remove n from block list
319 void find_remove( const Node *n );
320 // Check whether the node is in the block.
321 bool contains (const Node *n) const;
322
323 // Return the empty status of a block
324 enum { not_empty, empty_with_goto, completely_empty };
325 int is_Empty() const;
326
327 // Forward through connectors
328 Block* non_connector() {
329 Block* s = this;
330 while (s->is_connector()) {
331 s = s->_succs[0];
332 }
333 return s;
334 }
335
336 // Return true if b is a successor of this block
337 bool has_successor(Block* b) const {
338 for (uint i = 0; i < _num_succs; i++ ) {
339 if (non_connector_successor(i) == b) {
340 return true;
|