1.1 --- a/src/share/vm/opto/phaseX.cpp Tue Mar 26 10:05:33 2013 +0100 1.2 +++ b/src/share/vm/opto/phaseX.cpp Tue Mar 26 12:55:26 2013 -0700 1.3 @@ -1166,31 +1166,30 @@ 1.4 if (progress_state == PROCESS_INPUTS) { 1.5 // After following inputs, continue to outputs 1.6 _stack.set_index(PROCESS_OUTPUTS); 1.7 - // Remove from iterative worklist 1.8 - _worklist.remove(dead); 1.9 if (!dead->is_Con()) { // Don't kill cons but uses 1.10 bool recurse = false; 1.11 // Remove from hash table 1.12 _table.hash_delete( dead ); 1.13 // Smash all inputs to 'dead', isolating him completely 1.14 - for( uint i = 0; i < dead->req(); i++ ) { 1.15 + for (uint i = 0; i < dead->req(); i++) { 1.16 Node *in = dead->in(i); 1.17 - if( in ) { // Points to something? 1.18 - dead->set_req(i,NULL); // Kill the edge 1.19 - if (in->outcnt() == 0 && in != C->top()) {// Made input go dead? 1.20 + if (in != NULL && in != C->top()) { // Points to something? 1.21 + int nrep = dead->replace_edge(in, NULL); // Kill edges 1.22 + assert((nrep > 0), "sanity"); 1.23 + if (in->outcnt() == 0) { // Made input go dead? 1.24 _stack.push(in, PROCESS_INPUTS); // Recursively remove 1.25 recurse = true; 1.26 } else if (in->outcnt() == 1 && 1.27 in->has_special_unique_user()) { 1.28 _worklist.push(in->unique_out()); 1.29 } else if (in->outcnt() <= 2 && dead->is_Phi()) { 1.30 - if( in->Opcode() == Op_Region ) 1.31 + if (in->Opcode() == Op_Region) { 1.32 _worklist.push(in); 1.33 - else if( in->is_Store() ) { 1.34 + } else if (in->is_Store()) { 1.35 DUIterator_Fast imax, i = in->fast_outs(imax); 1.36 _worklist.push(in->fast_out(i)); 1.37 i++; 1.38 - if(in->outcnt() == 2) { 1.39 + if (in->outcnt() == 2) { 1.40 _worklist.push(in->fast_out(i)); 1.41 i++; 1.42 } 1.43 @@ -1209,38 +1208,42 @@ 1.44 } 1.45 } 1.46 } 1.47 - } 1.48 - } 1.49 - C->record_dead_node(dead->_idx); 1.50 - if (dead->is_macro()) { 1.51 - C->remove_macro_node(dead); 1.52 - } 1.53 - if (dead->is_expensive()) { 1.54 - C->remove_expensive_node(dead); 1.55 - } 1.56 - 1.57 + } // if (in != NULL && in != C->top()) 1.58 + } // for (uint i = 0; i < dead->req(); i++) 1.59 if (recurse) { 1.60 continue; 1.61 } 1.62 - } 1.63 - // Constant node that has no out-edges and has only one in-edge from 1.64 - // root is usually dead. However, sometimes reshaping walk makes 1.65 - // it reachable by adding use edges. So, we will NOT count Con nodes 1.66 - // as dead to be conservative about the dead node count at any 1.67 - // given time. 1.68 - } 1.69 + } // if (!dead->is_Con()) 1.70 + } // if (progress_state == PROCESS_INPUTS) 1.71 1.72 // Aggressively kill globally dead uses 1.73 // (Rather than pushing all the outs at once, we push one at a time, 1.74 // plus the parent to resume later, because of the indefinite number 1.75 // of edge deletions per loop trip.) 1.76 if (dead->outcnt() > 0) { 1.77 - // Recursively remove 1.78 + // Recursively remove output edges 1.79 _stack.push(dead->raw_out(0), PROCESS_INPUTS); 1.80 } else { 1.81 + // Finished disconnecting all input and output edges. 1.82 _stack.pop(); 1.83 + // Remove dead node from iterative worklist 1.84 + _worklist.remove(dead); 1.85 + // Constant node that has no out-edges and has only one in-edge from 1.86 + // root is usually dead. However, sometimes reshaping walk makes 1.87 + // it reachable by adding use edges. So, we will NOT count Con nodes 1.88 + // as dead to be conservative about the dead node count at any 1.89 + // given time. 1.90 + if (!dead->is_Con()) { 1.91 + C->record_dead_node(dead->_idx); 1.92 + } 1.93 + if (dead->is_macro()) { 1.94 + C->remove_macro_node(dead); 1.95 + } 1.96 + if (dead->is_expensive()) { 1.97 + C->remove_expensive_node(dead); 1.98 + } 1.99 } 1.100 - } 1.101 + } // while (_stack.is_nonempty()) 1.102 } 1.103 1.104 //------------------------------subsume_node-----------------------------------