changeset 4413:c8de52cc672a

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Mon, 30 Jan 2012 15:16:33 +0100
parents ccbdd90bf356 (diff) 9f8e4aeec1a9 (current diff)
children bae1b1f29984
files graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiResult.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalContext.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalMetrics.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalTimers.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinter.java graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinterObserver.java graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/BoxingEliminationTest.java graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/DegeneratedLoopsTest.java graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/IfCanonicalizerTest.java mx.bat src/share/tools/IdealGraphVisualizer/ControlFlow/build.xml src/share/tools/IdealGraphVisualizer/ControlFlow/manifest.mf src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/build-impl.xml src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/genfiles.properties src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/platform.properties src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.properties src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.xml src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/suite.properties src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockWidget.java src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/Bundle.properties src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowAction.java src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.form src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentSettings.xml src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentWstcref.xml src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/DoubleClickSelectAction.java src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/layer.xml src/share/tools/IdealGraphVisualizer/Coordinator/src/META-INF/services/com.sun.hotspot.igv.data.services.GroupOrganizer src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphCountGroupOrganizer.java src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardGroupOrganizer.java src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/StructuredViewAction.java src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/services/GroupOrganizer.java src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/services/GroupReceiver.java src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/NullScriptEngine.java src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ScriptEngineAbstraction.java src/share/tools/IdealGraphVisualizer/Graal/src/META-INF/services/com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/GraalGraphToTextConverter.java src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Block.java src/share/tools/IdealGraphVisualizer/GraphTextEditor/build.xml src/share/tools/IdealGraphVisualizer/GraphTextEditor/manifest.mf src/share/tools/IdealGraphVisualizer/GraphTextEditor/nbproject/build-impl.xml src/share/tools/IdealGraphVisualizer/GraphTextEditor/nbproject/genfiles.properties src/share/tools/IdealGraphVisualizer/GraphTextEditor/nbproject/project.properties src/share/tools/IdealGraphVisualizer/GraphTextEditor/nbproject/project.xml src/share/tools/IdealGraphVisualizer/GraphTextEditor/nbproject/suite.properties src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/Bundle.properties src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextAction.java src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextTopComponent.form src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextTopComponent.java src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextTopComponentSettings.xml src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextTopComponentWstcref.xml src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/layer.xml src/share/tools/IdealGraphVisualizer/GraphToText/build.xml src/share/tools/IdealGraphVisualizer/GraphToText/manifest.mf src/share/tools/IdealGraphVisualizer/GraphToText/nbproject/build-impl.xml src/share/tools/IdealGraphVisualizer/GraphToText/nbproject/genfiles.properties src/share/tools/IdealGraphVisualizer/GraphToText/nbproject/platform.properties src/share/tools/IdealGraphVisualizer/GraphToText/nbproject/project.properties src/share/tools/IdealGraphVisualizer/GraphToText/nbproject/project.xml src/share/tools/IdealGraphVisualizer/GraphToText/nbproject/suite.properties src/share/tools/IdealGraphVisualizer/GraphToText/src/com/sun/hotspot/igv/graphtotext/BFSGraphToTextConverter.java src/share/tools/IdealGraphVisualizer/GraphToText/src/com/sun/hotspot/igv/graphtotext/Bundle.properties src/share/tools/IdealGraphVisualizer/GraphToText/src/com/sun/hotspot/igv/graphtotext/services/AbstractGraphToTextVisitor.java src/share/tools/IdealGraphVisualizer/GraphToText/src/com/sun/hotspot/igv/graphtotext/services/GraphToTextConverter.java src/share/tools/IdealGraphVisualizer/GraphToText/src/com/sun/hotspot/igv/graphtotext/services/GraphToTextVisitor.java src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterEdge.java src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterIngoingConnection.java src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterInputSlotNode.java src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterNode.java src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterOutgoingConnection.java src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterOutputSlotNode.java src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/InterClusterConnection.java src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/OldHierarchicalLayoutManager.java src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/build.xml src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/manifest.mf src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/build-impl.xml src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/genfiles.properties src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/project.properties src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/project.xml src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/suite.properties src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/src/META-INF/services/com.sun.hotspot.igv.filter.ScriptEngineAbstraction src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/src/com/sun/hotspot/igv/java6scriptingproxy/Bundle.properties src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/src/com/sun/hotspot/igv/java6scriptingproxy/JavaSE6ScriptEngine.java src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/Cluster.java src/share/tools/IdealGraphVisualizer/NetworkConnection/src/META-INF/services/com.sun.hotspot.igv.data.services.GroupReceiver src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/build.xml src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/manifest.mf src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/build-impl.xml src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/genfiles.properties src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/project.properties src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/project.xml src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/suite.properties src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/src/META-INF/services/com.sun.hotspot.igv.filter.ScriptEngineAbstraction src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/src/com/sun/hotspot/igv/rhino/Bundle.properties src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/src/com/sun/hotspot/igv/rhino/RhinoScriptEngine.java src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/src/com/sun/hotspot/igv/rhino/layer.xml src/share/tools/IdealGraphVisualizer/ServerCompiler/src/META-INF/services/com.sun.hotspot.igv.data.services.GroupOrganizer src/share/tools/IdealGraphVisualizer/ServerCompiler/src/META-INF/services/com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/JavaGroupOrganizer.java src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerGraphToTextConverter.java src/share/tools/IdealGraphVisualizer/StructuredText/build.xml src/share/tools/IdealGraphVisualizer/StructuredText/manifest.mf src/share/tools/IdealGraphVisualizer/StructuredText/nbproject/build-impl.xml src/share/tools/IdealGraphVisualizer/StructuredText/nbproject/genfiles.properties src/share/tools/IdealGraphVisualizer/StructuredText/nbproject/platform.properties src/share/tools/IdealGraphVisualizer/StructuredText/nbproject/project.properties src/share/tools/IdealGraphVisualizer/StructuredText/nbproject/project.xml src/share/tools/IdealGraphVisualizer/StructuredText/nbproject/suite.properties src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/Bundle.properties src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/Element.java src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/MultiElement.java src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/Range.java src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/SimpleElement.java src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/StructuredText.java src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/ToolTipProvider.java src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/services/ElementVisitor.java src/share/tools/IdealGraphVisualizer/TextEditor/build.xml src/share/tools/IdealGraphVisualizer/TextEditor/manifest.mf src/share/tools/IdealGraphVisualizer/TextEditor/nbproject/build-impl.xml src/share/tools/IdealGraphVisualizer/TextEditor/nbproject/genfiles.properties src/share/tools/IdealGraphVisualizer/TextEditor/nbproject/platform.properties src/share/tools/IdealGraphVisualizer/TextEditor/nbproject/project.properties src/share/tools/IdealGraphVisualizer/TextEditor/nbproject/project.xml src/share/tools/IdealGraphVisualizer/TextEditor/nbproject/suite.properties src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/Bundle.properties src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/SyntaxLayer.java src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/TextEditor.java src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/TextEditorKit.java src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/TextFoldManager.java src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/TextFoldManagerFactory.java src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/TextHighlightsLayerFactory.java src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/TextSideBarFactory.java src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/layer.xml src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/org-netbeans-modules-editor-preferences.xml src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/EnableBlockLayoutAction.java src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/BlockWidget.java src/share/vm/graal/graal_paths.hpp
diffstat 38 files changed, 691 insertions(+), 468 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Mon Jan 30 15:16:33 2012 +0100
@@ -392,7 +392,7 @@
         }
         if (block.numberOfSux() >= 1 && !block.endsWithJump()) {
             NodeSuccessorsIterable successors = block.lastNode().successors();
-            assert successors.explicitCount() >= 1 : "should have at least one successor : " + block.lastNode();
+            assert successors.count() >= 1 : "should have at least one successor : " + block.lastNode();
 
             emitJump(getLIRBlock((FixedNode) successors.first()), null);
         }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/BoxingEliminationPhase.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/BoxingEliminationPhase.java	Mon Jan 30 15:16:33 2012 +0100
@@ -22,11 +22,14 @@
  */
 package com.oracle.max.graal.compiler.phases;
 
+import static com.oracle.max.graal.graph.iterators.NodePredicates.*;
+
 import java.util.*;
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
 import com.oracle.max.graal.graph.*;
+import com.oracle.max.graal.graph.iterators.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.PhiNode.*;
 import com.oracle.max.graal.nodes.extended.*;
@@ -106,11 +109,9 @@
 
         virtualizeUsages(boxNode, boxNode.source(), boxNode.exactType());
 
