< prev index next >

src/hotspot/share/opto/replacednodes.cpp

Print this page
*** 143,10 ***
--- 143,11 ---
        }
        work.clear();
        enqueue_use(initial, use, work);
        bool replace = true;
        // Check that this use is dominated by ctl. Go ahead with the replacement if it is.
+       DEBUG_ONLY(uint loop_count = 0);
        while (work.size() != 0 && replace) {
          Node* n = work.pop();
          if (use->outcnt() == 0) {
            continue;
          }

*** 172,10 ***
--- 173,11 ---
          } else {
            for (DUIterator k = n->outs(); n->has_out(k); k++) {
              enqueue_use(n, n->out(k), work);
            }
          }
+         assert(loop_count++ < K, "infinite loop in ReplacedNodes::apply");
        }
        if (replace) {
          bool is_in_table = C->initial_gvn()->hash_delete(use);
          int replaced = use->replace_edge(initial, improved);
          if (is_in_table) {
< prev index next >