< prev index next >

src/hotspot/share/opto/loopopts.cpp

BarrierSetC2_enhancements

BarrierSetC2

5  * under the terms of the GNU General Public License version 2 only, as                                                              
6  * published by the Free Software Foundation.                                                                                        
7  *                                                                                                                                   
8  * This code is distributed in the hope that it will be useful, but WITHOUT                                                          
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or                                                             
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License                                                             
11  * version 2 for more details (a copy is included in the LICENSE file that                                                           
12  * accompanied this code).                                                                                                           
13  *                                                                                                                                   
14  * You should have received a copy of the GNU General Public License version                                                         
15  * 2 along with this work; if not, write to the Free Software Foundation,                                                            
16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.                                                                     
17  *                                                                                                                                   
18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA                                                           
19  * or visit www.oracle.com if you need additional information or have any                                                            
20  * questions.                                                                                                                        
21  *                                                                                                                                   
22  */                                                                                                                                  
23 
24 #include "precompiled.hpp"                                                                                                           
                                                                                                                                     
                                                                                                                                     
25 #include "memory/allocation.inline.hpp"                                                                                              
26 #include "memory/resourceArea.hpp"                                                                                                   
27 #include "opto/addnode.hpp"                                                                                                          
28 #include "opto/callnode.hpp"                                                                                                         
29 #include "opto/castnode.hpp"                                                                                                         
30 #include "opto/connode.hpp"                                                                                                          
31 #include "opto/castnode.hpp"                                                                                                         
32 #include "opto/divnode.hpp"                                                                                                          
33 #include "opto/loopnode.hpp"                                                                                                         
34 #include "opto/matcher.hpp"                                                                                                          
35 #include "opto/mulnode.hpp"                                                                                                          
36 #include "opto/movenode.hpp"                                                                                                         
37 #include "opto/opaquenode.hpp"                                                                                                       
38 #include "opto/rootnode.hpp"                                                                                                         
39 #include "opto/subnode.hpp"                                                                                                          
40 
41 //=============================================================================                                                      
42 //------------------------------split_thru_phi---------------------------------                                                      
43 // Split Node 'n' through merge point if there is enough win.                                                                        

5  * under the terms of the GNU General Public License version 2 only, as
6  * published by the Free Software Foundation.
7  *
8  * This code is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11  * version 2 for more details (a copy is included in the LICENSE file that
12  * accompanied this code).
13  *
14  * You should have received a copy of the GNU General Public License version
15  * 2 along with this work; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19  * or visit www.oracle.com if you need additional information or have any
20  * questions.
21  *
22  */
23 
24 #include "precompiled.hpp"
25 #include "gc/shared/barrierSet.hpp"
26 #include "gc/shared/c2/barrierSetC2.hpp"
27 #include "memory/allocation.inline.hpp"
28 #include "memory/resourceArea.hpp"
29 #include "opto/addnode.hpp"
30 #include "opto/callnode.hpp"
31 #include "opto/castnode.hpp"
32 #include "opto/connode.hpp"
33 #include "opto/castnode.hpp"
34 #include "opto/divnode.hpp"
35 #include "opto/loopnode.hpp"
36 #include "opto/matcher.hpp"
37 #include "opto/mulnode.hpp"
38 #include "opto/movenode.hpp"
39 #include "opto/opaquenode.hpp"
40 #include "opto/rootnode.hpp"
41 #include "opto/subnode.hpp"
42 
43 //=============================================================================
44 //------------------------------split_thru_phi---------------------------------
45 // Split Node 'n' through merge point if there is enough win.

1357             // to fold a StoreP and an AddP together (as part of an                                                                  
1358             // address expression) and the AddP and StoreP have                                                                      
1359             // different controls.                                                                                                   
1360             if (!x->is_Load() && !x->is_DecodeNarrowPtr()) _igvn._worklist.yank(x);                                                  
1361           }                                                                                                                          
1362           _igvn.remove_dead_node(n);                                                                                                 
1363         }                                                                                                                            
1364       }                                                                                                                              
1365     }                                                                                                                                
1366   }                                                                                                                                  
1367 
1368   try_move_store_after_loop(n);                                                                                                      
1369 
1370   // Check for Opaque2's who's loop has disappeared - who's input is in the                                                          
1371   // same loop nest as their output.  Remove 'em, they are no longer useful.                                                         
1372   if( n_op == Op_Opaque2 &&                                                                                                          
1373       n->in(1) != NULL &&                                                                                                            
1374       get_loop(get_ctrl(n)) == get_loop(get_ctrl(n->in(1))) ) {                                                                      
1375     _igvn.replace_node( n, n->in(1) );                                                                                               
1376   }                                                                                                                                  
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
1377 }                                                                                                                                    
1378 
1379 //------------------------------split_if_with_blocks---------------------------                                                      
1380 // Check for aggressive application of 'split-if' optimization,                                                                      
1381 // using basic block level info.                                                                                                     
1382 void PhaseIdealLoop::split_if_with_blocks( VectorSet &visited, Node_Stack &nstack ) {                                                
1383   Node *n = C->root();                                                                                                               
1384   visited.set(n->_idx); // first, mark node as visited                                                                               
1385   // Do pre-visit work for root                                                                                                      
1386   n = split_if_with_blocks_pre( n );                                                                                                 
1387   uint cnt = n->outcnt();                                                                                                            
1388   uint i   = 0;                                                                                                                      
1389   while (true) {                                                                                                                     
1390     // Visit all children                                                                                                            
1391     if (i < cnt) {                                                                                                                   
1392       Node* use = n->raw_out(i);                                                                                                     
1393       ++i;                                                                                                                           
1394       if (use->outcnt() != 0 && !visited.test_set(use->_idx)) {                                                                      
1395         // Now do pre-visit work for this use                                                                                        

1359             // to fold a StoreP and an AddP together (as part of an
1360             // address expression) and the AddP and StoreP have
1361             // different controls.
1362             if (!x->is_Load() && !x->is_DecodeNarrowPtr()) _igvn._worklist.yank(x);
1363           }
1364           _igvn.remove_dead_node(n);
1365         }
1366       }
1367     }
1368   }
1369 
1370   try_move_store_after_loop(n);
1371 
1372   // Check for Opaque2's who's loop has disappeared - who's input is in the
1373   // same loop nest as their output.  Remove 'em, they are no longer useful.
1374   if( n_op == Op_Opaque2 &&
1375       n->in(1) != NULL &&
1376       get_loop(get_ctrl(n)) == get_loop(get_ctrl(n->in(1))) ) {
1377     _igvn.replace_node( n, n->in(1) );
1378   }
1379 
1380   BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
1381   bs->loop_optimize_gc_barrier(this, n, true);
1382 }
1383 
1384 //------------------------------split_if_with_blocks---------------------------
1385 // Check for aggressive application of 'split-if' optimization,
1386 // using basic block level info.
1387 void PhaseIdealLoop::split_if_with_blocks( VectorSet &visited, Node_Stack &nstack ) {
1388   Node *n = C->root();
1389   visited.set(n->_idx); // first, mark node as visited
1390   // Do pre-visit work for root
1391   n = split_if_with_blocks_pre( n );
1392   uint cnt = n->outcnt();
1393   uint i   = 0;
1394   while (true) {
1395     // Visit all children
1396     if (i < cnt) {
1397       Node* use = n->raw_out(i);
1398       ++i;
1399       if (use->outcnt() != 0 && !visited.test_set(use->_idx)) {
1400         // Now do pre-visit work for this use
< prev index next >