hotspot/src/share/vm/c1/c1_Instruction.cpp
changeset 10509 43d670e5701e
parent 9170 56670ec8e643
child 13391 30245956af37
equal deleted inserted replaced
10508:233d2e7c462d 10509:43d670e5701e
   512 
   512 
   513 // Implementation of BlockBegin
   513 // Implementation of BlockBegin
   514 
   514 
   515 void BlockBegin::set_end(BlockEnd* end) {
   515 void BlockBegin::set_end(BlockEnd* end) {
   516   assert(end != NULL, "should not reset block end to NULL");
   516   assert(end != NULL, "should not reset block end to NULL");
   517   BlockEnd* old_end = _end;
   517   if (end == _end) {
   518   if (end == old_end) {
       
   519     return;
   518     return;
   520   }
   519   }
   521   // Must make the predecessors/successors match up with the
   520   clear_end();
   522   // BlockEnd's notion.
   521 
   523   int i, n;
   522   // Set the new end
   524   if (old_end != NULL) {
       
   525     // disconnect from the old end
       
   526     old_end->set_begin(NULL);
       
   527 
       
   528     // disconnect this block from it's current successors
       
   529     for (i = 0; i < _successors.length(); i++) {
       
   530       _successors.at(i)->remove_predecessor(this);
       
   531     }
       
   532   }
       
   533   _end = end;
   523   _end = end;
   534 
   524 
   535   _successors.clear();
   525   _successors.clear();
   536   // Now reset successors list based on BlockEnd
   526   // Now reset successors list based on BlockEnd
   537   n = end->number_of_sux();
   527   for (int i = 0; i < end->number_of_sux(); i++) {
   538   for (i = 0; i < n; i++) {
       
   539     BlockBegin* sux = end->sux_at(i);
   528     BlockBegin* sux = end->sux_at(i);
   540     _successors.append(sux);
   529     _successors.append(sux);
   541     sux->_predecessors.append(this);
   530     sux->_predecessors.append(this);
   542   }
   531   }
   543   _end->set_begin(this);
   532   _end->set_begin(this);
       
   533 }
       
   534 
       
   535 
       
   536 void BlockBegin::clear_end() {
       
   537   // Must make the predecessors/successors match up with the
       
   538   // BlockEnd's notion.
       
   539   if (_end != NULL) {
       
   540     // disconnect from the old end
       
   541     _end->set_begin(NULL);
       
   542 
       
   543     // disconnect this block from it's current successors
       
   544     for (int i = 0; i < _successors.length(); i++) {
       
   545       _successors.at(i)->remove_predecessor(this);
       
   546     }
       
   547     _end = NULL;
       
   548   }
   544 }
   549 }
   545 
   550 
   546 
   551 
   547 void BlockBegin::disconnect_edge(BlockBegin* from, BlockBegin* to) {
   552 void BlockBegin::disconnect_edge(BlockBegin* from, BlockBegin* to) {
   548   // disconnect any edges between from and to
   553   // disconnect any edges between from and to