-        for (Node n : boxNode.usages()) {
-            if (!(n instanceof FrameState) && !(n instanceof VirtualObjectFieldNode)) {
-                // Elimination failed, because boxing object escapes.
-                return;
-            }
+        if (boxNode.usages().filter(isNotA(FrameState.class).nor(VirtualObjectFieldNode.class)).isNotEmpty()) {
+            // Elimination failed, because boxing object escapes.
+            return;
         }
 
         // TODO(ls) this seems weird: there might still be references to boxNode, yet it is deleted...
@@ -125,7 +126,7 @@
     private static void virtualizeUsages(ValueNode boxNode, ValueNode replacement, RiResolvedType exactType) {
         ValueNode virtualValueNode = null;
         VirtualObjectNode virtualObjectNode = null;
-        for (Node n : boxNode.usages().filter(FrameState.class).or(VirtualObjectFieldNode.class).snapshot()) {
+        for (Node n : boxNode.usages().filter(NodePredicates.isA(FrameState.class).or(VirtualObjectFieldNode.class)).snapshot()) {
             if (virtualValueNode == null) {
                 virtualObjectNode = n.graph().unique(new BoxedVirtualObjectNode(exactType, replacement));
             }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java	Mon Jan 30 15:16:33 2012 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.max.graal.compiler.phases;
 
+import static com.oracle.max.graal.graph.iterators.NodePredicates.*;
+
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
 import com.oracle.max.graal.debug.*;
@@ -232,8 +234,8 @@
             if (node instanceof PhiNode) {
                 node.replaceFirstInput(input, null);
             } else {
-                for (Node usage : node.usages().snapshot()) {
-                    if ((usage instanceof FloatingNode || usage instanceof CallTargetNode) && !usage.isDeleted()) {
+                for (Node usage : node.usages().filter(isA(FloatingNode.class).or(CallTargetNode.class)).snapshot()) {
+                    if (!usage.isDeleted()) {
                         killNonCFG(usage, node);
                     }
                 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java	Mon Jan 30 15:16:33 2012 +0100
@@ -306,7 +306,7 @@
     private static Node escape(EscapeRecord record, Node usage) {
         final Node node = record.node;
         if (usage instanceof FrameState) {
-            assert ((FrameState) usage).inputs().contains(node);
+            assert usage.inputs().contains(node);
             return null;
         } else {
             if (usage instanceof FixedNode) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Mon Jan 30 15:16:33 2012 +0100
@@ -125,11 +125,8 @@
                     Invoke invoke = (Invoke) node;
                     scanInvoke(invoke, level);
                 }
-                for (Node usage : node.usages().snapshot()) {
-                    if (usage instanceof Invoke) {
-                        Invoke invoke = (Invoke) usage;
-                        scanInvoke(invoke, level);
-                    }
+                for (Node usage : node.usages().filterInterface(Invoke.class).snapshot()) {
+                    scanInvoke((Invoke) usage, level);
                 }
             }
         }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/PhiStampPhase.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/PhiStampPhase.java	Mon Jan 30 15:16:33 2012 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.max.graal.compiler.phases;
 
-import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 
 public class PhiStampPhase extends Phase {
@@ -45,22 +44,16 @@
 
     private void iterativeInferPhi(PhiNode phi) {
         if (phi.inferStamp()) {
-            for (Node n : phi.usages()) {
-                if (n instanceof PhiNode) {
-                    PhiNode phiUsage = (PhiNode) n;
-                    iterativeInferPhi(phiUsage);
-                }
+            for (PhiNode phiUsage : phi.usages().filter(PhiNode.class)) {
+                iterativeInferPhi(phiUsage);
             }
         }
     }
 
     private void inferPhi(PhiNode phi) {
-        for (ValueNode v : phi.values()) {
-            if (v instanceof PhiNode) {
-                PhiNode phiInput = (PhiNode) v;
-                if (!phiInput.isLoopPhi()) {
-                    inferPhi(phiInput);
-                }
+        for (PhiNode phiInput : phi.values().filter(PhiNode.class)) {
+            if (!phiInput.isLoopPhi()) {
+                inferPhi(phiInput);
             }
         }
         phi.inferStamp();
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/SafepointPollingEliminationPhase.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/SafepointPollingEliminationPhase.java	Mon Jan 30 15:16:33 2012 +0100
@@ -22,9 +22,9 @@
  */
 package com.oracle.max.graal.compiler.phases;
 
-import com.oracle.max.graal.compiler.util.*;
 import com.oracle.max.graal.graph.iterators.*;
 import com.oracle.max.graal.nodes.*;
+import com.oracle.max.graal.util.*;
 
 public class SafepointPollingEliminationPhase extends Phase {
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/SnippetIntrinsificationPhase.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/SnippetIntrinsificationPhase.java	Mon Jan 30 15:16:33 2012 +0100
@@ -169,36 +169,33 @@
     public void cleanUpReturnCheckCast(Node newInstance) {
         if (newInstance instanceof ValueNode && ((ValueNode) newInstance).kind() != CiKind.Object) {
             StructuredGraph graph = (StructuredGraph) newInstance.graph();
-            for (Node usage : newInstance.usages().snapshot()) {
-                if (usage instanceof CheckCastNode) {
-                    CheckCastNode checkCastNode = (CheckCastNode) usage;
-                    for (Node checkCastUsage : checkCastNode.usages().snapshot()) {
-                        if (checkCastUsage instanceof ValueAnchorNode) {
-                            ValueAnchorNode valueAnchorNode = (ValueAnchorNode) checkCastUsage;
-                            graph.removeFixed(valueAnchorNode);
-                        } else if (checkCastUsage instanceof MethodCallTargetNode) {
-                            MethodCallTargetNode checkCastCallTarget = (MethodCallTargetNode) checkCastUsage;
-                            assert pool.isUnboxingMethod(checkCastCallTarget.targetMethod());
-                            Invoke invokeNode = checkCastCallTarget.invoke();
-                            invokeNode.node().replaceAtUsages(newInstance);
-                            if (invokeNode instanceof InvokeWithExceptionNode) {
-                                // Destroy exception edge & clear stateAfter.
-                                InvokeWithExceptionNode invokeWithExceptionNode = (InvokeWithExceptionNode) invokeNode;
+            for (CheckCastNode checkCastNode : newInstance.usages().filter(CheckCastNode.class).snapshot()) {
+                for (Node checkCastUsage : checkCastNode.usages().snapshot()) {
+                    if (checkCastUsage instanceof ValueAnchorNode) {
+                        ValueAnchorNode valueAnchorNode = (ValueAnchorNode) checkCastUsage;
+                        graph.removeFixed(valueAnchorNode);
+                    } else if (checkCastUsage instanceof MethodCallTargetNode) {
+                        MethodCallTargetNode checkCastCallTarget = (MethodCallTargetNode) checkCastUsage;
+                        assert pool.isUnboxingMethod(checkCastCallTarget.targetMethod());
+                        Invoke invokeNode = checkCastCallTarget.invoke();
+                        invokeNode.node().replaceAtUsages(newInstance);
+                        if (invokeNode instanceof InvokeWithExceptionNode) {
+                            // Destroy exception edge & clear stateAfter.
+                            InvokeWithExceptionNode invokeWithExceptionNode = (InvokeWithExceptionNode) invokeNode;
 
-                                invokeWithExceptionNode.killExceptionEdge();
-                                graph.removeSplit(invokeWithExceptionNode, InvokeWithExceptionNode.NORMAL_EDGE);
-                            } else {
-                                graph.removeFixed((InvokeNode) invokeNode);
-                            }
-                            checkCastCallTarget.safeDelete();
-                        } else if (checkCastUsage instanceof FrameState) {
-                            checkCastUsage.replaceFirstInput(checkCastNode, null);
+                            invokeWithExceptionNode.killExceptionEdge();
+                            graph.removeSplit(invokeWithExceptionNode, InvokeWithExceptionNode.NORMAL_EDGE);
                         } else {
-                            assert false : "unexpected checkcast usage: " + checkCastUsage;
+                            graph.removeFixed((InvokeNode) invokeNode);
                         }
+                        checkCastCallTarget.safeDelete();
+                    } else if (checkCastUsage instanceof FrameState) {
+                        checkCastUsage.replaceFirstInput(checkCastNode, null);
+                    } else {
+                        assert false : "unexpected checkcast usage: " + checkCastUsage;
                     }
-                    checkCastNode.safeDelete();
                 }
+                checkCastNode.safeDelete();
             }
         }
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java	Mon Jan 30 15:16:33 2012 +0100
@@ -179,10 +179,8 @@
         }
 
         if (n instanceof MergeNode) {
-            for (Node usage : n.usages()) {
-                if (usage instanceof PhiNode) {
-                    nodeToBlock.set(usage, b);
-                }
+            for (PhiNode phi : ((MergeNode) n).phis()) {
+                nodeToBlock.set(phi, b);
             }
         }
         if (n instanceof EndNode) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java	Mon Jan 30 15:16:33 2012 +0100
@@ -371,7 +371,7 @@
             InvokeWithExceptionNode invokeWithException = ((InvokeWithExceptionNode) invoke);
             if (unwindNode != null) {
                 assert unwindNode.predecessor() != null;
-                assert invokeWithException.exceptionEdge().successors().explicitCount() == 1;
+                assert invokeWithException.exceptionEdge().successors().count() == 1;
                 ExceptionObjectNode obj = (ExceptionObjectNode) invokeWithException.exceptionEdge().next();
                 stateAtExceptionEdge = obj.stateAfter();
                 UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/NodeIterators.java	Sun Jan 29 11:40:04 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2011, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.graal.compiler.util;
-
-import java.util.*;
-
-import com.oracle.max.graal.graph.iterators.*;
-import com.oracle.max.graal.nodes.*;
-import com.oracle.max.graal.util.*;
-
-public class NodeIterators {
-
-    public static NodeIterable<FixedNode> dominators(final FixedNode n) {
-        return new NodeIterable<FixedNode>() {
-            @Override
-            public Iterator<FixedNode> iterator() {
-                return new NodeIterator<FixedNode>(until){
-                    FixedNode p = n;
-                    @Override
-                    protected void forward() {
-                        if (current == null) {
-                            if (p instanceof MergeNode) {
-                                current = new ComputeImmediateDominator((MergeNode) p).compute();
-                            } else {
-                                current = (FixedNode) p.predecessor();
-                            }
-                            p = current;
-                        }
-                    }
-                };
-            }
-        };
-    }
-}
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java	Mon Jan 30 15:16:33 2012 +0100
@@ -265,9 +265,9 @@
      * Returns an {@link Iterable} providing all nodes added since the last {@link Graph#mark() mark}.
      * @return an {@link Iterable} providing the new nodes
      */
-    public Iterable<Node> getNewNodes() {
+    public NodeIterable<Node> getNewNodes() {
         final int index = this.mark;
-        return new Iterable<Node>() {
+        return new NodeIterable<Node>() {
             @Override
             public Iterator<Node> iterator() {
                 return new NodeIterator(index);
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeInputsIterable.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeInputsIterable.java	Mon Jan 30 15:16:33 2012 +0100
@@ -26,9 +26,6 @@
 import com.oracle.max.graal.graph.iterators.*;
 
 public abstract class NodeInputsIterable extends NodeIterable<Node> {
-
-    public abstract boolean contains(Node node);
-
     @Override
     public abstract NodeClassIterator iterator();
 }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeList.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeList.java	Mon Jan 30 15:16:33 2012 +0100
@@ -27,7 +27,9 @@
 import java.util.List;
 import java.util.ListIterator;
 
-public abstract class NodeList<T extends Node> implements Iterable<T>, List<T> {
+import com.oracle.max.graal.graph.iterators.*;
+
+public abstract class NodeList<T extends Node> extends NodeIterable<T> implements List<T> {
 
     protected static final Node[] EMPTY_NODE_ARRAY = new Node[0];
 
@@ -74,6 +76,16 @@
         return size == 0;
     }
 
+    @Override
+    public boolean isNotEmpty() {
+        return size > 0;
+    }
+
+    @Override
+    public int count() {
+        return size;
+    }
+
     protected final void incModCount() {
         modCount++;
     }
@@ -214,6 +226,7 @@
         };
     }
 
+    @Override
     public boolean contains(T other) {
         for (int i = 0; i < size; i++) {
             if (nodes[i] == other) {
@@ -223,33 +236,10 @@
         return false;
     }
 
-    public Iterable<T> snapshot() {
-        return new Iterable<T>() {
-
-            @Override
-            public Iterator<T> iterator() {
-                return new Iterator<T>() {
-                    private Node[] nodesCopy = Arrays.copyOf(NodeList.this.nodes, NodeList.this.size);
-                    private int index = 0;
-
-                    @Override
-                    public boolean hasNext() {
-                        return index < nodesCopy.length;
-                    }
-
-                    @SuppressWarnings("unchecked")
-                    @Override
-                    public T next() {
-                        return (T) nodesCopy[index++];
-                    }
-
-                    @Override
-                    public void remove() {
-                        throw new UnsupportedOperationException();
-                    }
-                };
-            }
-        };
+    @SuppressWarnings("unchecked")
+    @Override
+    public List<T> snapshot() {
+        return (List<T>) Arrays.asList(Arrays.copyOf(this.nodes, this.size));
     }
 
     @SuppressWarnings("unchecked")
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeSuccessorsIterable.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeSuccessorsIterable.java	Mon Jan 30 15:16:33 2012 +0100
@@ -26,17 +26,6 @@
 import com.oracle.max.graal.graph.iterators.*;
 
 public abstract class NodeSuccessorsIterable extends NodeIterable<Node> {
-
-    public int explicitCount() {
-        int count = 0;
-        for (@SuppressWarnings("unused") Node node : this) {
-            count++;
-        }
-        return count;
-    }
-
-    public abstract boolean contains(Node node);
-
     @Override
     public abstract NodeClassIterator iterator();
 }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeUsagesList.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeUsagesList.java	Mon Jan 30 15:16:33 2012 +0100
@@ -58,6 +58,11 @@
         return size > 0;
     }
 
+    @Override
+    public int count() {
+        return size;
+    }
+
     protected void incModCount() {
         modCount++;
     }
@@ -140,6 +145,7 @@
         };
     }
 
+    @Override
     public boolean contains(Node other) {
         for (int i = 0; i < size; i++) {
             if (nodes[i] == other) {
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/FilteredNodeIterable.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/FilteredNodeIterable.java	Mon Jan 30 15:16:33 2012 +0100
@@ -28,20 +28,10 @@
 
 public class FilteredNodeIterable<T extends Node> extends NodeIterable<T> {
     private final NodeIterable<T> nodeIterable;
-    private NodePredicate predicate = NodePredicate.TAUTOLOGY;
+    private NodePredicate predicate = NodePredicates.alwaysTrue();
+    private NodePredicate until = NodePredicates.isNull();
     public FilteredNodeIterable(NodeIterable<T> nodeIterable) {
         this.nodeIterable = nodeIterable;
-        this.until = nodeIterable.until;
-    }
-    @SuppressWarnings("unchecked")
-    public <F extends T> FilteredNodeIterable<F> and(Class<F> clazz) {
-        this.predicate = predicate.and(new TypePredicate(clazz));
-        return (FilteredNodeIterable<F>) this;
-    }
-    @SuppressWarnings("unchecked")
-    public FilteredNodeIterable<Node> or(Class<? extends Node> clazz) {
-        this.predicate = predicate.or(new TypePredicate(clazz));
-        return (FilteredNodeIterable<Node>) this;
     }
     public FilteredNodeIterable<T> and(NodePredicate nodePredicate) {
         this.predicate = this.predicate.and(nodePredicate);
@@ -52,8 +42,34 @@
         return this;
     }
     @Override
+    public NodeIterable<T> until(final T u) {
+        until = until.or(NodePredicates.equals(u));
+        return this;
+    }
+    @Override
+    public NodeIterable<T> until(final Class<? extends T> clazz) {
+        until = until.or(NodePredicates.isA(clazz));
+        return this;
+    }
+    @Override
     public Iterator<T> iterator() {
         final Iterator<T> iterator = nodeIterable.iterator();
         return new PredicatedProxyNodeIterator<>(until, iterator, predicate);
     }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <F extends T> FilteredNodeIterable<F> filter(Class<F> clazz) {
+        return (FilteredNodeIterable<F>) this.and(NodePredicates.isA(clazz));
+    }
+
+    @Override
+    public FilteredNodeIterable<T> filter(NodePredicate p) {
+        return this.and(p);
+    }
+
+    @Override
+    public FilteredNodeIterable<T> filterInterface(Class< ? > iface) {
+        return this.and(NodePredicates.isAInterface(iface));
+    }
 }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodeIterable.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodeIterable.java	Mon Jan 30 15:16:33 2012 +0100
@@ -27,17 +27,18 @@
 import com.oracle.max.graal.graph.*;
 
 public abstract class NodeIterable<T extends Node> implements Iterable<T> {
-    protected NodePredicate until = NodePredicate.IS_NULL;
     public NodeIterable<T> until(final T u) {
-        until = until.or(NodePredicate.equals(u));
-        return this;
+        return new FilteredNodeIterable<>(this).until(u);
     }
     public NodeIterable<T> until(final Class<? extends T> clazz) {
-        until = until.or(new TypePredicate(clazz));
-        return this;
+        return new FilteredNodeIterable<>(this).until(clazz);
     }
+    @SuppressWarnings("unchecked")
     public <F extends T> FilteredNodeIterable<F> filter(Class<F> clazz) {
-        return new FilteredNodeIterable<>(this).and(clazz);
+        return (FilteredNodeIterable<F>) new FilteredNodeIterable<>(this).and(NodePredicates.isA(clazz));
+    }
+    public FilteredNodeIterable<T> filterInterface(Class<?> iface) {
+        return new FilteredNodeIterable<>(this).and(NodePredicates.isAInterface(iface));
     }
     public FilteredNodeIterable<T> filter(NodePredicate predicate) {
         return new FilteredNodeIterable<>(this).and(predicate);
@@ -71,4 +72,7 @@
     public boolean isNotEmpty() {
         return iterator().hasNext();
     }
+    public boolean contains(T node) {
+        return this.filter(NodePredicates.equals(node)).isNotEmpty();
+    }
 }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodeIterator.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodeIterator.java	Mon Jan 30 15:16:33 2012 +0100
@@ -28,21 +28,17 @@
 
 public abstract class NodeIterator<T extends Node> implements Iterator<T>{
     protected T current;
-    protected final NodePredicate until;
-    public NodeIterator(NodePredicate until) {
-        this.until = until;
-    }
     protected abstract void forward();
     @Override
     public boolean hasNext() {
         forward();
-        return current != null && !until.apply(current);
+        return current != null;
     }
     @Override
     public T next() {
         forward();
         T ret = current;
-        if (current == null || until.apply(current)) {
+        if (current == null) {
             throw new NoSuchElementException();
         }
         current = null;
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodePredicate.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodePredicate.java	Mon Jan 30 15:16:33 2012 +0100
@@ -25,78 +25,18 @@
 import com.oracle.max.graal.graph.*;
 
 public abstract class NodePredicate {
-    public static final TautologyPredicate TAUTOLOGY = new TautologyPredicate();
-
-    public static final IsNullPredicate IS_NULL = new IsNullPredicate();
-
-    public static final class TautologyPredicate extends NodePredicate {
-        @Override
-        public boolean apply(Node n) {
-            return true;
-        }
-    }
-
-    public static final class AndPredicate extends NodePredicate {
-        private final NodePredicate a;
-        private final NodePredicate b;
-        private AndPredicate(NodePredicate np, NodePredicate thiz) {
-            this.a = np;
-            this.b = thiz;
-        }
-        @Override
-        public boolean apply(Node n) {
-            return b.apply(n) && a.apply(n);
-        }
-    }
-
-    public static final class OrPredicate extends NodePredicate {
-        private final NodePredicate a;
-        private final NodePredicate b;
-        private OrPredicate(NodePredicate np, NodePredicate thiz) {
-            this.a = np;
-            this.b = thiz;
-        }
-        @Override
-        public boolean apply(Node n) {
-            return b.apply(n) || a.apply(n);
-        }
-    }
-
-    public static final class IsNullPredicate extends NodePredicate {
-        @Override
-        public boolean apply(Node n) {
-            return n == null;
-        }
-    }
-
-    public static final class EqualsPredicate<T extends Node> extends NodePredicate {
-        private final T u;
-        public EqualsPredicate(T u) {
-            this.u = u;
-        }
-        @Override
-        public boolean apply(Node n) {
-            return u == n;
-        }
-    }
 
     public abstract boolean apply(Node n);
 
-    public NodePredicate and(final NodePredicate np) {
-        if (this instanceof TautologyPredicate) {
-            return np;
-        }
-        return new AndPredicate(this, np);
+    public NodePredicate and(NodePredicate np) {
+        return NodePredicates.and(this, np);
     }
 
-    public NodePredicate or(final NodePredicate np) {
-        if (this instanceof TautologyPredicate) {
-            return this;
-        }
-        return new OrPredicate(this, np);
+    public NodePredicate or(NodePredicate np) {
+        return NodePredicates.or(this, np);
     }
 
-    public static <T extends Node> EqualsPredicate<T> equals(T u) {
-        return new EqualsPredicate<>(u);
+    public NodePredicate negate() {
+        return NodePredicates.not(this);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodePredicates.java	Mon Jan 30 15:16:33 2012 +0100
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.max.graal.graph.iterators;
+
+import com.oracle.max.graal.graph.*;
+
+public abstract class NodePredicates {
+    private static final TautologyPredicate TAUTOLOGY = new TautologyPredicate();
+    private static final FalsePredicate FALSE = new FalsePredicate();
+    private static final IsNullPredicate IS_NULL = new IsNullPredicate();
+    private static final IsNotNullPredicate IS_NOT_NULL = new IsNotNullPredicate();
+
+    public static NodePredicate alwaysTrue() {
+        return TAUTOLOGY;
+    }
+
+    public static NodePredicate alwaysFalse() {
+        return FALSE;
+    }
+
+    public static NodePredicate isNull() {
+        return IS_NULL;
+    }
+
+    public static NodePredicate isNotNull() {
+        return IS_NOT_NULL;
+    }
+
+    public static NodePredicate equals(Node n) {
+        return new EqualsPredicate(n);
+    }
+
+    public static NodePredicate not(NodePredicate a) {
+        if (a == TAUTOLOGY) {
+            return FALSE;
+        }
+        if (a == FALSE) {
+            return TAUTOLOGY;
+        }
+        if (a == IS_NULL) {
+            return IS_NOT_NULL;
+        }
+        if (a == IS_NOT_NULL) {
+            return IS_NULL;
+        }
+        if (a instanceof NotPredicate) {
+            return ((NotPredicate) a).a;
+        }
+        if (a instanceof PositiveTypePredicate) {
+            return new NegativeTypePredicate((PositiveTypePredicate) a);
+        }
+        if (a instanceof NegativeTypePredicate) {
+            return new PositiveTypePredicate((NegativeTypePredicate) a);
+        }
+        if (a instanceof EqualsPredicate) {
+            return new NotEqualsPredicate(((EqualsPredicate) a).u);
+        }
+        if (a instanceof NotEqualsPredicate) {
+            return new EqualsPredicate(((NotEqualsPredicate) a).u);
+        }
+        return new NotPredicate(a);
+    }
+
+    public static NodePredicate and(NodePredicate a, NodePredicate b) {
+        if (a == TAUTOLOGY) {
+            return b;
+        }
+        if (b == TAUTOLOGY) {
+            return a;
+        }
+        if (a == FALSE || b == FALSE) {
+            return FALSE;
+        }
+        return new AndPredicate(a, b);
+    }
+
+    public static NodePredicate or(NodePredicate a, NodePredicate b) {
+        if (a == FALSE) {
+            return b;
+        }
+        if (b == FALSE) {
+            return a;
+        }
+        if (a == TAUTOLOGY || b == TAUTOLOGY) {
+            return TAUTOLOGY;
+        }
+        return new OrPredicate(a, b);
+    }
+
+    public static NegativeTypePredicate isNotA(Class<? extends Node> clazz) {
+        return new NegativeTypePredicate(clazz);
+    }
+
+    public static PositiveTypePredicate isA(Class<? extends Node> clazz) {
+        return new PositiveTypePredicate(clazz);
+    }
+
+    public static NodePredicate isAInterface(Class<?> iface) {
+        assert iface.isInterface();
+        return new PositiveTypePredicate(iface);
+    }
+
+    public static NodePredicate isNotAInterface(Class<?> iface) {
+        assert iface.isInterface();
+        return new NegativeTypePredicate(iface);
+    }
+
+    private static final class TautologyPredicate extends NodePredicate {
+        @Override
+        public boolean apply(Node n) {
+            return true;
+        }
+    }
+
+    private static final class FalsePredicate extends NodePredicate {
+        @Override
+        public boolean apply(Node n) {
+            return false;
+        }
+    }
+
+    private static final class AndPredicate extends NodePredicate {
+        private final NodePredicate a;
+        private final NodePredicate b;
+        private AndPredicate(NodePredicate pa, NodePredicate pb) {
+            this.a = pa;
+            this.b = pb;
+        }
+        @Override
+        public boolean apply(Node n) {
+            return b.apply(n) && a.apply(n);
+        }
+    }
+
+    private static final class NotPredicate extends NodePredicate {
+        private final NodePredicate a;
+        private NotPredicate(NodePredicate n) {
+            this.a = n;
+        }
+        @Override
+        public boolean apply(Node n) {
+            return !a.apply(n);
+        }
+    }
+
+    private static final class OrPredicate extends NodePredicate {
+        private final NodePredicate a;
+        private final NodePredicate b;
+        private OrPredicate(NodePredicate np, NodePredicate thiz) {
+            this.a = np;
+            this.b = thiz;
+        }
+        @Override
+        public boolean apply(Node n) {
+            return b.apply(n) || a.apply(n);
+        }
+    }
+
+    private static final class IsNullPredicate extends NodePredicate {
+        @Override
+        public boolean apply(Node n) {
+            return n == null;
+        }
+    }
+
+    private static final class IsNotNullPredicate extends NodePredicate {
+        @Override
+        public boolean apply(Node n) {
+            return n != null;
+        }
+    }
+
+    private static final class EqualsPredicate extends NodePredicate {
+        private final Node u;
+        public EqualsPredicate(Node u) {
+            this.u = u;
+        }
+        @Override
+        public boolean apply(Node n) {
+            return u == n;
+        }
+    }
+
+    private static final class NotEqualsPredicate extends NodePredicate {
+        private final Node u;
+        public NotEqualsPredicate(Node u) {
+            this.u = u;
+        }
+        @Override
+        public boolean apply(Node n) {
+            return u != n;
+        }
+    }
+
+    public static final class PositiveTypePredicate extends NodePredicate {
+        private final Class<?> type;
+        private PositiveTypePredicate or;
+        public PositiveTypePredicate(Class<?> type) {
+            this.type = type;
+        }
+        public PositiveTypePredicate(NegativeTypePredicate a) {
+            type = a.type;
+            if (a.nor != null) {
+                or = new PositiveTypePredicate(a.nor);
+            }
+        }
+        @Override
+        public boolean apply(Node n) {
+            return type.isInstance(n) || (or != null && or.apply(n));
+        }
+        public PositiveTypePredicate or(Class<? extends Node> clazz) {
+            if (or == null) {
+                or = new PositiveTypePredicate(clazz);
+            } else {
+                or.or(clazz);
+            }
+            return this;
+        }
+    }
+
+    public static final class NegativeTypePredicate extends NodePredicate {
+        private final Class<?> type;
+        private NegativeTypePredicate nor;
+        public NegativeTypePredicate(Class<?> type) {
+            this.type = type;
+        }
+        public NegativeTypePredicate(PositiveTypePredicate a) {
+            type = a.type;
+            if (a.or != null) {
+                nor = new NegativeTypePredicate(a.or);
+            }
+        }
+        @Override
+        public boolean apply(Node n) {
+            return !type.isInstance(n) && (nor == null || nor.apply(n));
+        }
+        public NegativeTypePredicate nor(Class<? extends Node> clazz) {
+            if (nor == null) {
+                nor = new NegativeTypePredicate(clazz);
+            } else {
+                nor.nor(clazz);
+            }
+            return this;
+        }
+    }
+}
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/PredicatedProxyNodeIterator.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/PredicatedProxyNodeIterator.java	Mon Jan 30 15:16:33 2012 +0100
@@ -29,8 +29,9 @@
 public final class PredicatedProxyNodeIterator<T extends Node> extends NodeIterator<T> {
     private final Iterator<T> iterator;
     private final NodePredicate predicate;
+    private final NodePredicate until;
     public PredicatedProxyNodeIterator(NodePredicate until, Iterator<T> iterator, NodePredicate predicate) {
-        super(until);
+        this.until = until;
         this.iterator = iterator;
         this.predicate = predicate;
     }
@@ -39,7 +40,7 @@
         while ((current == null || !current.isAlive() || !predicate.apply(current)) && iterator.hasNext()) {
             current = iterator.next();
         }
-        if (current != null && (!current.isAlive() || !predicate.apply(current))) {
+        if (current != null && (!current.isAlive() || !predicate.apply(current) || until.apply(current))) {
             current = null;
         }
     }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/TypePredicate.java	Sun Jan 29 11:40:04 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2011, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.graal.graph.iterators;
-
-import com.oracle.max.graal.graph.*;
-
-public final class TypePredicate extends NodePredicate {
-    private final Class<? extends Node> type;
-    public TypePredicate(Class< ? extends Node> type) {
-        this.type = type;
-    }
-    @Override
-    public boolean apply(Node n) {
-        return type.isInstance(n);
-    }
-}
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/EndNode.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/EndNode.java	Mon Jan 30 15:16:33 2012 +0100
@@ -40,12 +40,7 @@
     }
 
     public MergeNode merge() {
-        if (usages().size() == 0) {
-            return null;
-        } else {
-            assert usages().size() == 1;
-            return (MergeNode) usages().iterator().next();
-        }
+        return (MergeNode) usages().first();
     }
 
     @Override
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FrameState.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FrameState.java	Mon Jan 30 15:16:33 2012 +0100
@@ -27,6 +27,7 @@
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
 import com.oracle.max.graal.graph.*;
+import com.oracle.max.graal.graph.iterators.*;
 import com.oracle.max.graal.nodes.PhiNode.PhiType;
 import com.oracle.max.graal.nodes.spi.*;
 import com.oracle.max.graal.nodes.virtual.*;
@@ -455,9 +456,8 @@
     public void deleteRedundantPhi(PhiNode redundantPhi, ValueNode phiValue) {
         Collection<PhiNode> phiUsages = redundantPhi.usages().filter(PhiNode.class).snapshot();
         ((StructuredGraph) graph()).replaceFloating(redundantPhi, phiValue);
-        for (Node n : phiUsages) {
-            PhiNode phiNode = (PhiNode) n;
-            checkRedundantPhi(phiNode);
+        for (PhiNode phi : phiUsages) {
+            checkRedundantPhi(phi);
         }
     }
 
@@ -488,48 +488,11 @@
     }
 
     public StateSplit stateSplit() {
-        for (Node n : usages()) {
-            if (n instanceof StateSplit) {
-                return (StateSplit) n;
-            }
-        }
-        return null;
+        return (StateSplit) usages().filterInterface(StateSplit.class).first();
     }
 
-    public Iterable<FrameState> innerFrameStates() {
-        final Iterator<Node> iterator = usages().iterator();
-        return new Iterable<FrameState>() {
-            @Override
-            public Iterator<FrameState> iterator() {
-                return new Iterator<FrameState>() {
-                    private Node next;
-                    @Override
-                    public void remove() {
-                        throw new UnsupportedOperationException();
-                    }
-                    @Override
-                    public FrameState next() {
-                        forward();
-                        if (!hasNext()) {
-                            throw new NoSuchElementException();
-                        }
-                        FrameState res = (FrameState) next;
-                        next = null;
-                        return res;
-                    }
-                    @Override
-                    public boolean hasNext() {
-                        forward();
-                        return next != null;
-                    }
-                    private void forward() {
-                        while (!(next instanceof FrameState) && iterator.hasNext()) {
-                            next = iterator.next();
-                        }
-                    }
-                };
-            }
-        };
+    public NodeIterable<FrameState> innerFrameStates() {
+        return usages().filter(FrameState.class);
     }
 
     /**
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/LoopBeginNode.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/LoopBeginNode.java	Mon Jan 30 15:16:33 2012 +0100
@@ -45,12 +45,7 @@
     }
 
     public LoopEndNode loopEnd() {
-        for (LoopEndNode end : usages().filter(LoopEndNode.class)) {
-            if (end.loopBegin() == this) {
-                return end;
-            }
-        }
-        return null;
+        return usages().filter(LoopEndNode.class).first();
     }
 
     @Override
@@ -83,11 +78,6 @@
         throw ValueUtil.shouldNotReachHere();
     }
 
-    @Override
-    public Iterable<? extends Node> phiPredecessors() {
-        return Arrays.asList(new Node[]{this.forwardEdge(), this.loopEnd()});
-    }
-
     public EndNode forwardEdge() {
         return this.endAt(0);
     }
@@ -96,7 +86,7 @@
     public boolean verify() {
         assertTrue(loopEnd() != null, "missing loopEnd");
         assertTrue(forwardEdge() != null, "missing forwardEdge");
-        assertTrue(usages().filter(LoopEndNode.class).snapshot().size() == 1, "multiple loop ends");
+        assertTrue(usages().filter(LoopEndNode.class).count() == 1, "multiple loop ends");
         return super.verify();
     }
 
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/MergeNode.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/MergeNode.java	Mon Jan 30 15:16:33 2012 +0100
@@ -59,12 +59,8 @@
         return ends.get(index);
     }
 
-    public Iterable<? extends Node> phiPredecessors() {
-        return ends;
-    }
-
     @Override
-    public Iterable<EndNode> cfgPredecessors() {
+    public NodeIterable<EndNode> cfgPredecessors() {
         return ends;
     }
 
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/MethodCallTargetNode.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/MethodCallTargetNode.java	Mon Jan 30 15:16:33 2012 +0100
@@ -106,10 +106,7 @@
     }
 
     public Invoke invoke() {
-        if (this.usages().size() == 0) {
-            return null;
-        }
-        return (Invoke) this.usages().iterator().next();
+        return (Invoke) this.usages().first();
     }
 
 
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/spi/EscapeOp.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/spi/EscapeOp.java	Mon Jan 30 15:16:33 2012 +0100
@@ -44,7 +44,7 @@
             assert ((IsTypeNode) usage).object() == node;
             return false;
         } else if (usage instanceof FrameState) {
-            assert ((FrameState) usage).inputs().contains(node);
+            assert usage.inputs().contains(node);
             return true;
         } else if (usage instanceof AccessMonitorNode) {
             assert ((AccessMonitorNode) usage).object() == node;
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/util/NodeIterators.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/util/NodeIterators.java	Mon Jan 30 15:16:33 2012 +0100
@@ -33,7 +33,7 @@
         return new NodeIterable<FixedNode>() {
             @Override
             public Iterator<FixedNode> iterator() {
-                return new NodeIterator<FixedNode>(until){
+                return new NodeIterator<FixedNode>(){
                     FixedNode p = n;
                     @Override
                     protected void forward() {
--- a/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinter.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinter.java	Mon Jan 30 15:16:33 2012 +0100
@@ -27,6 +27,7 @@
 import java.util.Map.Entry;
 
 import com.oracle.max.cri.ri.*;
+import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.schedule.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.graph.Node.Verbosity;
@@ -34,30 +35,58 @@
 import com.oracle.max.graal.graph.NodeClass.Position;
 import com.oracle.max.graal.java.*;
 import com.oracle.max.graal.nodes.*;
+import com.oracle.max.graal.printer.BasicIdealGraphPrinter.Edge;
 
 /**
  * Generates a representation of {@link Graph Graphs} that can be visualized and inspected with the <a
  * href="http://kenai.com/projects/igv">Ideal Graph Visualizer</a>.
  */
-class IdealGraphPrinter extends BasicIdealGraphPrinter {
+class IdealGraphPrinter {
+
+    private final BasicIdealGraphPrinter printer;
+    private final HashSet<Class<?>> omittedClasses = new HashSet<>();
+    private final Set<Node> noBlockNodes = new HashSet<>();
+
     /**
      * Creates a new {@link IdealGraphPrinter} that writes to the specified output stream.
      */
     public IdealGraphPrinter(OutputStream stream) {
-        super(stream);
+        this.printer = new BasicIdealGraphPrinter(stream);
+    }
+
+    /**
+     * Adds a node class that is omitted in the output.
+     */
+    public void addOmittedClass(Class<?> clazz) {
+        omittedClasses.add(clazz);
+    }
+
+    /**
+     * Flushes any buffered output.
+     */
+    public void flush() {
+        printer.flush();
+    }
+
+    /**
+     * Starts a new graph document.
+     */
+    public void begin() {
+        printer.begin();
     }
 
     /**
      * Starts a new group of graphs with the given name, short name and method byte code index (BCI) as properties.
      */
-    public void beginGroup(String name, String shortName, RiResolvedMethod method, int bci) {
-        beginGroup();
-        beginProperties();
-        printProperty("name", name);
-        endProperties();
-        beginMethod(name, shortName, bci);
-        if (method != null) {
-            beginBytecodes();
+    public void beginGroup(String name, String shortName, RiResolvedMethod method, int bci, String origin) {
+        printer.beginGroup();
+        printer.beginProperties();
+        printer.printProperty("name", name);
+        printer.printProperty("origin", origin);
+        printer.endProperties();
+        printer.beginMethod(name, shortName, bci);
+        if (GraalOptions.PrintIdealGraphBytecodes && method != null) {
+            printer.beginBytecodes();
             BytecodeStream bytecodes = new BytecodeStream(method.code());
             while (bytecodes.currentBC() != Bytecodes.END) {
                 int startBCI = bytecodes.currentBCI();
@@ -69,84 +98,151 @@
                         extra[i] = bytecodes.readUByte(startBCI + 1 + i);
                     }
                 }
-                printBytecode(startBCI, mnemonic, extra);
+                printer.printBytecode(startBCI, mnemonic, extra);
                 bytecodes.next();
             }
-            endBytecodes();
+            printer.endBytecodes();
         }
-        endMethod();
+        printer.endMethod();
     }
 
-    public void print(Graph graph, String title) {
-        print(graph, title, null);
+    /**
+     * Ends the current group.
+     */
+    public void endGroup() {
+        printer.endGroup();
+    }
+
+    /**
+     * Finishes the graph document and flushes the output stream.
+     */
+    public void end() {
+        printer.end();
+    }
+
+    public void print(Graph graph, String title, boolean shortNames) {
+        print(graph, title, shortNames, null);
     }
 
     /**
      * Prints an entire {@link Graph} with the specified title, optionally using short names for nodes.
      */
-    public void print(Graph graph, String title, IdentifyBlocksPhase predefinedSchedule) {
-        beginGraph(title);
-        Set<Node> noBlockNodes = new HashSet<>();
+    public void print(Graph graph, String title, boolean shortNames, IdentifyBlocksPhase predefinedSchedule) {
+        printer.beginGraph(title);
+        noBlockNodes.clear();
         IdentifyBlocksPhase schedule = predefinedSchedule;
         if (schedule == null) {
             try {
                 schedule = new IdentifyBlocksPhase(true);
-                schedule.apply((StructuredGraph) graph);
+                schedule.apply((StructuredGraph) graph, false);
             } catch (Throwable t) {
                 // nothing to do here...
             }
         }
 
-        beginNodes();
-        List<Edge> edges = printNodes(graph, schedule == null ? null : schedule.getNodeToBlock(), noBlockNodes);
-        endNodes();
+        printer.beginNodes();
+        List<Edge> edges = printNodes(graph, shortNames, schedule == null ? null : schedule.getNodeToBlock());
+        printer.endNodes();
 
-        beginEdges();
+        printer.beginEdges();
         for (Edge edge : edges) {
-            printEdge(edge);
+            printer.printEdge(edge);
         }
-        endEdges();
+        printer.endEdges();
 
         if (schedule != null) {
-            beginControlFlow();
+            printer.beginControlFlow();
             for (Block block : schedule.getBlocks()) {
                 printBlock(graph, block, schedule.getNodeToBlock());
             }
-            printNoBlock(noBlockNodes);
-            endControlFlow();
+            printNoBlock();
+            printer.endControlFlow();
         }
 
-        endGraph();
+        printer.endGraph();
         flush();
     }
 
-    private List<Edge> printNodes(Graph graph, NodeMap<Block> nodeToBlock, Set<Node> noBlockNodes) {
+    private List<Edge> printNodes(Graph graph, boolean shortNames, NodeMap<Block> nodeToBlock) {
         ArrayList<Edge> edges = new ArrayList<>();
 
         NodeMap<Set<Entry<String, Integer>>> colors = graph.createNodeMap();
         NodeMap<Set<Entry<String, String>>> colorsToString = graph.createNodeMap();
         NodeMap<Set<String>> bits = graph.createNodeMap();
+// TODO This code was never reachable, since there was no code putting a NodeMap or NodeBitMap into the debugObjects.
+// If you need to reactivate this code, put the mapping from names to values into a helper object and register it in the new debugObjects array.
+//
+//        if (debugObjects != null) {
+//            for (Entry<String, Object> entry : debugObjects.entrySet()) {
+//                String name = entry.getKey();
+//                Object obj = entry.getValue();
+//                if (obj instanceof NodeMap) {
+//                    Map<Object, Integer> colorNumbers = new HashMap<Object, Integer>();
+//                    int nextColor = 0;
+//                    NodeMap<?> map = (NodeMap<?>) obj;
+//                    for (Entry<Node, ?> mapEntry : map.entries()) {
+//                        Node node = mapEntry.getKey();
+//                        Object color = mapEntry.getValue();
+//                        Integer colorNumber = colorNumbers.get(color);
+//                        if (colorNumber == null) {
+//                            colorNumber = nextColor++;
+//                            colorNumbers.put(color, colorNumber);
+//                        }
+//                        Set<Entry<String, Integer>> nodeColors = colors.get(node);
+//                        if (nodeColors == null) {
+//                            nodeColors = new HashSet<Entry<String, Integer>>();
+//                            colors.put(node, nodeColors);
+//                        }
+//                        nodeColors.add(new SimpleImmutableEntry<String, Integer>(name + "Color", colorNumber));
+//                        Set<Entry<String, String>> nodeColorStrings = colorsToString.get(node);
+//                        if (nodeColorStrings == null) {
+//                            nodeColorStrings = new HashSet<Entry<String, String>>();
+//                            colorsToString.put(node, nodeColorStrings);
+//                        }
+//                        nodeColorStrings.add(new SimpleImmutableEntry<String, String>(name, color.toString()));
+//                    }
+//                } else if (obj instanceof NodeBitMap) {
+//                    NodeBitMap bitmap = (NodeBitMap) obj;
+//                    for (Node node : bitmap) {
+//                        Set<String> nodeBits = bits.get(node);
+//                        if (nodeBits == null) {
+//                            nodeBits = new HashSet<String>();
+//                            bits.put(node, nodeBits);
+//                        }
+//                        nodeBits.add(name);
+//                    }
+//                }
+//            }
+//        }
 
         for (Node node : graph.getNodes()) {
+            if (omittedClasses.contains(node.getClass())) {
+                continue;
+            }
 
-            beginNode(node.toString(Verbosity.Id));
-            beginProperties();
-            printProperty("idx", node.toString(Verbosity.Id));
+            printer.beginNode(node.toString(Verbosity.Id));
+            printer.beginProperties();
+            printer.printProperty("idx", node.toString(Verbosity.Id));
 
             Map<Object, Object> props = node.getDebugProperties();
             if (!props.containsKey("name") || props.get("name").toString().trim().length() == 0) {
-                String name = node.toString(Verbosity.Name);
-                printProperty("name", name);
+                String name;
+                if (shortNames) {
+                    name = node.toString(Verbosity.Name);
+                } else {
+                    name = node.toString();
+                }
+                printer.printProperty("name", name);
             }
-            printProperty("class", node.getClass().getSimpleName());
+            printer.printProperty("class", node.getClass().getSimpleName());
             Block block = nodeToBlock == null ? null : nodeToBlock.get(node);
             if (block != null) {
-                printProperty("block", Integer.toString(block.blockID()));
+                printer.printProperty("block", Integer.toString(block.blockID()));
                 if (!(node instanceof PhiNode || node instanceof FrameState || node instanceof LocalNode) && !block.getInstructions().contains(node)) {
-                    printProperty("notInOwnBlock", "true");
+                    printer.printProperty("notInOwnBlock", "true");
                 }
             } else {
-                printProperty("block", "noBlock");
+                printer.printProperty("block", "noBlock");
                 noBlockNodes.add(node);
             }
 
@@ -155,7 +251,7 @@
                 for (Entry<String, Integer> color : nodeColors) {
                     String name = color.getKey();
                     Integer value = color.getValue();
-                    printProperty(name, Integer.toString(value));
+                    printer.printProperty(name, Integer.toString(value));
                 }
             }
             Set<Entry<String, String>> nodeColorStrings = colorsToString.get(node);
@@ -163,24 +259,24 @@
                 for (Entry<String, String> color : nodeColorStrings) {
                     String name = color.getKey();
                     String value = color.getValue();
-                    printProperty(name, value);
+                    printer.printProperty(name, value);
                 }
             }
             Set<String> nodeBits = bits.get(node);
             if (nodeBits != null) {
                 for (String bit : nodeBits) {
-                    printProperty(bit, "true");
+                    printer.printProperty(bit, "true");
                 }
             }
 
             for (Entry<Object, Object> entry : props.entrySet()) {
                 String key = entry.getKey().toString();
                 String value = entry.getValue() == null ? "null" : entry.getValue().toString();
-                printProperty(key, value);
+                printer.printProperty(key, value);
             }
 
-            endProperties();
-            endNode();
+            printer.endProperties();
+            printer.endNode();
 
             // successors
             int fromIndex = 0;
@@ -188,7 +284,7 @@
             while (succIter.hasNext()) {
                 Position position = succIter.nextPosition();
                 Node successor = node.getNodeClass().get(node, position);
-                if (successor != null) {
+                if (successor != null && !omittedClasses.contains(successor.getClass())) {
                     edges.add(new Edge(node.toString(Verbosity.Id), fromIndex, successor.toString(Verbosity.Id), 0, node.getNodeClass().getName(position)));
                 }
                 fromIndex++;
@@ -200,8 +296,8 @@
             while (inputIter.hasNext()) {
                 Position position = inputIter.nextPosition();
                 Node input = node.getNodeClass().get(node, position);
-                if (input != null) {
-                    edges.add(new Edge(input.toString(Verbosity.Id), input.successors().explicitCount(), node.toString(Verbosity.Id), toIndex, node.getNodeClass().getName(position)));
+                if (input != null && !omittedClasses.contains(input.getClass())) {
+                    edges.add(new Edge(input.toString(Verbosity.Id), input.successors().count(), node.toString(Verbosity.Id), toIndex, node.getNodeClass().getName(position)));
                 }
                 toIndex++;
             }
@@ -211,15 +307,15 @@
     }
 
     private void printBlock(Graph graph, Block block, NodeMap<Block> nodeToBlock) {
-        beginBlock(Integer.toString(block.blockID()));
-        beginSuccessors();
+        printer.beginBlock(Integer.toString(block.blockID()));
+        printer.beginSuccessors();
         for (Block sux : block.getSuccessors()) {
             if (sux != null) {
-                printSuccessor(Integer.toString(sux.blockID()));
+                printer.printSuccessor(Integer.toString(sux.blockID()));
             }
         }
-        endSuccessors();
-        beginBlockNodes();
+        printer.endSuccessors();
+        printer.beginBlockNodes();
 
         Set<Node> nodes = new HashSet<>(block.getInstructions());
 
@@ -255,22 +351,25 @@
             }
 
             for (Node node : nodes) {
-                printBlockNode(node.toString(Verbosity.Id));
+                if (!omittedClasses.contains(node.getClass())) {
+                    printer.printBlockNode(node.toString(Verbosity.Id));
+                }
             }
         }
-        endBlockNodes();
-        endBlock();
+        printer.endBlockNodes();
+        printer.endBlock();
     }
 
-    private void printNoBlock(Set<Node> noBlockNodes) {
+    private void printNoBlock() {
         if (!noBlockNodes.isEmpty()) {
-            beginBlock("noBlock");
-            beginBlockNodes();
+            printer.beginBlock("noBlock");
+            printer.beginBlockNodes();
             for (Node node : noBlockNodes) {
-                printBlockNode(node.toString(Verbosity.Id));
+                printer.printBlockNode(node.toString(Verbosity.Id));
             }
-            endBlockNodes();
-            endBlock();
+            printer.endBlockNodes();
+            printer.endBlock();
         }
     }
+
 }
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/ArrayCopySnippets.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/ArrayCopySnippets.java	Mon Jan 30 15:16:33 2012 +0100
@@ -154,6 +154,29 @@
     }
 
     @Snippet
+    public static void arraycopy(float[] src, int srcPos, float[] dest, int destPos, int length) {
+        if (src == null || dest == null) {
+            throw new NullPointerException();
+        }
+        if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > src.length || destPos + length > dest.length) {
+            throw new IndexOutOfBoundsException();
+        }
+        if (src == dest && srcPos < destPos) { // bad aliased case
+            if ((length & 0x01) == 0) {
+                copyLongsDown(src, srcPos * 4L, dest, destPos * 4L, length >> 1);
+            } else {
+                copyIntsDown(src, srcPos * 4L, dest, destPos * 4L, length);
+            }
+        } else {
+            if ((length & 0x01) == 0) {
+                copyLongsUp(src, srcPos * 4L, dest, destPos * 4L, length >> 1);
+            } else {
+                copyIntsUp(src, srcPos * 4L, dest, destPos * 4L, length);
+            }
+        }
+    }
+
+    @Snippet
     public static void arraycopy(long[] src, int srcPos, long[] dest, int destPos, int length) {
         if (src == null || dest == null) {
             throw new NullPointerException();
@@ -169,6 +192,37 @@
     }
 
     @Snippet
+    public static void arraycopy(double[] src, int srcPos, double[] dest, int destPos, int length) {
+        if (src == null || dest == null) {
+            throw new NullPointerException();
+        }
+        if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > src.length || destPos + length > dest.length) {
+            throw new IndexOutOfBoundsException();
+        }
+        if (src == dest && srcPos < destPos) { // bad aliased case
+            copyLongsDown(src, srcPos * 8L, dest, destPos * 8L, length);
+        } else {
+            copyLongsUp(src, srcPos * 8L, dest, destPos * 8L, length);
+        }
+    }
+
+    // Does NOT perform store checks
+    @Snippet
+    public static void arraycopy(Object[] src, int srcPos, Object[] dest, int destPos, int length) {
+        if (src == null || dest == null) {
+            throw new NullPointerException();
+        }
+        if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > src.length || destPos + length > dest.length) {
+            throw new IndexOutOfBoundsException();
+        }
+        if (src == dest && srcPos < destPos) { // bad aliased case
+            copyObjectsDown(src, srcPos * 8L, dest, destPos * 8L, length);
+        } else {
+            copyObjectsUp(src, srcPos * 8L, dest, destPos * 8L, length);
+        }
+    }
+
+    @Snippet
     public static void copyBytesDown(Object src, int srcPos, Object dest, int destPos, int length)  {
         long header = ArrayHeaderSizeNode.sizeFor(CiKind.Byte);
         for (long i = length - 1; i >= 0; i--) {
@@ -204,6 +258,16 @@
         }
     }
 
+    // Does NOT perform store checks
+    @Snippet
+    public static void copyObjectsDown(Object src, long srcOffset, Object dest, long destOffset, int length)  {
+        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Object);
+        for (long i = (length - 1) * 8; i >= 0; i -= 8) {
+            Object a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Object);
+            UnsafeStoreNode.store(dest, i + (destOffset + header), a, CiKind.Object);
+        }
+    }
+
     /**
      * Copies {@code length} bytes from {@code src} starting at {@code srcPos} to {@code dest} starting at {@code destPos}.
      * @param src source object
@@ -255,4 +319,14 @@
             UnsafeStoreNode.store(dest, i + (destOffset + header), a.longValue(), CiKind.Long);
         }
     }
+
+    // Does NOT perform store checks
+    @Snippet
+    public static void copyObjectsUp(Object src, long srcOffset, Object dest, long destOffset, int length)  {
+        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Object);
+        for (long i = 0; i < length * 8L; i += 8) {
+            Object a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Object);
+            UnsafeStoreNode.store(dest, i + (destOffset + header), a, CiKind.Object);
+        }
+    }
 }
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/IntrinsifyArrayCopyPhase.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/IntrinsifyArrayCopyPhase.java	Mon Jan 30 15:16:33 2012 +0100
@@ -24,6 +24,7 @@
 
 import java.lang.reflect.*;
 
+import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
 import com.oracle.max.graal.compiler.phases.*;
 import com.oracle.max.graal.compiler.util.*;
@@ -40,6 +41,9 @@
     private RiResolvedMethod charArrayCopy;
     private RiResolvedMethod intArrayCopy;
     private RiResolvedMethod longArrayCopy;
+    private RiResolvedMethod floatArrayCopy;
+    private RiResolvedMethod doubleArrayCopy;
+    private RiResolvedMethod objectArrayCopy;
 
     public IntrinsifyArrayCopyPhase(GraalRuntime runtime) {
         this.runtime = runtime;
@@ -49,6 +53,9 @@
             shortArrayCopy = getArrayCopySnippet(runtime, short.class);
             intArrayCopy = getArrayCopySnippet(runtime, int.class);
             longArrayCopy = getArrayCopySnippet(runtime, long.class);
+            floatArrayCopy = getArrayCopySnippet(runtime, float.class);
+            doubleArrayCopy = getArrayCopySnippet(runtime, double.class);
+            objectArrayCopy = getArrayCopySnippet(runtime, Object.class);
             arrayCopy = runtime.getRiMethod(System.class.getDeclaredMethod("arraycopy", Object.class, int.class, Object.class, int.class, int.class));
         } catch (SecurityException e) {
             e.printStackTrace();
@@ -78,19 +85,29 @@
                 if (srcDeclaredType != null
                                 && srcDeclaredType.isArrayClass()
                                 && destDeclaredType != null
-                                && destDeclaredType.isArrayClass()
-                                && srcDeclaredType.componentType() == destDeclaredType.componentType()) {
-                    Class<?> componentType = srcDeclaredType.componentType().toJava();
-                    if (componentType.equals(int.class)) {
-                        snippetMethod = intArrayCopy;
-                    } else if (componentType.equals(char.class)) {
-                        snippetMethod = charArrayCopy;
-                    } else if (componentType.equals(long.class)) {
-                        snippetMethod = longArrayCopy;
-                    } else if (componentType.equals(byte.class)) {
-                        snippetMethod = byteArrayCopy;
-                    } else if (componentType.equals(short.class)) {
-                        snippetMethod = shortArrayCopy;
+                                && destDeclaredType.isArrayClass()) {
+                    CiKind componentKind = srcDeclaredType.componentType().kind(false);
+                    if (srcDeclaredType.componentType() == destDeclaredType.componentType()) {
+                        if (componentKind == CiKind.Int) {
+                            snippetMethod = intArrayCopy;
+                        } else if (componentKind == CiKind.Char) {
+                            snippetMethod = charArrayCopy;
+                        } else if (componentKind == CiKind.Long) {
+                            snippetMethod = longArrayCopy;
+                        } else if (componentKind == CiKind.Byte) {
+                            snippetMethod = byteArrayCopy;
+                        } else if (componentKind == CiKind.Short) {
+                            snippetMethod = shortArrayCopy;
+                        } else if (componentKind == CiKind.Float) {
+                            snippetMethod = floatArrayCopy;
+                        } else if (componentKind == CiKind.Double) {
+                            snippetMethod = doubleArrayCopy;
+                        } else if (componentKind == CiKind.Object) {
+                            snippetMethod = objectArrayCopy;
+                        }
+                    } else if (componentKind == CiKind.Object
+                                    && srcDeclaredType.componentType().isSubtypeOf(destDeclaredType.componentType())) {
+                        snippetMethod = objectArrayCopy;
                     }
                 }
             }
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/BoxingEliminationTest.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/BoxingEliminationTest.java	Mon Jan 30 15:16:33 2012 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.max.graal.compiler.tests;
 
+import static com.oracle.max.graal.graph.iterators.NodePredicates.*;
+
 import java.util.*;
 
 import org.junit.*;
@@ -97,12 +99,8 @@
         identifyBoxingPhase.apply(graph);
         LocalNode local = graph.getNodes(LocalNode.class).iterator().next();
         ConstantNode constant = ConstantNode.forInt(0, graph);
-        for (Node n : local.usages().snapshot()) {
-            if (n instanceof FrameState) {
-                // Do not replace.
-            } else {
-                n.replaceFirstInput(local, constant);
-            }
+        for (Node n : local.usages().filter(isNotA(FrameState.class)).snapshot()) {
+            n.replaceFirstInput(local, constant);
         }
         Collection<Invoke> hints = new ArrayList<>();
         for (Invoke invoke : graph.getInvokes()) {
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/DegeneratedLoopsTest.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/DegeneratedLoopsTest.java	Mon Jan 30 15:16:33 2012 +0100
@@ -22,9 +22,10 @@
  */
 package com.oracle.max.graal.compiler.tests;
 
-import junit.framework.AssertionFailedError;
+import static com.oracle.max.graal.graph.iterators.NodePredicates.*;
+import junit.framework.*;
 
-import org.junit.*;
+import org.junit.Test;
 
 import com.oracle.max.graal.compiler.phases.*;
 import com.oracle.max.graal.debug.*;
@@ -84,12 +85,8 @@
         Debug.dump(graph, "Graph");
         LocalNode local = graph.getNodes(LocalNode.class).iterator().next();
         ConstantNode constant = ConstantNode.forInt(0, graph);
-        for (Node n : local.usages().snapshot()) {
-            if (n instanceof FrameState) {
-                // Do not replace.
-            } else {
-                n.replaceFirstInput(local, constant);
-            }
+        for (Node n : local.usages().filter(isNotA(FrameState.class)).snapshot()) {
+            n.replaceFirstInput(local, constant);
         }
         for (Invoke invoke : graph.getInvokes()) {
             invoke.intrinsify(null);
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/IfCanonicalizerTest.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/IfCanonicalizerTest.java	Mon Jan 30 15:16:33 2012 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.max.graal.compiler.tests;
 
+import static com.oracle.max.graal.graph.iterators.NodePredicates.*;
+
 import org.junit.*;
 
 import com.oracle.max.graal.compiler.phases.*;
@@ -137,12 +139,8 @@
         StructuredGraph graph = parse(snippet);
         LocalNode local = graph.getNodes(LocalNode.class).iterator().next();
         ConstantNode constant = ConstantNode.forInt(0, graph);
-        for (Node n : local.usages().snapshot()) {
-            if (n instanceof FrameState) {
-                // Do not replace.
-            } else {
-                n.replaceFirstInput(local, constant);
-            }
+        for (Node n : local.usages().filter(isNotA(FrameState.class)).snapshot()) {
+            n.replaceFirstInput(local, constant);
         }
         Debug.dump(graph, "Graph");
         new CanonicalizerPhase(null, runtime(), null).apply(graph);
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/InvokeTest.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/InvokeTest.java	Mon Jan 30 15:16:33 2012 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.max.graal.compiler.tests;
 
+import static com.oracle.max.graal.graph.iterators.NodePredicates.*;
+
 import java.util.*;
 
 import org.junit.*;
@@ -72,12 +74,8 @@
         StructuredGraph graph = parse(snippet);
         LocalNode local = graph.getNodes(LocalNode.class).iterator().next();
         ConstantNode constant = ConstantNode.forInt(0, graph);
-        for (Node n : local.usages().snapshot()) {
-            if (n instanceof FrameState) {
-                // Do not replace.
-            } else {
-                n.replaceFirstInput(local, constant);
-            }
+        for (Node n : local.usages().filter(isNotA(FrameState.class)).snapshot()) {
+            n.replaceFirstInput(local, constant);
         }
         Collection<Invoke> hints = new ArrayList<>();
         for (Invoke invoke : graph.getInvokes()) {
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/MonitorTest.java	Sun Jan 29 11:40:04 2012 +0100
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/MonitorTest.java	Mon Jan 30 15:16:33 2012 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.max.graal.compiler.tests;
 
+import static com.oracle.max.graal.graph.iterators.NodePredicates.*;
+
 import java.util.*;
 
 import junit.framework.AssertionFailedError;
@@ -30,6 +32,7 @@
 
 import com.oracle.max.graal.compiler.phases.*;
 import com.oracle.max.graal.graph.*;
+import com.oracle.max.graal.graph.iterators.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.java.*;
 
@@ -64,10 +67,9 @@
     @Test
     public void test2() {
         StructuredGraph graph = parseAndProcess("test2Snippet");
-        Collection<MonitorExitNode> monitors = graph.getNodes(MonitorExitNode.class).snapshot();
-        Assert.assertEquals(1, monitors.size());
-        MonitorExitNode monitor = monitors.iterator().next();
-        Assert.assertEquals(monitor.stateAfter().bci, 3);
+        NodeIterable<MonitorExitNode> monitors = graph.getNodes(MonitorExitNode.class);
+        Assert.assertEquals(1, monitors.count());
+        Assert.assertEquals(monitors.first().stateAfter().bci, 3);
     }
 
     @SuppressWarnings("all")
@@ -81,14 +83,10 @@
 
     private StructuredGraph parseAndProcess(String snippet) {
         StructuredGraph graph = parse(snippet);
-        LocalNode local = graph.getNodes(LocalNode.class).iterator().next();
+        LocalNode local = graph.getNodes(LocalNode.class).first();
         ConstantNode constant = ConstantNode.forInt(0, graph);
-        for (Node n : local.usages().snapshot()) {
-            if (n instanceof FrameState) {
-                // Do not replace.
-            } else {
-                n.replaceFirstInput(local, constant);
-            }
+        for (Node n : local.usages().filter(isNotA(FrameState.class)).snapshot()) {
+            n.replaceFirstInput(local, constant);
         }
         Collection<Invoke> hints = new ArrayList<>();
         for (Invoke invoke : graph.getInvokes()) {