< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/util/GraphUtil.java

Print this page




 225                 }
 226             }
 227         }
 228     }
 229 
 230     @SuppressWarnings("try")
 231     public static void killCFG(FixedNode node) {
 232         DebugContext debug = node.getDebug();
 233         try (DebugContext.Scope scope = debug.scope("KillCFG", node)) {
 234             EconomicSet<Node> unusedNodes = null;
 235             EconomicSet<Node> unsafeNodes = null;
 236             Graph.NodeEventScope nodeEventScope = null;
 237             OptionValues options = node.getOptions();
 238             if (Graph.Options.VerifyGraalGraphEdges.getValue(options)) {
 239                 unsafeNodes = collectUnsafeNodes(node.graph());
 240             }
 241             if (GraphUtil.Options.VerifyKillCFGUnusedNodes.getValue(options)) {
 242                 EconomicSet<Node> collectedUnusedNodes = unusedNodes = EconomicSet.create(Equivalence.IDENTITY);
 243                 nodeEventScope = node.graph().trackNodeEvents(new Graph.NodeEventListener() {
 244                     @Override
 245                     public void event(Graph.NodeEvent e, Node n) {
 246                         if (e == Graph.NodeEvent.ZERO_USAGES && isFloatingNode(n) && !(n instanceof GuardNode)) {
 247                             collectedUnusedNodes.add(n);
 248                         }
 249                     }
 250                 });
 251             }
 252             debug.dump(DebugContext.VERY_DETAILED_LEVEL, node.graph(), "Before killCFG %s", node);
 253             killCFGInner(node);
 254             debug.dump(DebugContext.VERY_DETAILED_LEVEL, node.graph(), "After killCFG %s", node);
 255             if (Graph.Options.VerifyGraalGraphEdges.getValue(options)) {
 256                 EconomicSet<Node> newUnsafeNodes = collectUnsafeNodes(node.graph());
 257                 newUnsafeNodes.removeAll(unsafeNodes);
 258                 assert newUnsafeNodes.isEmpty() : "New unsafe nodes: " + newUnsafeNodes;
 259             }
 260             if (GraphUtil.Options.VerifyKillCFGUnusedNodes.getValue(options)) {
 261                 nodeEventScope.close();
 262                 Iterator<Node> iterator = unusedNodes.iterator();
 263                 while (iterator.hasNext()) {
 264                     Node curNode = iterator.next();
 265                     if (curNode.isDeleted()) {




 225                 }
 226             }
 227         }
 228     }
 229 
 230     @SuppressWarnings("try")
 231     public static void killCFG(FixedNode node) {
 232         DebugContext debug = node.getDebug();
 233         try (DebugContext.Scope scope = debug.scope("KillCFG", node)) {
 234             EconomicSet<Node> unusedNodes = null;
 235             EconomicSet<Node> unsafeNodes = null;
 236             Graph.NodeEventScope nodeEventScope = null;
 237             OptionValues options = node.getOptions();
 238             if (Graph.Options.VerifyGraalGraphEdges.getValue(options)) {
 239                 unsafeNodes = collectUnsafeNodes(node.graph());
 240             }
 241             if (GraphUtil.Options.VerifyKillCFGUnusedNodes.getValue(options)) {
 242                 EconomicSet<Node> collectedUnusedNodes = unusedNodes = EconomicSet.create(Equivalence.IDENTITY);
 243                 nodeEventScope = node.graph().trackNodeEvents(new Graph.NodeEventListener() {
 244                     @Override
 245                     public void changed(Graph.NodeEvent e, Node n) {
 246                         if (e == Graph.NodeEvent.ZERO_USAGES && isFloatingNode(n) && !(n instanceof GuardNode)) {
 247                             collectedUnusedNodes.add(n);
 248                         }
 249                     }
 250                 });
 251             }
 252             debug.dump(DebugContext.VERY_DETAILED_LEVEL, node.graph(), "Before killCFG %s", node);
 253             killCFGInner(node);
 254             debug.dump(DebugContext.VERY_DETAILED_LEVEL, node.graph(), "After killCFG %s", node);
 255             if (Graph.Options.VerifyGraalGraphEdges.getValue(options)) {
 256                 EconomicSet<Node> newUnsafeNodes = collectUnsafeNodes(node.graph());
 257                 newUnsafeNodes.removeAll(unsafeNodes);
 258                 assert newUnsafeNodes.isEmpty() : "New unsafe nodes: " + newUnsafeNodes;
 259             }
 260             if (GraphUtil.Options.VerifyKillCFGUnusedNodes.getValue(options)) {
 261                 nodeEventScope.close();
 262                 Iterator<Node> iterator = unusedNodes.iterator();
 263                 while (iterator.hasNext()) {
 264                     Node curNode = iterator.next();
 265                     if (curNode.isDeleted()) {


< prev index next >