< prev index next >

src/hotspot/share/opto/loopopts.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -1193,15 +1193,15 @@
 
 //------------------------------split_if_with_blocks_post----------------------
 // Do the real work in a non-recursive function.  CFG hackery wants to be
 // in the post-order, so it can dirty the I-DOM info and not use the dirtied
 // info.
-void PhaseIdealLoop::split_if_with_blocks_post(Node *n) {
+void PhaseIdealLoop::split_if_with_blocks_post(Node *n, bool last_round) {
 
   // Cloning Cmp through Phi's involves the split-if transform.
   // FastLock is not used by an If
-  if (n->is_Cmp() && !n->is_FastLock()) {
+  if (n->is_Cmp() && !n->is_FastLock() && !last_round) {
     Node *n_ctrl = get_ctrl(n);
     // Determine if the Node has inputs from some local Phi.
     // Returns the block to clone thru.
     Node *n_blk = has_local_phi_input(n);
     if (n_blk != n_ctrl) {

@@ -1449,16 +1449,22 @@
   if( n_op == Op_Opaque2 &&
       n->in(1) != NULL &&
       get_loop(get_ctrl(n)) == get_loop(get_ctrl(n->in(1))) ) {
     _igvn.replace_node( n, n->in(1) );
   }
+
+#if INCLUDE_ZGC
+  if (UseZGC) {
+    ZBarrierSetC2::loop_optimize_gc_barrier(this, n, last_round);
+  }
+#endif
 }
 
 //------------------------------split_if_with_blocks---------------------------
 // Check for aggressive application of 'split-if' optimization,
 // using basic block level info.
-void PhaseIdealLoop::split_if_with_blocks(VectorSet &visited, Node_Stack &nstack) {
+void PhaseIdealLoop::split_if_with_blocks(VectorSet &visited, Node_Stack &nstack, bool last_round) {
   Node* root = C->root();
   visited.set(root->_idx); // first, mark root as visited
   // Do pre-visit work for root
   Node* n   = split_if_with_blocks_pre(root);
   uint  cnt = n->outcnt();

@@ -1480,11 +1486,11 @@
     }
     else {
       // All of n's children have been processed, complete post-processing.
       if (cnt != 0 && !n->is_Con()) {
         assert(has_node(n), "no dead nodes");
-        split_if_with_blocks_post(n);
+        split_if_with_blocks_post(n, last_round);
       }
       if (must_throttle_split_if()) {
         nstack.clear();
       }
       if (nstack.is_empty()) {

@@ -3021,20 +3027,20 @@
 //
 bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) {
 
   assert(!loop->_head->is_CountedLoop(), "Non-counted loop only");
   if (!loop->_head->is_Loop()) {
-    return false;
-  }
-  LoopNode *head = loop->_head->as_Loop();
+    return false;  }
+
+  LoopNode *head  = loop->_head->as_Loop();
 
   if (head->is_partial_peel_loop() || head->partial_peel_has_failed()) {
     return false;
   }
 
   // Check for complex exit control
-  for (uint ii = 0; ii < loop->_body.size(); ii++) {
+  for(uint ii = 0; ii < loop->_body.size(); ii++ ) {
     Node *n = loop->_body.at(ii);
     int opc = n->Opcode();
     if (n->is_Call()        ||
         opc == Op_Catch     ||
         opc == Op_CatchProj ||

@@ -3057,16 +3063,16 @@
   // which is executed on every path thru loop.
   IfNode *peel_if = NULL;
   IfNode *peel_if_cmpu = NULL;
 
   Node *iff = loop->tail();
-  while (iff != head) {
-    if (iff->is_If()) {
+  while( iff != head ) {
+    if( iff->is_If() ) {
       Node *ctrl = get_ctrl(iff->in(1));
       if (ctrl->is_top()) return false; // Dead test on live IF.
       // If loop-varying exit-test, check for induction variable
-      if (loop->is_member(get_loop(ctrl)) &&
+      if( loop->is_member(get_loop(ctrl)) &&
           loop->is_loop_exit(iff) &&
           is_possible_iv_test(iff)) {
         Node* cmp = iff->in(1)->in(1);
         if (cmp->Opcode() == Op_CmpI) {
           peel_if = iff->as_If();

@@ -3076,11 +3082,10 @@
         }
       }
     }
     iff = idom(iff);
   }
-
   // Prefer signed compare over unsigned compare.
   IfNode* new_peel_if = NULL;
   if (peel_if == NULL) {
     if (!PartialPeelAtUnsignedTests || peel_if_cmpu == NULL) {
       return false;   // No peel point found

@@ -3124,11 +3129,11 @@
   VectorSet not_peel(area);
   Node_List peel_list(area);
   Node_List worklist(area);
   Node_List sink_list(area);
 
-  if (!may_require_nodes(loop->est_loop_clone_sz(2))) {
+  if (!may_require_nodes(est_loop_clone_sz(2, loop->_body.size()))) {
     return false;
   }
 
   // Set of cfg nodes to peel are those that are executable from
   // the head through last_peel.
< prev index next >