Mercurial > hg > truffle
comparison src/share/vm/opto/block.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 | 4b078f877b56 |
comparison
equal
deleted
inserted
replaced
12161:e1fbb86b47e4 | 12167:650868c062a9 |
---|---|
110 // Return the number of instructions left to compute if the block has | 110 // Return the number of instructions left to compute if the block has |
111 // less then 'inst_cnt' instructions. Stop, and return 0 if sum_size | 111 // less then 'inst_cnt' instructions. Stop, and return 0 if sum_size |
112 // exceeds OptoLoopAlignment. | 112 // exceeds OptoLoopAlignment. |
113 uint Block::compute_first_inst_size(uint& sum_size, uint inst_cnt, | 113 uint Block::compute_first_inst_size(uint& sum_size, uint inst_cnt, |
114 PhaseRegAlloc* ra) { | 114 PhaseRegAlloc* ra) { |
115 uint last_inst = _nodes.size(); | 115 uint last_inst = number_of_nodes(); |
116 for( uint j = 0; j < last_inst && inst_cnt > 0; j++ ) { | 116 for( uint j = 0; j < last_inst && inst_cnt > 0; j++ ) { |
117 uint inst_size = _nodes[j]->size(ra); | 117 uint inst_size = get_node(j)->size(ra); |
118 if( inst_size > 0 ) { | 118 if( inst_size > 0 ) { |
119 inst_cnt--; | 119 inst_cnt--; |
120 uint sz = sum_size + inst_size; | 120 uint sz = sum_size + inst_size; |
121 if( sz <= (uint)OptoLoopAlignment ) { | 121 if( sz <= (uint)OptoLoopAlignment ) { |
122 // Compute size of instructions which fit into fetch buffer only | 122 // Compute size of instructions which fit into fetch buffer only |
129 } | 129 } |
130 return inst_cnt; | 130 return inst_cnt; |
131 } | 131 } |
132 | 132 |
133 uint Block::find_node( const Node *n ) const { | 133 uint Block::find_node( const Node *n ) const { |
134 for( uint i = 0; i < _nodes.size(); i++ ) { | 134 for( uint i = 0; i < number_of_nodes(); i++ ) { |
135 if( _nodes[i] == n ) | 135 if( get_node(i) == n ) |
136 return i; | 136 return i; |
137 } | 137 } |
138 ShouldNotReachHere(); | 138 ShouldNotReachHere(); |
139 return 0; | 139 return 0; |
140 } | 140 } |
141 | 141 |
142 // Find and remove n from block list | 142 // Find and remove n from block list |
143 void Block::find_remove( const Node *n ) { | 143 void Block::find_remove( const Node *n ) { |
144 _nodes.remove(find_node(n)); | 144 remove_node(find_node(n)); |
145 } | 145 } |
146 | 146 |
147 // Return empty status of a block. Empty blocks contain only the head, other | 147 // Return empty status of a block. Empty blocks contain only the head, other |
148 // ideal nodes, and an optional trailing goto. | 148 // ideal nodes, and an optional trailing goto. |
149 int Block::is_Empty() const { | 149 int Block::is_Empty() const { |
152 if (head()->is_Root() || head()->is_Start()) { | 152 if (head()->is_Root() || head()->is_Start()) { |
153 return not_empty; | 153 return not_empty; |
154 } | 154 } |
155 | 155 |
156 int success_result = completely_empty; | 156 int success_result = completely_empty; |
157 int end_idx = _nodes.size()-1; | 157 int end_idx = number_of_nodes() - 1; |
158 | 158 |
159 // Check for ending goto | 159 // Check for ending goto |
160 if ((end_idx > 0) && (_nodes[end_idx]->is_MachGoto())) { | 160 if ((end_idx > 0) && (get_node(end_idx)->is_MachGoto())) { |
161 success_result = empty_with_goto; | 161 success_result = empty_with_goto; |
162 end_idx--; | 162 end_idx--; |
163 } | 163 } |
164 | 164 |
165 // Unreachable blocks are considered empty | 165 // Unreachable blocks are considered empty |
168 } | 168 } |
169 | 169 |
170 // Ideal nodes are allowable in empty blocks: skip them Only MachNodes | 170 // Ideal nodes are allowable in empty blocks: skip them Only MachNodes |
171 // turn directly into code, because only MachNodes have non-trivial | 171 // turn directly into code, because only MachNodes have non-trivial |
172 // emit() functions. | 172 // emit() functions. |
173 while ((end_idx > 0) && !_nodes[end_idx]->is_Mach()) { | 173 while ((end_idx > 0) && !get_node(end_idx)->is_Mach()) { |
174 end_idx--; | 174 end_idx--; |
175 } | 175 } |
176 | 176 |
177 // No room for any interesting instructions? | 177 // No room for any interesting instructions? |
178 if (end_idx == 0) { | 178 if (end_idx == 0) { |
342 dump(NULL); | 342 dump(NULL); |
343 } | 343 } |
344 | 344 |
345 void Block::dump(const PhaseCFG* cfg) const { | 345 void Block::dump(const PhaseCFG* cfg) const { |
346 dump_head(cfg); | 346 dump_head(cfg); |
347 for (uint i=0; i< _nodes.size(); i++) { | 347 for (uint i=0; i< number_of_nodes(); i++) { |
348 _nodes[i]->dump(); | 348 get_node(i)->dump(); |
349 } | 349 } |
350 tty->print("\n"); | 350 tty->print("\n"); |
351 } | 351 } |
352 #endif | 352 #endif |
353 | 353 |
432 // Put self in array of basic blocks | 432 // Put self in array of basic blocks |
433 Block *bb = new (_block_arena) Block(_block_arena, p); | 433 Block *bb = new (_block_arena) Block(_block_arena, p); |
434 map_node_to_block(p, bb); | 434 map_node_to_block(p, bb); |
435 map_node_to_block(x, bb); | 435 map_node_to_block(x, bb); |
436 if( x != p ) { // Only for root is x == p | 436 if( x != p ) { // Only for root is x == p |
437 bb->_nodes.push((Node*)x); | 437 bb->push_node((Node*)x); |
438 } | 438 } |
439 // Now handle predecessors | 439 // Now handle predecessors |
440 ++sum; // Count 1 for self block | 440 ++sum; // Count 1 for self block |
441 uint cnt = bb->num_preds(); | 441 uint cnt = bb->num_preds(); |
442 for (int i = (cnt - 1); i > 0; i-- ) { // For all predecessors | 442 for (int i = (cnt - 1); i > 0; i-- ) { // For all predecessors |
467 // Insert into nodes array, if not already there | 467 // Insert into nodes array, if not already there |
468 if (!has_block(proj)) { | 468 if (!has_block(proj)) { |
469 assert( x != proj, "" ); | 469 assert( x != proj, "" ); |
470 // Map basic block of projection | 470 // Map basic block of projection |
471 map_node_to_block(proj, pb); | 471 map_node_to_block(proj, pb); |
472 pb->_nodes.push(proj); | 472 pb->push_node(proj); |
473 } | 473 } |
474 // Insert self as a child of my predecessor block | 474 // Insert self as a child of my predecessor block |
475 pb->_succs.map(pb->_num_succs++, get_block_for_node(np)); | 475 pb->_succs.map(pb->_num_succs++, get_block_for_node(np)); |
476 assert( pb->_nodes[ pb->_nodes.size() - pb->_num_succs ]->is_block_proj(), | 476 assert( pb->get_node(pb->number_of_nodes() - pb->_num_succs)->is_block_proj(), |
477 "too many control users, not a CFG?" ); | 477 "too many control users, not a CFG?" ); |
478 } | 478 } |
479 } | 479 } |
480 // Return number of basic blocks for all children and self | 480 // Return number of basic blocks for all children and self |
481 return sum; | 481 return sum; |
493 // Compute frequency of the new block. Do this before inserting | 493 // Compute frequency of the new block. Do this before inserting |
494 // new block in case succ_prob() needs to infer the probability from | 494 // new block in case succ_prob() needs to infer the probability from |
495 // surrounding blocks. | 495 // surrounding blocks. |
496 float freq = in->_freq * in->succ_prob(succ_no); | 496 float freq = in->_freq * in->succ_prob(succ_no); |
497 // get ProjNode corresponding to the succ_no'th successor of the in block | 497 // get ProjNode corresponding to the succ_no'th successor of the in block |
498 ProjNode* proj = in->_nodes[in->_nodes.size() - in->_num_succs + succ_no]->as_Proj(); | 498 ProjNode* proj = in->get_node(in->number_of_nodes() - in->_num_succs + succ_no)->as_Proj(); |
499 // create region for basic block | 499 // create region for basic block |
500 RegionNode* region = new (C) RegionNode(2); | 500 RegionNode* region = new (C) RegionNode(2); |
501 region->init_req(1, proj); | 501 region->init_req(1, proj); |
502 // setup corresponding basic block | 502 // setup corresponding basic block |
503 Block* block = new (_block_arena) Block(_block_arena, region); | 503 Block* block = new (_block_arena) Block(_block_arena, region); |
505 C->regalloc()->set_bad(region->_idx); | 505 C->regalloc()->set_bad(region->_idx); |
506 // add a goto node | 506 // add a goto node |
507 Node* gto = _goto->clone(); // get a new goto node | 507 Node* gto = _goto->clone(); // get a new goto node |
508 gto->set_req(0, region); | 508 gto->set_req(0, region); |
509 // add it to the basic block | 509 // add it to the basic block |
510 block->_nodes.push(gto); | 510 block->push_node(gto); |
511 map_node_to_block(gto, block); | 511 map_node_to_block(gto, block); |
512 C->regalloc()->set_bad(gto->_idx); | 512 C->regalloc()->set_bad(gto->_idx); |
513 // hook up successor block | 513 // hook up successor block |
514 block->_succs.map(block->_num_succs++, out); | 514 block->_succs.map(block->_num_succs++, out); |
515 // remap successor's predecessors if necessary | 515 // remap successor's predecessors if necessary |
525 } | 525 } |
526 | 526 |
527 // Does this block end in a multiway branch that cannot have the default case | 527 // Does this block end in a multiway branch that cannot have the default case |
528 // flipped for another case? | 528 // flipped for another case? |
529 static bool no_flip_branch( Block *b ) { | 529 static bool no_flip_branch( Block *b ) { |
530 int branch_idx = b->_nodes.size() - b->_num_succs-1; | 530 int branch_idx = b->number_of_nodes() - b->_num_succs-1; |
531 if( branch_idx < 1 ) return false; | 531 if( branch_idx < 1 ) return false; |
532 Node *bra = b->_nodes[branch_idx]; | 532 Node *bra = b->get_node(branch_idx); |
533 if( bra->is_Catch() ) | 533 if( bra->is_Catch() ) |
534 return true; | 534 return true; |
535 if( bra->is_Mach() ) { | 535 if( bra->is_Mach() ) { |
536 if( bra->is_MachNullCheck() ) | 536 if( bra->is_MachNullCheck() ) |
537 return true; | 537 return true; |
548 // fake exit path to infinite loops. At this late stage they need to turn | 548 // fake exit path to infinite loops. At this late stage they need to turn |
549 // into Goto's so that when you enter the infinite loop you indeed hang. | 549 // into Goto's so that when you enter the infinite loop you indeed hang. |
550 void PhaseCFG::convert_NeverBranch_to_Goto(Block *b) { | 550 void PhaseCFG::convert_NeverBranch_to_Goto(Block *b) { |
551 // Find true target | 551 // Find true target |
552 int end_idx = b->end_idx(); | 552 int end_idx = b->end_idx(); |
553 int idx = b->_nodes[end_idx+1]->as_Proj()->_con; | 553 int idx = b->get_node(end_idx+1)->as_Proj()->_con; |
554 Block *succ = b->_succs[idx]; | 554 Block *succ = b->_succs[idx]; |
555 Node* gto = _goto->clone(); // get a new goto node | 555 Node* gto = _goto->clone(); // get a new goto node |
556 gto->set_req(0, b->head()); | 556 gto->set_req(0, b->head()); |
557 Node *bp = b->_nodes[end_idx]; | 557 Node *bp = b->get_node(end_idx); |
558 b->_nodes.map(end_idx,gto); // Slam over NeverBranch | 558 b->map_node(gto, end_idx); // Slam over NeverBranch |
559 map_node_to_block(gto, b); | 559 map_node_to_block(gto, b); |
560 C->regalloc()->set_bad(gto->_idx); | 560 C->regalloc()->set_bad(gto->_idx); |
561 b->_nodes.pop(); // Yank projections | 561 b->pop_node(); // Yank projections |
562 b->_nodes.pop(); // Yank projections | 562 b->pop_node(); // Yank projections |
563 b->_succs.map(0,succ); // Map only successor | 563 b->_succs.map(0,succ); // Map only successor |
564 b->_num_succs = 1; | 564 b->_num_succs = 1; |
565 // remap successor's predecessors if necessary | 565 // remap successor's predecessors if necessary |
566 uint j; | 566 uint j; |
567 for( j = 1; j < succ->num_preds(); j++) | 567 for( j = 1; j < succ->num_preds(); j++) |
573 if( dead->pred(j)->in(0) == bp ) | 573 if( dead->pred(j)->in(0) == bp ) |
574 break; | 574 break; |
575 // Scan through block, yanking dead path from | 575 // Scan through block, yanking dead path from |
576 // all regions and phis. | 576 // all regions and phis. |
577 dead->head()->del_req(j); | 577 dead->head()->del_req(j); |
578 for( int k = 1; dead->_nodes[k]->is_Phi(); k++ ) | 578 for( int k = 1; dead->get_node(k)->is_Phi(); k++ ) |
579 dead->_nodes[k]->del_req(j); | 579 dead->get_node(k)->del_req(j); |
580 } | 580 } |
581 | 581 |
582 // Helper function to move block bx to the slot following b_index. Return | 582 // Helper function to move block bx to the slot following b_index. Return |
583 // true if the move is successful, otherwise false | 583 // true if the move is successful, otherwise false |
584 bool PhaseCFG::move_to_next(Block* bx, uint b_index) { | 584 bool PhaseCFG::move_to_next(Block* bx, uint b_index) { |
618 void PhaseCFG::move_to_end(Block *b, uint i) { | 618 void PhaseCFG::move_to_end(Block *b, uint i) { |
619 int e = b->is_Empty(); | 619 int e = b->is_Empty(); |
620 if (e != Block::not_empty) { | 620 if (e != Block::not_empty) { |
621 if (e == Block::empty_with_goto) { | 621 if (e == Block::empty_with_goto) { |
622 // Remove the goto, but leave the block. | 622 // Remove the goto, but leave the block. |
623 b->_nodes.pop(); | 623 b->pop_node(); |
624 } | 624 } |
625 // Mark this block as a connector block, which will cause it to be | 625 // Mark this block as a connector block, which will cause it to be |
626 // ignored in certain functions such as non_connector_successor(). | 626 // ignored in certain functions such as non_connector_successor(). |
627 b->set_connector(); | 627 b->set_connector(); |
628 } | 628 } |
661 // true target. NeverBranch are treated as a conditional branch that | 661 // true target. NeverBranch are treated as a conditional branch that |
662 // always goes the same direction for most of the optimizer and are used | 662 // always goes the same direction for most of the optimizer and are used |
663 // to give a fake exit path to infinite loops. At this late stage they | 663 // to give a fake exit path to infinite loops. At this late stage they |
664 // need to turn into Goto's so that when you enter the infinite loop you | 664 // need to turn into Goto's so that when you enter the infinite loop you |
665 // indeed hang. | 665 // indeed hang. |
666 if (block->_nodes[block->end_idx()]->Opcode() == Op_NeverBranch) { | 666 if (block->get_node(block->end_idx())->Opcode() == Op_NeverBranch) { |
667 convert_NeverBranch_to_Goto(block); | 667 convert_NeverBranch_to_Goto(block); |
668 } | 668 } |
669 | 669 |
670 // Look for uncommon blocks and move to end. | 670 // Look for uncommon blocks and move to end. |
671 if (!C->do_freq_based_layout()) { | 671 if (!C->do_freq_based_layout()) { |
718 | 718 |
719 // Check for multi-way branches where I cannot negate the test to | 719 // Check for multi-way branches where I cannot negate the test to |
720 // exchange the true and false targets. | 720 // exchange the true and false targets. |
721 if (no_flip_branch(block)) { | 721 if (no_flip_branch(block)) { |
722 // Find fall through case - if must fall into its target | 722 // Find fall through case - if must fall into its target |
723 int branch_idx = block->_nodes.size() - block->_num_succs; | 723 int branch_idx = block->number_of_nodes() - block->_num_succs; |
724 for (uint j2 = 0; j2 < block->_num_succs; j2++) { | 724 for (uint j2 = 0; j2 < block->_num_succs; j2++) { |
725 const ProjNode* p = block->_nodes[branch_idx + j2]->as_Proj(); | 725 const ProjNode* p = block->get_node(branch_idx + j2)->as_Proj(); |
726 if (p->_con == 0) { | 726 if (p->_con == 0) { |
727 // successor j2 is fall through case | 727 // successor j2 is fall through case |
728 if (block->non_connector_successor(j2) != bnext) { | 728 if (block->non_connector_successor(j2) != bnext) { |
729 // but it is not the next block => insert a goto | 729 // but it is not the next block => insert a goto |
730 insert_goto_at(i, j2); | 730 insert_goto_at(i, j2); |
741 } | 741 } |
742 } | 742 } |
743 | 743 |
744 // Remove all CatchProjs | 744 // Remove all CatchProjs |
745 for (uint j = 0; j < block->_num_succs; j++) { | 745 for (uint j = 0; j < block->_num_succs; j++) { |
746 block->_nodes.pop(); | 746 block->pop_node(); |
747 } | 747 } |
748 | 748 |
749 } else if (block->_num_succs == 1) { | 749 } else if (block->_num_succs == 1) { |
750 // Block ends in a Goto? | 750 // Block ends in a Goto? |
751 if (bnext == bs0) { | 751 if (bnext == bs0) { |
752 // We fall into next block; remove the Goto | 752 // We fall into next block; remove the Goto |
753 block->_nodes.pop(); | 753 block->pop_node(); |
754 } | 754 } |
755 | 755 |
756 } else if(block->_num_succs == 2) { // Block ends in a If? | 756 } else if(block->_num_succs == 2) { // Block ends in a If? |
757 // Get opcode of 1st projection (matches _succs[0]) | 757 // Get opcode of 1st projection (matches _succs[0]) |
758 // Note: Since this basic block has 2 exits, the last 2 nodes must | 758 // Note: Since this basic block has 2 exits, the last 2 nodes must |
759 // be projections (in any order), the 3rd last node must be | 759 // be projections (in any order), the 3rd last node must be |
760 // the IfNode (we have excluded other 2-way exits such as | 760 // the IfNode (we have excluded other 2-way exits such as |
761 // CatchNodes already). | 761 // CatchNodes already). |
762 MachNode* iff = block->_nodes[block->_nodes.size() - 3]->as_Mach(); | 762 MachNode* iff = block->get_node(block->number_of_nodes() - 3)->as_Mach(); |
763 ProjNode* proj0 = block->_nodes[block->_nodes.size() - 2]->as_Proj(); | 763 ProjNode* proj0 = block->get_node(block->number_of_nodes() - 2)->as_Proj(); |
764 ProjNode* proj1 = block->_nodes[block->_nodes.size() - 1]->as_Proj(); | 764 ProjNode* proj1 = block->get_node(block->number_of_nodes() - 1)->as_Proj(); |
765 | 765 |
766 // Assert that proj0 and succs[0] match up. Similarly for proj1 and succs[1]. | 766 // Assert that proj0 and succs[0] match up. Similarly for proj1 and succs[1]. |
767 assert(proj0->raw_out(0) == block->_succs[0]->head(), "Mismatch successor 0"); | 767 assert(proj0->raw_out(0) == block->_succs[0]->head(), "Mismatch successor 0"); |
768 assert(proj1->raw_out(0) == block->_succs[1]->head(), "Mismatch successor 1"); | 768 assert(proj1->raw_out(0) == block->_succs[1]->head(), "Mismatch successor 1"); |
769 | 769 |
831 // Make sure we TRUE branch to the target | 831 // Make sure we TRUE branch to the target |
832 if (proj0->Opcode() == Op_IfFalse) { | 832 if (proj0->Opcode() == Op_IfFalse) { |
833 iff->as_MachIf()->negate(); | 833 iff->as_MachIf()->negate(); |
834 } | 834 } |
835 | 835 |
836 block->_nodes.pop(); // Remove IfFalse & IfTrue projections | 836 block->pop_node(); // Remove IfFalse & IfTrue projections |
837 block->_nodes.pop(); | 837 block->pop_node(); |
838 | 838 |
839 } else { | 839 } else { |
840 // Multi-exit block, e.g. a switch statement | 840 // Multi-exit block, e.g. a switch statement |
841 // But we don't need to do anything here | 841 // But we don't need to do anything here |
842 } | 842 } |
893 void PhaseCFG::verify() const { | 893 void PhaseCFG::verify() const { |
894 #ifdef ASSERT | 894 #ifdef ASSERT |
895 // Verify sane CFG | 895 // Verify sane CFG |
896 for (uint i = 0; i < number_of_blocks(); i++) { | 896 for (uint i = 0; i < number_of_blocks(); i++) { |
897 Block* block = get_block(i); | 897 Block* block = get_block(i); |
898 uint cnt = block->_nodes.size(); | 898 uint cnt = block->number_of_nodes(); |
899 uint j; | 899 uint j; |
900 for (j = 0; j < cnt; j++) { | 900 for (j = 0; j < cnt; j++) { |
901 Node *n = block->_nodes[j]; | 901 Node *n = block->get_node(j); |
902 assert(get_block_for_node(n) == block, ""); | 902 assert(get_block_for_node(n) == block, ""); |
903 if (j >= 1 && n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_CreateEx) { | 903 if (j >= 1 && n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_CreateEx) { |
904 assert(j == 1 || block->_nodes[j-1]->is_Phi(), "CreateEx must be first instruction in block"); | 904 assert(j == 1 || block->get_node(j-1)->is_Phi(), "CreateEx must be first instruction in block"); |
905 } | 905 } |
906 for (uint k = 0; k < n->req(); k++) { | 906 for (uint k = 0; k < n->req(); k++) { |
907 Node *def = n->in(k); | 907 Node *def = n->in(k); |
908 if (def && def != n) { | 908 if (def && def != n) { |
909 assert(get_block_for_node(def) || def->is_Con(), "must have block; constants for debug info ok"); | 909 assert(get_block_for_node(def) || def->is_Con(), "must have block; constants for debug info ok"); |
928 } | 928 } |
929 } | 929 } |
930 } | 930 } |
931 | 931 |
932 j = block->end_idx(); | 932 j = block->end_idx(); |
933 Node* bp = (Node*)block->_nodes[block->_nodes.size() - 1]->is_block_proj(); | 933 Node* bp = (Node*)block->get_node(block->number_of_nodes() - 1)->is_block_proj(); |
934 assert(bp, "last instruction must be a block proj"); | 934 assert(bp, "last instruction must be a block proj"); |
935 assert(bp == block->_nodes[j], "wrong number of successors for this block"); | 935 assert(bp == block->get_node(j), "wrong number of successors for this block"); |
936 if (bp->is_Catch()) { | 936 if (bp->is_Catch()) { |
937 while (block->_nodes[--j]->is_MachProj()) { | 937 while (block->get_node(--j)->is_MachProj()) { |
938 ; | 938 ; |
939 } | 939 } |
940 assert(block->_nodes[j]->is_MachCall(), "CatchProj must follow call"); | 940 assert(block->get_node(j)->is_MachCall(), "CatchProj must follow call"); |
941 } else if (bp->is_Mach() && bp->as_Mach()->ideal_Opcode() == Op_If) { | 941 } else if (bp->is_Mach() && bp->as_Mach()->ideal_Opcode() == Op_If) { |
942 assert(block->_num_succs == 2, "Conditional branch must have two targets"); | 942 assert(block->_num_succs == 2, "Conditional branch must have two targets"); |
943 } | 943 } |
944 } | 944 } |
945 #endif | 945 #endif |
1438 if (nfallthru == 2) { | 1438 if (nfallthru == 2) { |
1439 // Ensure that the sense of the branch is correct | 1439 // Ensure that the sense of the branch is correct |
1440 Block *bnext = next(b); | 1440 Block *bnext = next(b); |
1441 Block *bs0 = b->non_connector_successor(0); | 1441 Block *bs0 = b->non_connector_successor(0); |
1442 | 1442 |
1443 MachNode *iff = b->_nodes[b->_nodes.size()-3]->as_Mach(); | 1443 MachNode *iff = b->get_node(b->number_of_nodes() - 3)->as_Mach(); |
1444 ProjNode *proj0 = b->_nodes[b->_nodes.size()-2]->as_Proj(); | 1444 ProjNode *proj0 = b->get_node(b->number_of_nodes() - 2)->as_Proj(); |
1445 ProjNode *proj1 = b->_nodes[b->_nodes.size()-1]->as_Proj(); | 1445 ProjNode *proj1 = b->get_node(b->number_of_nodes() - 1)->as_Proj(); |
1446 | 1446 |
1447 if (bnext == bs0) { | 1447 if (bnext == bs0) { |
1448 // Fall-thru case in succs[0], should be in succs[1] | 1448 // Fall-thru case in succs[0], should be in succs[1] |
1449 | 1449 |
1450 // Flip targets in _succs map | 1450 // Flip targets in _succs map |
1452 Block *tbs1 = b->_succs[1]; | 1452 Block *tbs1 = b->_succs[1]; |
1453 b->_succs.map( 0, tbs1 ); | 1453 b->_succs.map( 0, tbs1 ); |
1454 b->_succs.map( 1, tbs0 ); | 1454 b->_succs.map( 1, tbs0 ); |
1455 | 1455 |
1456 // Flip projections to match targets | 1456 // Flip projections to match targets |
1457 b->_nodes.map(b->_nodes.size()-2, proj1); | 1457 b->map_node(proj1, b->number_of_nodes() - 2); |
1458 b->_nodes.map(b->_nodes.size()-1, proj0); | 1458 b->map_node(proj0, b->number_of_nodes() - 1); |
1459 } | 1459 } |
1460 } | 1460 } |
1461 } | 1461 } |
1462 } | 1462 } |
1463 } | 1463 } |