--- old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/GraphChangeMonitoringPhase.java 2017-03-20 17:37:48.000000000 -0700 +++ new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/phases/GraphChangeMonitoringPhase.java 2017-03-20 17:37:48.000000000 -0700 @@ -22,9 +22,6 @@ */ package org.graalvm.compiler.core.phases; -import java.util.Set; -import java.util.stream.Collectors; - import org.graalvm.compiler.debug.Debug; import org.graalvm.compiler.debug.Debug.Scope; import org.graalvm.compiler.graph.Graph.NodeEvent; @@ -36,6 +33,8 @@ import org.graalvm.compiler.phases.PhaseSuite; import org.graalvm.compiler.phases.common.util.HashSetNodeEventListener; import org.graalvm.compiler.phases.tiers.PhaseContext; +import org.graalvm.util.Equivalence; +import org.graalvm.util.EconomicSet; /** * A utility phase for detecting when a phase would change the graph and reporting extra information @@ -77,11 +76,17 @@ Debug.handle(t); } } - /* - * Ignore LogicConstantNode since those are sometimes created and deleted as part of running - * a phase. - */ - if (listener.getNodes().stream().filter(e -> !(e instanceof LogicConstantNode)).findFirst().isPresent()) { + + EconomicSet filteredNodes = EconomicSet.create(Equivalence.IDENTITY); + for (Node n : listener.getNodes()) { + if (n instanceof LogicConstantNode) { + // Ignore LogicConstantNode since those are sometimes created and deleted as part of + // running a phase. + } else { + filteredNodes.add(n); + } + } + if (!filteredNodes.isEmpty()) { /* rerun it on the real graph in a new Debug scope so Dump and Log can find it. */ listener = new HashSetNodeEventListener(); try (NodeEventScope s = graph.trackNodeEvents(listener)) { @@ -90,11 +95,10 @@ Debug.dump(Debug.BASIC_LOG_LEVEL, graph, "*** Before phase %s", getName()); } super.run(graph, context); - Set collect = listener.getNodes().stream().filter(e -> !e.isAlive()).filter(e -> !(e instanceof LogicConstantNode)).collect(Collectors.toSet()); if (Debug.isDumpEnabled(Debug.BASIC_LOG_LEVEL)) { - Debug.dump(Debug.BASIC_LOG_LEVEL, graph, "*** After phase %s %s", getName(), collect); + Debug.dump(Debug.BASIC_LOG_LEVEL, graph, "*** After phase %s %s", getName(), filteredNodes); } - Debug.log("*** %s %s %s\n", message, graph, collect); + Debug.log("*** %s %s %s\n", message, graph, filteredNodes); } } } else {