1.1 --- a/src/share/vm/c1/c1_Instruction.cpp Wed Aug 31 16:46:11 2011 -0700 1.2 +++ b/src/share/vm/c1/c1_Instruction.cpp Thu Sep 01 01:31:25 2011 -0700 1.3 @@ -514,28 +514,17 @@ 1.4 1.5 void BlockBegin::set_end(BlockEnd* end) { 1.6 assert(end != NULL, "should not reset block end to NULL"); 1.7 - BlockEnd* old_end = _end; 1.8 - if (end == old_end) { 1.9 + if (end == _end) { 1.10 return; 1.11 } 1.12 - // Must make the predecessors/successors match up with the 1.13 - // BlockEnd's notion. 1.14 - int i, n; 1.15 - if (old_end != NULL) { 1.16 - // disconnect from the old end 1.17 - old_end->set_begin(NULL); 1.18 + clear_end(); 1.19 1.20 - // disconnect this block from it's current successors 1.21 - for (i = 0; i < _successors.length(); i++) { 1.22 - _successors.at(i)->remove_predecessor(this); 1.23 - } 1.24 - } 1.25 + // Set the new end 1.26 _end = end; 1.27 1.28 _successors.clear(); 1.29 // Now reset successors list based on BlockEnd 1.30 - n = end->number_of_sux(); 1.31 - for (i = 0; i < n; i++) { 1.32 + for (int i = 0; i < end->number_of_sux(); i++) { 1.33 BlockBegin* sux = end->sux_at(i); 1.34 _successors.append(sux); 1.35 sux->_predecessors.append(this); 1.36 @@ -544,6 +533,22 @@ 1.37 } 1.38 1.39 1.40 +void BlockBegin::clear_end() { 1.41 + // Must make the predecessors/successors match up with the 1.42 + // BlockEnd's notion. 1.43 + if (_end != NULL) { 1.44 + // disconnect from the old end 1.45 + _end->set_begin(NULL); 1.46 + 1.47 + // disconnect this block from it's current successors 1.48 + for (int i = 0; i < _successors.length(); i++) { 1.49 + _successors.at(i)->remove_predecessor(this); 1.50 + } 1.51 + _end = NULL; 1.52 + } 1.53 +} 1.54 + 1.55 + 1.56 void BlockBegin::disconnect_edge(BlockBegin* from, BlockBegin* to) { 1.57 // disconnect any edges between from and to 1.58 #ifndef PRODUCT