changeset 4461:539fca6a3b98

Merge
author Christian Haeubl <christian.haeubl@oracle.com>
date Thu, 02 Feb 2012 16:07:52 -0800
parents b9e6576eefe7 (current diff) f75f0cdf0ccc (diff)
children 428a91f18858
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/alloc/util/LIRVerifier.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/GraalOptions.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/lir/LIRBranch.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRCall.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIROpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/MoveInstruction.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/StandardOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/package-info.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/FindInductionVariablesPhase.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/phases/RemoveInductionVariablesPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/RemovePlaceholderPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ArithmeticOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CallOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CompareOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ControlFlowOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ConvertOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64DivOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LogicFloatOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64MoveOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64MulOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Op1Opcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ShiftOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64StandardOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64XirOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/LoopUtil.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/NodeIterators.java graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/TypePredicate.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/CompilerToVM.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodResolvedImpl.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotRuntime.java graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/BlockMap.java graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/IfNode.java graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/LookupSwitchNode.java graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/BasicInductionVariableNode.java graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/DerivedInductionVariableNode.java graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/InductionVariableNode.java graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/LinearInductionVariableNode.java graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/LoopCounterNode.java graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/spi/EscapeOp.java graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinterObserver.java graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/ArrayCopySnippets.java graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/IntrinsifyArrayCopyPhase.java graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/SystemSnippets.java graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/UnsafeSnippets.java graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/target/amd64/AMD64MathIntrinsicOpcode.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/graalCompilerToVM.cpp src/share/vm/graal/graalJavaAccess.hpp src/share/vm/graal/graal_paths.hpp
diffstat 493 files changed, 8887 insertions(+), 18756 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiResult.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2009, 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.cri.ci;
-
-/**
- * Represents the result of compiling a method. The result can include a target method with machine code and metadata,
- * and/or statistics. If the compiler bailed out due to malformed bytecode, an internal error, or other cause, it will
- * supply the bailout object.
- */
-public class CiResult {
-    private final CiTargetMethod targetMethod;
-    private final CiBailout bailout;
-
-    /**
-     * Creates a new compilation result.
-     * @param targetMethod the method that was produced, if any
-     * @param bailout the bailout condition that occurred
-     * @param stats statistics about the compilation
-     */
-    public CiResult(CiTargetMethod targetMethod, CiBailout bailout) {
-        this.targetMethod = targetMethod;
-        this.bailout = bailout;
-    }
-
-    /**
-     * Gets the target method that was produced by this compilation. If no target method was
-     * produced, but a bailout occured, then the bailout exception will be thrown at this point.
-     * @return the target method produced
-     * @throws {@link CiBailout} if a bailout occurred
-     */
-    public CiTargetMethod targetMethod() {
-        if (bailout != null) {
-            throw bailout;
-        }
-        return targetMethod;
-    }
-
-    /**
-     * Returns the bailout condition that occurred for this compilation, if any.
-     * @return the bailout
-     */
-    public CiBailout bailout() {
-        return bailout;
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiValueUtil.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiValueUtil.java	Thu Feb 02 16:07:52 2012 -0800
@@ -110,25 +110,19 @@
     }
 
 
-    public static boolean sameRegister(CiValue...values) {
-        for (int i = 0; i < values.length; i++) {
-            for (int j = i + 1; j < values.length; j++) {
-                if (isRegister(values[i]) && isRegister(values[j]) && asRegister(values[i]) != asRegister(values[j])) {
-                    return false;
-                }
-            }
-        }
-        return true;
+    public static boolean sameRegister(CiValue v1, CiValue v2) {
+        return isRegister(v1) && isRegister(v2) && asRegister(v1) == asRegister(v2);
+    }
+
+    public static boolean sameRegister(CiValue v1, CiValue v2, CiValue v3) {
+        return sameRegister(v1, v2) && sameRegister(v1, v3);
     }
 
-    public static boolean differentRegisters(CiValue...values) {
-        for (int i = 0; i < values.length; i++) {
-            for (int j = i + 1; j < values.length; j++) {
-                if (isRegister(values[i]) && isRegister(values[j]) && asRegister(values[i]) == asRegister(values[j])) {
-                    return false;
-                }
-            }
-        }
-        return true;
+    public static boolean differentRegisters(CiValue v1, CiValue v2) {
+        return !isRegister(v1) || !isRegister(v2) || asRegister(v1) != asRegister(v2);
+    }
+
+    public static boolean differentRegisters(CiValue v1, CiValue v2, CiValue v3) {
+        return differentRegisters(v1, v2) && differentRegisters(v1, v3) && differentRegisters(v2, v3);
     }
 }
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiRuntime.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiRuntime.java	Thu Feb 02 16:07:52 2012 -0800
@@ -186,7 +186,7 @@
      * @param method a method whose executable code is being modified
      * @param code the code to be executed when {@code method} is called
      */
-    void installMethod(RiMethod method, CiTargetMethod code);
+    void installMethod(RiResolvedMethod method, CiTargetMethod code);
 
     /**
      * Adds the given machine code as an implementation of the given method without making it the default implementation.
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/AssignRegisters.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/AssignRegisters.java	Thu Feb 02 16:07:52 2012 -0800
@@ -76,7 +76,7 @@
                     if (op instanceof LIRXirInstruction) {
                         LIRXirInstruction xir = (LIRXirInstruction) op;
                         if (xir.infoAfter != null) {
-                            xir.infoAfter.finish(op.hasCall() ? null : new CiBitMap(curRegisterRefMap), new CiBitMap(curFrameRefMap), frameMap);
+                            xir.infoAfter.finish(new CiBitMap(curRegisterRefMap), new CiBitMap(curFrameRefMap), frameMap);
                         }
                     }
                 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/DataFlowAnalysis.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/DataFlowAnalysis.java	Thu Feb 02 16:07:52 2012 -0800
@@ -22,7 +22,7 @@
  */
 package com.oracle.max.graal.alloc.simple;
 
-import static com.oracle.max.graal.compiler.lir.LIRPhiMapping.*;
+import static com.oracle.max.cri.ci.CiValueUtil.*;
 import static com.oracle.max.graal.alloc.util.ValueUtil.*;
 
 import java.util.*;
@@ -34,6 +34,7 @@
 import com.oracle.max.graal.compiler.alloc.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.ValueProcedure;
+import com.oracle.max.graal.compiler.lir.LIRPhiMapping.PhiValueProcedure;
 import com.oracle.max.graal.compiler.schedule.*;
 
 public class DataFlowAnalysis {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/LinearScanAllocator.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/LinearScanAllocator.java	Thu Feb 02 16:07:52 2012 -0800
@@ -39,30 +39,29 @@
 import com.oracle.max.graal.compiler.lir.LIRPhiMapping.PhiValueProcedure;
 import com.oracle.max.graal.compiler.schedule.*;
 import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.debug.*;
 
 public class LinearScanAllocator {
-    private final GraalContext context;
     private final LIR lir;
     private final FrameMap frameMap;
 
     private final DataFlowAnalysis dataFlow;
 
-    public LinearScanAllocator(GraalContext context, LIR lir, FrameMap frameMap) {
-        this.context = context;
+    public LinearScanAllocator(LIR lir, FrameMap frameMap) {
         this.lir = lir;
         this.frameMap = frameMap;
 
         this.dataFlow = new DataFlowAnalysis(lir, frameMap.registerConfig);
         this.blockBeginLocations = new LocationMap[lir.linearScanOrder().size()];
         this.blockEndLocations = new LocationMap[lir.linearScanOrder().size()];
-        this.moveResolver = new MoveResolverImpl(frameMap);
+        this.moveResolver = new MoveResolverImpl(lir, frameMap);
 
         this.variableLastUse = new int[lir.numVariables()];
     }
 
     private class MoveResolverImpl extends MoveResolver {
-        public MoveResolverImpl(FrameMap frameMap) {
-            super(frameMap);
+        public MoveResolverImpl(LIR lir, FrameMap frameMap) {
+            super(lir, frameMap);
         }
 
         @Override
@@ -159,23 +158,23 @@
         assert LIRVerifier.verify(true, lir, frameMap);
 
         dataFlow.execute();
-        IntervalPrinter.printBeforeAllocation("Before register allocation", context, lir, frameMap.registerConfig, dataFlow);
+        IntervalPrinter.printBeforeAllocation("Before register allocation", lir, frameMap.registerConfig, dataFlow);
 
         allocate();
 
-        IntervalPrinter.printAfterAllocation("After linear scan allocation", context, lir, frameMap.registerConfig, dataFlow, blockEndLocations);
+        IntervalPrinter.printAfterAllocation("After linear scan allocation", lir, frameMap.registerConfig, dataFlow, blockEndLocations);
 
         ResolveDataFlow resolveDataFlow = new ResolveDataFlowImpl(lir, moveResolver, dataFlow);
         resolveDataFlow.execute();
         frameMap.finish();
 
-        IntervalPrinter.printAfterAllocation("After resolve data flow", context, lir, frameMap.registerConfig, dataFlow, blockEndLocations);
+        IntervalPrinter.printAfterAllocation("After resolve data flow", lir, frameMap.registerConfig, dataFlow, blockEndLocations);
         assert RegisterVerifier.verify(lir, frameMap);
 
         AssignRegisters assignRegisters = new AssignRegistersImpl(lir, frameMap);
         assignRegisters.execute();
 
-        context.observable.fireCompilationEvent("After register asignment", lir);
+        Debug.dump(lir, "After register asignment");
         assert LIRVerifier.verify(false, lir, frameMap);
     }
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/ResolveDataFlow.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/ResolveDataFlow.java	Thu Feb 02 16:07:52 2012 -0800
@@ -104,7 +104,7 @@
         if (fromBlock.numberOfSux() == 1) {
             List<LIRInstruction> instructions = fromBlock.lir();
             LIRInstruction instr = instructions.get(instructions.size() - 1);
-            assert instr instanceof LIRBranch && instr.code == StandardOpcode.JUMP : "block does not end with an unconditional jump";
+            assert instr instanceof StandardOp.JumpOp : "block does not end with an unconditional jump";
             moveResolver.init(instructions, instructions.size() - 1);
             assert trace("  insert at end of %s before %d", fromBlock, instructions.size() - 1);
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/SpillAllAllocator.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/SpillAllAllocator.java	Thu Feb 02 16:07:52 2012 -0800
@@ -39,27 +39,26 @@
 import com.oracle.max.graal.compiler.lir.LIRPhiMapping.PhiValueProcedure;
 import com.oracle.max.graal.compiler.schedule.*;
 import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.debug.*;
 
 public class SpillAllAllocator {
-    private final GraalContext context;
     private final LIR lir;
     private final FrameMap frameMap;
 
     private final DataFlowAnalysis dataFlow;
 
-    public SpillAllAllocator(GraalContext context, LIR lir, FrameMap frameMap) {
-        this.context = context;
+    public SpillAllAllocator(LIR lir, FrameMap frameMap) {
         this.lir = lir;
         this.frameMap = frameMap;
 
         this.dataFlow = new DataFlowAnalysis(lir, frameMap.registerConfig);
         this.blockLocations = new LocationMap[lir.linearScanOrder().size()];
-        this.moveResolver = new MoveResolverImpl(frameMap);
+        this.moveResolver = new MoveResolverImpl(lir, frameMap);
     }
 
     private class MoveResolverImpl extends MoveResolver {
-        public MoveResolverImpl(FrameMap frameMap) {
-            super(frameMap);
+        public MoveResolverImpl(LIR lir, FrameMap frameMap) {
+            super(lir, frameMap);
         }
 
         @Override
@@ -134,23 +133,23 @@
         assert LIRVerifier.verify(true, lir, frameMap);
 
         dataFlow.execute();
-        IntervalPrinter.printBeforeAllocation("Before register allocation", context, lir, frameMap.registerConfig, dataFlow);
+        IntervalPrinter.printBeforeAllocation("Before register allocation", lir, frameMap.registerConfig, dataFlow);
 
         allocate();
 
-        IntervalPrinter.printAfterAllocation("After spill all allocation", context, lir, frameMap.registerConfig, dataFlow, blockLocations);
+        IntervalPrinter.printAfterAllocation("After spill all allocation", lir, frameMap.registerConfig, dataFlow, blockLocations);
 
         ResolveDataFlow resolveDataFlow = new ResolveDataFlowImpl(lir, moveResolver, dataFlow);
         resolveDataFlow.execute();
         frameMap.finish();
 
-        IntervalPrinter.printAfterAllocation("After resolve data flow", context, lir, frameMap.registerConfig, dataFlow, blockLocations);
+        IntervalPrinter.printAfterAllocation("After resolve data flow", lir, frameMap.registerConfig, dataFlow, blockLocations);
         assert RegisterVerifier.verify(lir, frameMap);
 
         AssignRegisters assignRegisters = new AssignRegistersImpl(lir, frameMap);
         assignRegisters.execute();
 
-        context.observable.fireCompilationEvent("After register asignment", lir);
+        Debug.dump(lir, "After register asignment");
         assert LIRVerifier.verify(false, lir, frameMap);
     }
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/IntervalPrinter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/IntervalPrinter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -30,7 +30,6 @@
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
 import com.oracle.max.graal.alloc.simple.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandFlag;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandMode;
@@ -39,18 +38,22 @@
 
 public final class IntervalPrinter {
 
-    public static void printBeforeAllocation(String label, GraalContext context, LIR lir, RiRegisterConfig registerConfig, DataFlowAnalysis dataFlow) {
-        if (context.isObserved()) {
-            IntervalPrinter printer = new IntervalPrinter(lir, registerConfig, dataFlow, null);
-            context.observable.fireCompilationEvent(label, lir, printer.execute());
-        }
+    @SuppressWarnings("unused")
+    public static void printBeforeAllocation(String label, LIR lir, RiRegisterConfig registerConfig, DataFlowAnalysis dataFlow) {
+        // TODO(tw): Fix printing.
+//        if (context.isObserved()) {
+//            IntervalPrinter printer = new IntervalPrinter(lir, registerConfig, dataFlow, null);
+//            context.observable.fireCompilationEvent(label, lir, printer.execute());
+//        }
     }
 
-    public static void printAfterAllocation(String label, GraalContext context, LIR lir, RiRegisterConfig registerConfig, DataFlowAnalysis dataFlow, LocationMap[] blockEndLocations) {
-        if (context.isObserved()) {
-            IntervalPrinter printer = new IntervalPrinter(lir, registerConfig, dataFlow, blockEndLocations);
-            context.observable.fireCompilationEvent(label, lir, printer.execute());
-        }
+    @SuppressWarnings("unused")
+    public static void printAfterAllocation(String label, LIR lir, RiRegisterConfig registerConfig, DataFlowAnalysis dataFlow, LocationMap[] blockEndLocations) {
+        // TODO(tw): Fix printing.
+//        if (context.isObserved()) {
+//            IntervalPrinter printer = new IntervalPrinter(lir, registerConfig, dataFlow, blockEndLocations);
+//            context.observable.fireCompilationEvent(label, lir, printer.execute());
+//        }
     }
 
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LIRVerifier.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 2009, 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.alloc.util;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandFlag;
-import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandMode;
-import com.oracle.max.graal.compiler.lir.LIRInstruction.ValueProcedure;
-import com.oracle.max.graal.compiler.lir.LIRPhiMapping.PhiValueProcedure;
-import com.oracle.max.graal.compiler.schedule.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public final class LIRVerifier {
-    private final LIR lir;
-    private final FrameMap frameMap;
-
-    private final boolean beforeRegisterAllocation;
-
-    private final BitSet[] blockLiveOut;
-    private final Object[] variableDefinitions;
-
-    private BitSet liveOutFor(Block block) {
-        return blockLiveOut[block.blockID()];
-    }
-    private void setLiveOutFor(Block block, BitSet liveOut) {
-        blockLiveOut[block.blockID()] = liveOut;
-    }
-
-    private int maxRegisterNum() {
-        return frameMap.target.arch.registers.length;
-    }
-
-    private boolean isAllocatableRegister(CiValue value) {
-        return isRegister(value) && frameMap.registerConfig.getAttributesMap()[asRegister(value).number].isAllocatable;
-    }
-
-    public static boolean verify(final LIRInstruction op) {
-        ValueProcedure allowedProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) { return allowed(op, value, mode, flags); } };
-
-        op.forEachInput(allowedProc);
-        op.forEachAlive(allowedProc);
-        op.forEachState(allowedProc);
-        op.forEachTemp(allowedProc);
-        op.forEachOutput(allowedProc);
-        return true;
-    }
-
-    public static boolean verify(boolean beforeRegisterAllocation, LIR lir, FrameMap frameMap) {
-        LIRVerifier verifier = new LIRVerifier(beforeRegisterAllocation, lir, frameMap);
-        verifier.verify();
-        return true;
-    }
-
-
-    private LIRVerifier(boolean beforeRegisterAllocation, LIR lir, FrameMap frameMap) {
-        this.beforeRegisterAllocation = beforeRegisterAllocation;
-        this.lir = lir;
-        this.frameMap = frameMap;
-        this.blockLiveOut = new BitSet[lir.linearScanOrder().size()];
-        this.variableDefinitions = new Object[lir.numVariables()];
-    }
-
-    private BitSet curVariablesLive;
-    private CiValue[] curRegistersLive;
-
-    private LIRBlock curBlock;
-    private Object curInstruction;
-    private BitSet curRegistersDefined;
-
-    private void verify() {
-        PhiValueProcedure useProc = new PhiValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) { return use(value, mode, flags); } };
-        ValueProcedure defProc =    new ValueProcedure() {    @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) { return def(value, mode, flags); } };
-
-        curRegistersDefined = new BitSet();
-        for (LIRBlock block : lir.linearScanOrder()) {
-            curBlock = block;
-            curVariablesLive = new BitSet();
-            curRegistersLive = new CiValue[maxRegisterNum()];
-
-            if (block.dominator() != null) {
-                curVariablesLive.or(liveOutFor(block.dominator()));
-            }
-
-            if (block.phis != null) {
-                assert beforeRegisterAllocation;
-                curInstruction = block.phis;
-                block.phis.forEachOutput(defProc);
-            }
-
-            for (LIRInstruction op : block.lir()) {
-                curInstruction = op;
-
-                op.forEachInput(useProc);
-                if (op.hasCall()) {
-                    for (CiRegister register : frameMap.registerConfig.getCallerSaveRegisters()) {
-                        curRegistersLive[register.number] = null;
-                    }
-                }
-                curRegistersDefined.clear();
-                op.forEachAlive(useProc);
-                op.forEachState(useProc);
-                op.forEachTemp(defProc);
-                op.forEachOutput(defProc);
-
-                curInstruction = null;
-            }
-
-            for (LIRBlock sux : block.getLIRSuccessors()) {
-                if (sux.phis != null) {
-                    assert beforeRegisterAllocation;
-                    curInstruction = sux.phis;
-                    sux.phis.forEachInput(block, useProc);
-                }
-            }
-
-            setLiveOutFor(block, curVariablesLive);
-        }
-    }
-
-    private CiValue use(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) {
-        allowed(curInstruction, value, mode, flags);
-
-        if (isVariable(value)) {
-            assert beforeRegisterAllocation;
-
-            int variableIdx = asVariable(value).index;
-            if (!curVariablesLive.get(variableIdx)) {
-                TTY.println("block %s  instruction %s", curBlock, curInstruction);
-                TTY.println("live variables: %s", curVariablesLive);
-                if (variableDefinitions[variableIdx] != null) {
-                    TTY.println("definition of %s: %s", value, variableDefinitions[variableIdx]);
-                }
-                TTY.println("ERROR: Use of variable %s that is not defined in dominator", value);
-                throw Util.shouldNotReachHere();
-            }
-
-        } else if (isAllocatableRegister(value)) {
-            int regNum = asRegister(value).number;
-            if (mode == OperandMode.Alive) {
-                curRegistersDefined.set(regNum);
-            }
-
-            if (beforeRegisterAllocation && curRegistersLive[regNum] != value) {
-                TTY.println("block %s  instruction %s", curBlock, curInstruction);
-                TTY.println("live registers: %s", Arrays.toString(curRegistersLive));
-                TTY.println("ERROR: Use of fixed register %s that is not defined in this block", value);
-                throw Util.shouldNotReachHere();
-            }
-        }
-        return value;
-    }
-
-    private CiValue def(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) {
-        allowed(curInstruction, value, mode, flags);
-
-        if (isVariable(value)) {
-            assert beforeRegisterAllocation;
-
-            int variableIdx = asVariable(value).index;
-            if (variableDefinitions[variableIdx] != null) {
-                TTY.println("block %s  instruction %s", curBlock, curInstruction);
-                TTY.println("live variables: %s", curVariablesLive);
-                TTY.println("definition of %s: %s", value, variableDefinitions[variableIdx]);
-                TTY.println("ERROR: Variable %s defined multiple times", value);
-                throw Util.shouldNotReachHere();
-            }
-            assert curInstruction != null;
-            variableDefinitions[variableIdx] = curInstruction;
-            assert !curVariablesLive.get(variableIdx);
-            if (mode == OperandMode.Output) {
-                curVariablesLive.set(variableIdx);
-            }
-
-        } else if (isAllocatableRegister(value)) {
-            int regNum = asRegister(value).number;
-            if (curRegistersDefined.get(regNum)) {
-                TTY.println("block %s  instruction %s", curBlock, curInstruction);
-                TTY.println("ERROR: Same register defined twice in the same instruction: %s", value);
-                throw Util.shouldNotReachHere();
-            }
-            curRegistersDefined.set(regNum);
-
-            if (beforeRegisterAllocation) {
-                if (mode == OperandMode.Output) {
-                    curRegistersLive[regNum] = value;
-                } else {
-                    curRegistersLive[regNum] = null;
-                }
-            }
-        }
-        return value;
-    }
-
-    private static CiValue allowed(Object op, CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) {
-        if ((isVariable(value)  && flags.contains(OperandFlag.Register)) ||
-            (isRegister(value)  && flags.contains(OperandFlag.Register)) ||
-            (isStackSlot(value) && flags.contains(OperandFlag.Stack)) ||
-            (isConstant(value)  && flags.contains(OperandFlag.Constant) && mode != OperandMode.Output) ||
-            (isIllegal(value)   && flags.contains(OperandFlag.Illegal))) {
-            return value;
-        }
-        TTY.println("instruction %s", op);
-        TTY.println("mode: %s  flags: %s", mode, flags);
-        TTY.println("Unexpected value: %s %s", value.getClass().getSimpleName(), value);
-        throw Util.shouldNotReachHere();
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/MoveResolver.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/MoveResolver.java	Thu Feb 02 16:07:52 2012 -0800
@@ -34,6 +34,7 @@
 import com.oracle.max.graal.compiler.util.*;
 
 public abstract class MoveResolver {
+    private final LIR lir;
     private final FrameMap frameMap;
     private final int[] registersBlocked;
     private final Map<CiValue, Integer> valuesBlocked;
@@ -42,7 +43,8 @@
     private final LIRInsertionBuffer insertionBuffer;
     private int insertPos;
 
-    public MoveResolver(FrameMap frameMap) {
+    public MoveResolver(LIR lir, FrameMap frameMap) {
+        this.lir = lir;
         this.frameMap = frameMap;
 
         registersBlocked = new int[frameMap.target.arch.registers.length];
@@ -292,7 +294,7 @@
 
         } else {
             assert trace("mr      MOV %s -> %s", src, dst);
-            insertionBuffer.append(insertPos, StandardOpcode.SPILL_MOVE.create(dst,  src));
+            insertionBuffer.append(insertPos, lir.spillMoveFactory.createMove(dst,  src));
         }
     }
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/RegisterVerifier.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/RegisterVerifier.java	Thu Feb 02 16:07:52 2012 -0800
@@ -203,14 +203,18 @@
     }
 
     private CiValue temp(CiValue value) {
-        assert trace("    temp %s -> remove key %s", value, key(value));
-        curInputState.remove(key(value));
+        if (!isConstant(value) && value != CiValue.IllegalValue && !isIgnoredRegister(value)) {
+            assert trace("    temp %s -> remove key %s", value, key(value));
+            curInputState.remove(key(value));
+        }
         return value;
     }
 
     private CiValue output(CiValue value) {
-        assert trace("    output %s -> set key %s", value, key(value));
-        curInputState.put(key(value), value);
+        if (value != CiValue.IllegalValue && !isIgnoredRegister(value)) {
+            assert trace("    output %s -> set key %s", value, key(value));
+            curInputState.put(key(value), value);
+        }
         return value;
     }
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,6 +23,7 @@
 package com.oracle.max.graal.compiler;
 
 import java.util.*;
+import java.util.concurrent.*;
 
 import com.oracle.max.asm.*;
 import com.oracle.max.cri.ci.*;
@@ -34,19 +35,17 @@
 import com.oracle.max.graal.compiler.asm.*;
 import com.oracle.max.graal.compiler.gen.*;
 import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.observer.*;
 import com.oracle.max.graal.compiler.phases.*;
 import com.oracle.max.graal.compiler.phases.PhasePlan.PhasePosition;
 import com.oracle.max.graal.compiler.schedule.*;
 import com.oracle.max.graal.compiler.target.*;
 import com.oracle.max.graal.cri.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 
 public class GraalCompiler {
 
-    public final GraalContext context;
-
     /**
      * The target that this compiler has been configured for.
      */
@@ -67,8 +66,7 @@
      */
     public final Backend backend;
 
-    public GraalCompiler(GraalContext context, GraalRuntime runtime, CiTarget target, Backend backend, RiXirGenerator xirGen) {
-        this.context = context;
+    public GraalCompiler(GraalRuntime runtime, CiTarget target, Backend backend, RiXirGenerator xirGen) {
         this.runtime = runtime;
         this.target = target;
         this.xir = xirGen;
@@ -79,182 +77,134 @@
         return compileMethod(method, new StructuredGraph(method), osrBCI, plan);
     }
 
-    public CiTargetMethod compileMethod(RiResolvedMethod method, StructuredGraph graph, int osrBCI, PhasePlan plan) {
+    public CiTargetMethod compileMethod(final RiResolvedMethod method, final StructuredGraph graph, int osrBCI, final PhasePlan plan) {
         if (osrBCI != -1) {
             throw new CiBailout("No OSR supported");
         }
-        context.timers.startScope(getClass());
-        try {
-            long startTime = 0;
-            int index = context.metrics.CompiledMethods++;
-            final boolean printCompilation = GraalOptions.PrintCompilation && !TTY.isSuppressed();
-            if (printCompilation) {
-                TTY.println(String.format("Graal %4d %-70s %-45s %-50s ...",
-                                index,
-                                method.holder().name(),
-                                method.name(),
-                                method.signature().asString()));
-                startTime = System.nanoTime();
-            }
-            TTY.Filter filter = new TTY.Filter(GraalOptions.PrintFilter, method);
-
-            CiTargetMethod result = null;
-            context.observable.fireCompilationStarted(runtime, target, method);
-            try {
-                try {
-                    CiAssumptions assumptions = GraalOptions.OptAssumptions ? new CiAssumptions() : null;
-                    LIR lir = emitHIR(graph, assumptions, plan);
-                    FrameMap frameMap = emitLIR(lir, graph, method);
-                    result = emitCode(assumptions, method, lir, frameMap);
-
-                    if (GraalOptions.Meter) {
-                        context.metrics.BytecodesCompiled += method.codeSize();
+        return Debug.scope(createScopeName(method), method, new Callable<CiTargetMethod>() {
+            public CiTargetMethod call() {
+                final CiAssumptions assumptions = GraalOptions.OptAssumptions ? new CiAssumptions() : null;
+                final LIR lir = Debug.scope("FrontEnd", graph, new Callable<LIR>() {
+                    public LIR call() {
+                        return emitHIR(graph, assumptions, plan);
+                    }
+                });
+                final FrameMap frameMap = Debug.scope("BackEnd", lir, new Callable<FrameMap>() {
+                    public FrameMap call() {
+                        return emitLIR(lir, graph, method);
+                    }
+                });
+                return Debug.scope("CodeGen", frameMap, new Callable<CiTargetMethod>() {
+                    public CiTargetMethod call() {
+                        return emitCode(assumptions, method, lir, frameMap);
                     }
-                } catch (CiBailout | GraalInternalError exception) {
-                    throw exception;
-                } catch (Throwable t) {
-                    throw new GraalInternalError(t);
-                }
-            } catch (GraalInternalError error) {
-                error.addContext("method", CiUtil.format("%H.%n(%p):%r", method));
-                if (context.isObserved()) {
-                    if (error.node() != null) {
-                        context.observable.fireCompilationEvent("VerificationError on Node " + error.node(), CompilationEvent.ERROR, this, error.node().graph());
-                    } else if (error.graph() != null) {
-                        context.observable.fireCompilationEvent("VerificationError on Graph " + error.graph(), CompilationEvent.ERROR, this, error.graph());
-                    }
-                }
-                throw error;
-            } finally {
-                context.observable.fireCompilationFinished(runtime, target, method);
-                filter.remove();
-                if (printCompilation) {
-                    long time = (System.nanoTime() - startTime) / 100000;
-                    TTY.println(String.format("Graal %4d %-70s %-45s %-50s | %3d.%dms %4dnodes %5dB",
-                                    index,
-                                    "",
-                                    "",
-                                    "",
-                                    time / 10,
-                                    time % 10,
-                                    graph.getNodeCount(),
-                                    (result != null ? result.targetCodeSize() : -1)));
-                }
+                });
             }
+        });
+    }
 
-            return result;
-        } finally {
-            context.timers.endScope();
+    private static String createScopeName(RiResolvedMethod method) {
+        if (Debug.isEnabled()) {
+            return String.format("[%s::%s]", createSimpleName(method.holder()), method.name());
+        } else {
+            return null;
         }
     }
 
+    private static String createSimpleName(RiResolvedType holder) {
+        String base = holder.name();
+        int slashIndex = base.lastIndexOf('/');
+        if (slashIndex == -1) {
+            slashIndex = 0;
+        }
+        return base.substring(slashIndex + 1, base.length() - 1);
+    }
+
     /**
      * Builds the graph, optimizes it.
      */
     public LIR emitHIR(StructuredGraph graph, CiAssumptions assumptions, PhasePlan plan) {
-        try {
-            context.timers.startScope("HIR");
+
+        if (graph.start().next() == null) {
+            plan.runPhases(PhasePosition.AFTER_PARSING, graph);
+            new DeadCodeEliminationPhase().apply(graph);
+        } else {
+            Debug.dump(graph, "initial state");
+        }
+
+        new PhiStampPhase().apply(graph);
 
-            if (graph.start().next() == null) {
-                plan.runPhases(PhasePosition.AFTER_PARSING, graph, context);
-                new DeadCodeEliminationPhase().apply(graph, context);
-            } else {
-                if (context.isObserved()) {
-                    context.observable.fireCompilationEvent("initial state", graph);
-                }
-            }
+        if (GraalOptions.ProbabilityAnalysis && graph.start().probability() == 0) {
+            new ComputeProbabilityPhase().apply(graph);
+        }
 
-            new PhiStampPhase().apply(graph);
+        if (GraalOptions.Intrinsify) {
+            new IntrinsificationPhase(runtime).apply(graph);
+        }
 
-            if (GraalOptions.ProbabilityAnalysis && graph.start().probability() == 0) {
-                new ComputeProbabilityPhase().apply(graph, context);
-            }
-
-            if (GraalOptions.Intrinsify) {
-                new IntrinsificationPhase(runtime).apply(graph, context);
-            }
+        if (GraalOptions.Inline && !plan.isPhaseDisabled(InliningPhase.class)) {
+            new InliningPhase(target, runtime, null, assumptions, plan).apply(graph);
+            new DeadCodeEliminationPhase().apply(graph);
+            new PhiStampPhase().apply(graph);
+        }
 
-            if (GraalOptions.Inline && !plan.isPhaseDisabled(InliningPhase.class)) {
-                new InliningPhase(target, runtime, null, assumptions, plan).apply(graph, context);
-                new DeadCodeEliminationPhase().apply(graph, context);
-                new PhiStampPhase().apply(graph);
-            }
+        if (GraalOptions.OptCanonicalizer) {
+            new CanonicalizerPhase(target, runtime, assumptions).apply(graph);
+        }
 
-            if (GraalOptions.OptCanonicalizer) {
-                new CanonicalizerPhase(target, runtime, assumptions).apply(graph, context);
-            }
+        plan.runPhases(PhasePosition.HIGH_LEVEL, graph);
 
-            plan.runPhases(PhasePosition.HIGH_LEVEL, graph, context);
+        if (GraalOptions.OptLoops) {
+            new SafepointPollingEliminationPhase().apply(graph);
+        }
 
-            if (GraalOptions.OptLoops) {
-                graph.mark();
-                new FindInductionVariablesPhase().apply(graph, context);
-                if (GraalOptions.OptCanonicalizer) {
-                    new CanonicalizerPhase(target, runtime, true, assumptions).apply(graph, context);
-                }
-                new SafepointPollingEliminationPhase().apply(graph, context);
-            }
+        if (GraalOptions.EscapeAnalysis && !plan.isPhaseDisabled(EscapeAnalysisPhase.class)) {
+            new EscapeAnalysisPhase(target, runtime, assumptions, plan).apply(graph);
+            new PhiStampPhase().apply(graph);
+            new CanonicalizerPhase(target, runtime, assumptions).apply(graph);
+        }
 
-            if (GraalOptions.EscapeAnalysis && !plan.isPhaseDisabled(EscapeAnalysisPhase.class)) {
-                new EscapeAnalysisPhase(target, runtime, assumptions, plan).apply(graph, context);
-                new PhiStampPhase().apply(graph);
-                new CanonicalizerPhase(target, runtime, assumptions).apply(graph, context);
-            }
+        if (GraalOptions.OptGVN) {
+            new GlobalValueNumberingPhase().apply(graph);
+        }
 
+        graph.mark();
+        new LoweringPhase(runtime).apply(graph);
+        new CanonicalizerPhase(target, runtime, true, assumptions).apply(graph);
+
+        if (GraalOptions.Lower) {
+            new FloatingReadPhase().apply(graph);
             if (GraalOptions.OptGVN) {
-                new GlobalValueNumberingPhase().apply(graph, context);
+                new GlobalValueNumberingPhase().apply(graph);
             }
-
-            graph.mark();
-            new LoweringPhase(runtime).apply(graph, context);
-            new CanonicalizerPhase(target, runtime, true, assumptions).apply(graph, context);
-
-            if (GraalOptions.OptLoops) {
-                graph.mark();
-                new RemoveInductionVariablesPhase().apply(graph, context);
-                if (GraalOptions.OptCanonicalizer) {
-                    new CanonicalizerPhase(target, runtime, true, assumptions).apply(graph, context);
-                }
-            }
-
-            if (GraalOptions.Lower) {
-                new FloatingReadPhase().apply(graph, context);
-
-                if (GraalOptions.OptGVN) {
-                    new GlobalValueNumberingPhase().apply(graph, context);
-                }
-
-                if (GraalOptions.OptReadElimination) {
-                    new ReadEliminationPhase().apply(graph, context);
-                }
+            if (GraalOptions.OptReadElimination) {
+                new ReadEliminationPhase().apply(graph);
             }
-            new RemovePlaceholderPhase().apply(graph, context);
-            new DeadCodeEliminationPhase().apply(graph, context);
+        }
+        new DeadCodeEliminationPhase().apply(graph);
 
-            plan.runPhases(PhasePosition.MID_LEVEL, graph, context);
-
-            plan.runPhases(PhasePosition.LOW_LEVEL, graph, context);
+        plan.runPhases(PhasePosition.MID_LEVEL, graph);
 
-            IdentifyBlocksPhase schedule = new IdentifyBlocksPhase(true, LIRBlock.FACTORY);
-            schedule.apply(graph, context);
+        plan.runPhases(PhasePosition.LOW_LEVEL, graph);
 
-            if (context.isObserved()) {
-                context.observable.fireCompilationEvent("After IdentifyBlocksPhase", graph, schedule);
-            }
+        final IdentifyBlocksPhase schedule = new IdentifyBlocksPhase(true, LIRBlock.FACTORY);
+        schedule.apply(graph);
 
-            List<Block> blocks = schedule.getBlocks();
-            NodeMap<LIRBlock> valueToBlock = new NodeMap<>(graph);
-            for (Block b : blocks) {
-                for (Node i : b.getInstructions()) {
-                    valueToBlock.set(i, (LIRBlock) b);
-                }
+        final List<Block> blocks = schedule.getBlocks();
+        final NodeMap<LIRBlock> valueToBlock = new NodeMap<>(graph);
+        for (Block b : blocks) {
+            for (Node i : b.getInstructions()) {
+                valueToBlock.set(i, (LIRBlock) b);
             }
-            LIRBlock startBlock = valueToBlock.get(graph.start());
-            assert startBlock != null;
-            assert startBlock.numberOfPreds() == 0;
+        }
+        final LIRBlock startBlock = valueToBlock.get(graph.start());
+        assert startBlock != null;
+        assert startBlock.numberOfPreds() == 0;
 
-            context.timers.startScope("Compute Linear Scan Order");
-            try {
+        return Debug.scope("Compute Linear Scan Order", new Callable<LIR>() {
+
+            @Override
+            public LIR call() {
                 ComputeLinearScanOrder clso = new ComputeLinearScanOrder(blocks.size(), schedule.loopCount(), startBlock);
                 List<LIRBlock> linearScanOrder = clso.linearScanOrder();
                 List<LIRBlock> codeEmittingOrder = clso.codeEmittingOrder();
@@ -265,111 +215,67 @@
                 }
 
                 LIR lir = new LIR(startBlock, linearScanOrder, codeEmittingOrder, valueToBlock, schedule.loopCount());
-
-                if (context.isObserved()) {
-                    context.observable.fireCompilationEvent("After linear scan order", graph, lir);
-                }
+                Debug.dump(lir, "After linear scan order");
                 return lir;
-            } catch (AssertionError t) {
-                    context.observable.fireCompilationEvent("AssertionError in ComputeLinearScanOrder", CompilationEvent.ERROR, graph);
-                throw t;
-            } catch (RuntimeException t) {
-                    context.observable.fireCompilationEvent("RuntimeException in ComputeLinearScanOrder", CompilationEvent.ERROR, graph);
-                throw t;
-            } finally {
-                context.timers.endScope();
+
             }
-        } finally {
-            context.timers.endScope();
-        }
+        });
     }
 
-    public FrameMap emitLIR(LIR lir, StructuredGraph graph, RiResolvedMethod method) {
-        context.timers.startScope("LIR");
-        try {
-            if (GraalOptions.GenLIR) {
-                context.timers.startScope("Create LIR");
-                LIRGenerator lirGenerator = null;
-                FrameMap frameMap;
-                try {
-                    frameMap = backend.newFrameMap(runtime.getRegisterConfig(method));
-
-                    lirGenerator = backend.newLIRGenerator(context, graph, frameMap, method, lir, xir);
+    public FrameMap emitLIR(final LIR lir, StructuredGraph graph, final RiResolvedMethod method) {
+        final FrameMap frameMap = backend.newFrameMap(runtime.getRegisterConfig(method));
+        final LIRGenerator lirGenerator = backend.newLIRGenerator(graph, frameMap, method, lir, xir);
 
-                    for (LIRBlock b : lir.linearScanOrder()) {
-                        lirGenerator.doBlock(b);
-                    }
-
-                    for (LIRBlock b : lir.linearScanOrder()) {
-                        if (b.phis != null) {
-                            b.phis.fillInputs(lirGenerator);
-                        }
-                    }
-                } finally {
-                    context.timers.endScope();
+        Debug.scope("LIRGen", new Runnable() {
+            public void run() {
+                for (LIRBlock b : lir.linearScanOrder()) {
+                    lirGenerator.doBlock(b);
                 }
 
-                if (context.isObserved()) {
-                    context.observable.fireCompilationEvent("After LIR generation", graph, lir, lirGenerator);
+                for (LIRBlock b : lir.linearScanOrder()) {
+                    if (b.phis != null) {
+                        b.phis.fillInputs(lirGenerator);
+                    }
                 }
+
+                Debug.dump(lirGenerator, "After LIR generation");
                 if (GraalOptions.PrintLIR && !TTY.isSuppressed()) {
                     LIR.printLIR(lir.linearScanOrder());
                 }
-
-                if (GraalOptions.AllocSSA) {
-                    new LinearScanAllocator(context, lir, frameMap).execute();
-//                    new SpillAllAllocator(context, lir, frameMap).execute();
-                } else {
-                    new LinearScan(context, target, method, graph, lir, lirGenerator, frameMap).allocate();
-                }
-                return frameMap;
-            } else {
-                return null;
             }
-        } catch (Error e) {
-            if (context.isObserved() && GraalOptions.PlotOnError) {
-                context.observable.fireCompilationEvent(e.getClass().getSimpleName() + " in emitLIR", CompilationEvent.ERROR, graph);
+        });
+
+        Debug.scope("Allocator", new Runnable() {
+            public void run() {
+                if (GraalOptions.AllocSSA) {
+                    new LinearScanAllocator(lir, frameMap).execute();
+                    // new SpillAllAllocator(context, lir, frameMap).execute();
+                } else {
+                    new LinearScan(target, method, lir, lirGenerator, frameMap).allocate();
+                }
             }
-            throw e;
-        } catch (RuntimeException e) {
-            if (context.isObserved() && GraalOptions.PlotOnError) {
-                context.observable.fireCompilationEvent(e.getClass().getSimpleName() + " in emitLIR", CompilationEvent.ERROR, graph);
-            }
-            throw e;
-        } finally {
-            context.timers.endScope();
-        }
+        });
+        return frameMap;
     }
 
     private TargetMethodAssembler createAssembler(FrameMap frameMap, LIR lir) {
         AbstractAssembler masm = backend.newAssembler(frameMap.registerConfig);
-        TargetMethodAssembler tasm = new TargetMethodAssembler(context, target, runtime, frameMap, lir.slowPaths, masm);
+        TargetMethodAssembler tasm = new TargetMethodAssembler(target, runtime, frameMap, lir.slowPaths, masm);
         tasm.setFrameSize(frameMap.frameSize());
         tasm.targetMethod.setCustomStackAreaOffset(frameMap.offsetToCustomArea());
         return tasm;
     }
 
     public CiTargetMethod emitCode(CiAssumptions assumptions, RiResolvedMethod method, LIR lir, FrameMap frameMap) {
-        if (GraalOptions.GenLIR && GraalOptions.GenCode) {
-            context.timers.startScope("Create Code");
-            try {
-                TargetMethodAssembler tasm = createAssembler(frameMap, lir);
-                lir.emitCode(tasm);
+        TargetMethodAssembler tasm = createAssembler(frameMap, lir);
+        lir.emitCode(tasm);
 
-                CiTargetMethod targetMethod = tasm.finishTargetMethod(method, false);
-                if (assumptions != null && !assumptions.isEmpty()) {
-                    targetMethod.setAssumptions(assumptions);
-                }
-
-                if (context.isObserved()) {
-                    context.observable.fireCompilationEvent("After code generation", lir, targetMethod);
-                }
-                return targetMethod;
-            } finally {
-                context.timers.endScope();
-            }
+        CiTargetMethod targetMethod = tasm.finishTargetMethod(method, false);
+        if (assumptions != null && !assumptions.isEmpty()) {
+            targetMethod.setAssumptions(assumptions);
         }
 
-        return null;
+        Debug.dump(targetMethod, "After code generation");
+        return targetMethod;
     }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalContext.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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;
-
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.observer.*;
-
-/**
- * This class is intended for non-essential stuff like statistics, observing, etc. It should not be used for anything
- * that has a direct influence on the result of a compilation!
- */
-public class GraalContext {
-
-    public static final GraalContext EMPTY_CONTEXT = new GraalContext("silent context");
-
-    public final ObservableContext observable = new ObservableContext();
-    public final GraalTimers timers = new GraalTimers();
-    public final GraalMetrics metrics = new GraalMetrics();
-
-    private final String name;
-
-    public GraalContext(String name) {
-        this.name = name;
-    }
-
-    public boolean isObserved() {
-        return observable.isObserved();
-    }
-
-    public void addCompilationObserver(CompilationObserver observer) {
-        observable.addCompilationObserver(observer);
-    }
-
-    public void print() {
-        if (GraalOptions.Meter || GraalOptions.Time) {
-            for (int i = 0; i < 22 + name.length(); i++) {
-                TTY.print('=');
-            }
-            TTY.println("\n========== " + name + " ==========");
-            if (GraalOptions.Meter) {
-                metrics.print();
-            }
-            if (GraalOptions.Time) {
-                timers.print();
-            }
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalMetrics.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 2009, 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;
-
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.Map.Entry;
-
-import com.oracle.max.criutils.*;
-
-
-/**
- * This class contains a number of fields that collect metrics about compilation, particularly
- * the number of times certain optimizations are performed.
- */
-public final class GraalMetrics {
-    // Checkstyle: stop
-    public int CompiledMethods;
-    public int TargetMethods;
-    public int LocalValueNumberHits;
-    public int ValueMapResizes;
-    public int InlinedFinalizerChecks;
-    public int InlineForcedMethods;
-    public int InlineForbiddenMethods;
-    public int InlineConsidered;
-    public int InlinePerformed;
-    public int InlineUncompiledConsidered;
-    public int InlineUncompiledPerformed;
-    public int BlocksDeleted;
-    public int BytecodesCompiled;
-    public int CodeBytesEmitted;
-    public int SafepointsEmitted;
-    public int ExceptionHandlersEmitted;
-    public int DataPatches;
-    public int DirectCallSitesEmitted;
-    public int IndirectCallSitesEmitted;
-    public int LiveHIRInstructions;
-    public int LIRInstructions;
-    public int LIRVariables;
-    public int LIRXIRInstructions;
-    public int LIRMoveInstructions;
-    public int LSRAIntervalsCreated;
-    public int LSRASpills;
-    public int LoadConstantIterations;
-    public int CodeBufferCopies;
-    public int UniqueValueIdsAssigned;
-    public int FrameStatesCreated;
-    public int FrameStateValuesCreated;
-    public int LoopsPeeled;
-    public int LoopsInverted;
-    public int PartialUsageProbability;
-    public int FullUsageProbability;
-    public int Rematerializations;
-    public int GlobalValueNumberingHits;
-    public int ExplicitExceptions;
-    public int GuardsHoisted;
-
-
-
-    /**
-     * The total number of bytes of bytecode parsed during this compilation, including any inlined methods.
-     */
-    public int bytecodeCount;
-
-    /**
-     * The number of internal graph nodes created during this compilation.
-     */
-    public int nodeCount;
-
-    /**
-     * The number of basic blocks created during this compilation.
-     */
-    public int blockCount;
-
-    /**
-     * The number of loops in the compiled method.
-     */
-    public int loopCount;
-
-    /**
-     * The number of methods inlined.
-     */
-    public int inlineCount;
-
-    /**
-     * The number of methods folded (i.e. evaluated).
-     */
-    public int foldCount;
-
-    /**
-     * The number of intrinsics inlined in this compilation.
-     */
-    public int intrinsicCount;
-
-
-    // Checkstyle: resume
-
-    public void print() {
-        for (Entry<String, MetricsEntry> m : map.entrySet()) {
-            printField(m.getKey(), m.getValue().value);
-        }
-        printFields(GraalMetrics.class);
-    }
-
-    public static class MetricsEntry {
-        public int value;
-
-        public void increment() {
-            increment(1);
-        }
-
-        public void increment(int val) {
-            value += val;
-        }
-    }
-
-    private LinkedHashMap<String, MetricsEntry> map = new LinkedHashMap<>();
-
-    public MetricsEntry get(String name) {
-        if (!map.containsKey(name)) {
-            map.put(name, new MetricsEntry());
-        }
-        return map.get(name);
-    }
-
-    public void printFields(Class<?> javaClass) {
-        final String className = javaClass.getSimpleName();
-        TTY.println(className + " {");
-        for (final Field field : javaClass.getFields()) {
-            printField(field, false);
-        }
-        TTY.println("}");
-    }
-
-    public void printField(final Field field, boolean tabbed) {
-        final String fieldName = String.format("%35s", field.getName());
-        try {
-            String prefix = tabbed ? "" : "    " + fieldName + " = ";
-            String postfix = tabbed ? "\t" : "\n";
-            if (field.getType() == int.class) {
-                TTY.print(prefix + field.getInt(this) + postfix);
-            } else if (field.getType() == boolean.class) {
-                TTY.print(prefix + field.getBoolean(this) + postfix);
-            } else if (field.getType() == float.class) {
-                TTY.print(prefix + field.getFloat(this) + postfix);
-            } else if (field.getType() == String.class) {
-                TTY.print(prefix + field.get(this) + postfix);
-            } else if (field.getType() == Map.class) {
-                Map<?, ?> m = (Map<?, ?>) field.get(this);
-                TTY.print(prefix + printMap(m) + postfix);
-            } else {
-                TTY.print(prefix + field.get(this) + postfix);
-            }
-        } catch (IllegalAccessException e) {
-            // do nothing.
-        }
-    }
-
-    private static String printMap(Map<?, ?> m) {
-        StringBuilder sb = new StringBuilder();
-
-        List<String> keys = new ArrayList<>();
-        for (Object key : m.keySet()) {
-            keys.add((String) key);
-        }
-        Collections.sort(keys);
-
-        for (String key : keys) {
-            sb.append(key);
-            sb.append("\t");
-            sb.append(m.get(key));
-            sb.append("\n");
-        }
-
-        return sb.toString();
-    }
-
-    private static void printField(String fieldName, long value) {
-        TTY.print("    " + fieldName + " = " + value + "\n");
-    }
-}
-
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java	Thu Feb 02 16:07:52 2012 -0800
@@ -83,21 +83,24 @@
     public static boolean PrintLIR                           = ____;
     public static boolean PrintCFGToFile                     = ____;
 
+    // Debug settings:
+    public static boolean Debug                              = true;
+    public static String Dump                                = null;
+    public static String Meter                               = null;
+    public static String Time                                = null;
+    public static String Log                                 = null;
+    public static String MethodFilter                        = null;
+
     // Ideal graph visualizer output settings
-    public static boolean Plot                               = ____;
-    public static boolean PlotVerbose                        = ____;
     public static boolean PlotOnError                        = ____;
     public static int     PlotLevel                          = 3;
     public static boolean PlotSnippets                       = ____;
-    public static boolean PrintIdealGraphBytecodes           = true;
     public static int     PrintIdealGraphLevel               = 0;
     public static boolean PrintIdealGraphFile                = ____;
     public static String  PrintIdealGraphAddress             = "127.0.0.1";
     public static int     PrintIdealGraphPort                = 4444;
 
     // Other printing settings
-    public static boolean Meter                              = ____;
-    public static boolean Time                               = ____;
     public static boolean PrintQueue                         = ____;
     public static boolean PrintCompilation                   = ____;
     public static boolean PrintXirTemplates                  = ____;
@@ -108,17 +111,7 @@
     public static int     TraceLinearScanLevel               = 0;
     public static boolean TraceRegisterAllocation            = false;
     public static int     TraceLIRGeneratorLevel             = 0;
-    public static boolean TraceRelocation                    = ____;
-    public static boolean TraceLIRVisit                      = ____;
-    public static boolean TraceAssembler                     = ____;
-    public static boolean TraceInlining                      = ____;
-    public static boolean TraceDeadCodeElimination           = ____;
     public static boolean TraceEscapeAnalysis                = ____;
-    public static boolean TraceCanonicalizer                 = ____;
-    public static boolean TraceMemoryMaps                    = ____;
-    public static boolean TraceProbability                   = ____;
-    public static boolean TraceReadElimination               = ____;
-    public static boolean TraceGVN                           = ____;
     public static int     TraceBytecodeParserLevel           = 0;
     public static boolean ExitVMOnBailout                    = ____;
     public static boolean ExitVMOnException                  = true;
@@ -127,10 +120,8 @@
     public static boolean AssumeVerifiedBytecode             = true;
 
     // Code generator settings
-    public static boolean GenLIR                             = true;
-    public static boolean GenCode                            = true;
     public static boolean UseBranchPrediction                = true;
-    public static boolean UseExceptionProbability            = ____;
+    public static boolean UseExceptionProbability            = true;
     public static boolean AllowExplicitExceptionChecks       = true;
     public static boolean OmitHotExceptionStacktrace         = ____;
     public static int     MatureInvocationCount              = 100;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalTimers.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2009, 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;
-
-import java.util.*;
-
-import com.oracle.max.criutils.*;
-
-/**
- * This class contains timers that record the amount of time spent in various parts of the compiler. It builds a
- * hierarchical and a flat representation of the timing. In order to reliably create the hierarchy the following code
- * pattern should be used:
- *
- * <pre>
- * GraalTimers.startScope("name");
- * try {
- *      ...
- * } finally {
- *      GraalTimers.endScope();
- * }
- * </pre>
- */
-public final class GraalTimers {
-
-    private static class TimingScope {
-
-        public final TimingScope parent;
-        public final int level;
-        public long time;
-        public long count;
-        public long subTime;
-        public long startTime;
-
-        public final ArrayList<String> subNames = new ArrayList<>();
-        public final ArrayList<TimingScope> subScopes = new ArrayList<>();
-
-        public TimingScope(TimingScope parent) {
-            this.parent = parent;
-            this.level = parent == null ? 0 : parent.level + 1;
-        }
-
-        private static final String PREFIX = "       |       |       |       |       |       |       |       |       |       +";
-
-        public static void treeIndent(int i) {
-            assert i < PREFIX.length() / 8;
-            TTY.print(PREFIX.substring(PREFIX.length() - i * 8));
-        }
-
-        private void printScope(int indent) {
-            TTY.println("%3.0f%% %6.2fs %5d", time * 100.0 / parent.time, time / 1000000000.0, count);
-            if (!subNames.isEmpty() && (time - subTime) > 0) {
-                treeIndent(indent + 1);
-                TTY.print("%-40s", "self:");
-                TTY.println("%3.0f%% %6.2fs %5d", (time - subTime) * 100.0 / time, (time - subTime) / 1000000000.0, count);
-            }
-            printSub(indent + 1);
-        }
-
-        public void printSub(int indent) {
-            for (int i = 0; i < subNames.size(); i++) {
-                String name = subNames.get(i);
-                TimingScope scope = subScopes.get(i);
-                treeIndent(indent);
-                TTY.print("%-40s", name + ":");
-                scope.printScope(indent);
-            }
-        }
-
-        public long accumulateSub(Map<String, Long> times, Map<String, Long> counts) {
-            long result = 0;
-            for (int i = 0; i < subNames.size(); i++) {
-                String name = subNames.get(i);
-                TimingScope scope = subScopes.get(i);
-                long totalTime = times.containsKey(name) ? times.get(name) : 0;
-                long totalCount = counts.containsKey(name) ? counts.get(name) : 0;
-                long myTime = scope.time - scope.subTime;
-                times.put(name, totalTime + myTime);
-                counts.put(name, totalCount + scope.count);
-                result += myTime + scope.accumulateSub(times, counts);
-            }
-            return result;
-        }
-    }
-
-    private final TimingScope rootScope = new TimingScope(null);
-
-    private ThreadLocal<TimingScope> currentScope = new ThreadLocal<TimingScope>() {
-
-        @Override
-        protected TimingScope initialValue() {
-            TimingScope scope = new TimingScope(rootScope);
-            rootScope.subNames.add(Thread.currentThread().getName());
-            rootScope.subScopes.add(scope);
-            return scope;
-        }
-    };
-
-    private ThreadLocal<Integer> currentLevel = new ThreadLocal<Integer>() {
-        @Override
-        protected Integer initialValue() {
-            return 0;
-        }
-    };
-
-    public void startScope(Class< ? > clazz) {
-        if (GraalOptions.Time) {
-            startScope(clazz.getSimpleName());
-        } else {
-            currentLevel.set(currentLevel.get() + 1);
-        }
-    }
-
-    public int currentLevel() {
-        if (GraalOptions.Time) {
-            return currentScope.get().level;
-        } else {
-            return currentLevel.get();
-        }
-    }
-
-    public void startScope(String name) {
-        if (GraalOptions.Time) {
-            TimingScope current = currentScope.get();
-            int index = current.subNames.indexOf(name);
-            TimingScope sub;
-            if (index == -1) {
-                sub = new TimingScope(current);
-                current.subNames.add(name);
-                current.subScopes.add(sub);
-            } else {
-                sub = current.subScopes.get(index);
-            }
-            currentScope.set(sub);
-            sub.startTime = System.nanoTime();
-            sub.count++;
-        } else {
-            currentLevel.set(currentLevel.get() + 1);
-        }
-    }
-
-    public void endScope() {
-        if (GraalOptions.Time) {
-            TimingScope current = currentScope.get();
-            long time = System.nanoTime() - current.startTime;
-            current.time += time;
-            current.parent.subTime += time;
-            currentScope.set(current.parent);
-        } else {
-            currentLevel.set(currentLevel.get() - 1);
-        }
-    }
-
-    public void print() {
-        if (GraalOptions.Time) {
-            rootScope.time = 0;
-            for (TimingScope scope : rootScope.subScopes) {
-                scope.time = scope.subTime;
-                rootScope.time += scope.subTime;
-            }
-
-            TTY.println("===============================");
-            TTY.println("Total Compilation Time: %6.2fs", rootScope.time / 1000000000.0);
-            TTY.println();
-
-            rootScope.printSub(0);
-
-            TreeMap<String, Long> times = new TreeMap<>();
-            TreeMap<String, Long> counts = new TreeMap<>();
-            long total = rootScope.accumulateSub(times, counts);
-
-            TTY.println();
-            for (String name : times.keySet()) {
-                if (times.get(name) > 0) {
-                    TTY.println("%-30s: %7.4f s (%5.2f%%) %5d", name, times.get(name) / 1000000000.0, times.get(name) * 100.0 / total, counts.get(name));
-                }
-            }
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ControlFlowOptimizer.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ControlFlowOptimizer.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,10 +24,10 @@
 
 import java.util.*;
 
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.schedule.*;
 import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.debug.*;
 
 /**
  * This class performs basic optimizations on the control flow graph after LIR generation.
@@ -38,8 +38,8 @@
      * Performs control flow optimizations on the given LIR graph.
      * @param ir the LIR graph that should be optimized
      */
-    public static void optimize(LIR ir, GraalContext context) {
-        ControlFlowOptimizer optimizer = new ControlFlowOptimizer(ir, context);
+    public static void optimize(LIR ir) {
+        ControlFlowOptimizer optimizer = new ControlFlowOptimizer(ir);
         List<LIRBlock> code = ir.codeEmittingOrder();
         //optimizer.reorderShortLoops(code);
         optimizer.deleteEmptyBlocks(code);
@@ -48,11 +48,9 @@
     }
 
     private final LIR ir;
-    private final GraalContext context;
 
-    private ControlFlowOptimizer(LIR ir, GraalContext context) {
+    private ControlFlowOptimizer(LIR ir) {
         this.ir = ir;
-        this.context = context;
     }
 /*
     private void reorderShortLoop(List<LIRBlock> code, LIRBlock headerBlock, int headerIdx) {
@@ -102,9 +100,9 @@
         List<LIRInstruction> instructions = block.lir();
 
         assert instructions.size() >= 2 : "block must have label and branch";
-        assert instructions.get(0).code == StandardOpcode.LABEL : "first instruction must always be a label";
-        assert instructions.get(instructions.size() - 1).code == StandardOpcode.JUMP : "last instruction must always be a branch";
-        assert ((LIRBranch) instructions.get(instructions.size() - 1)).destination().label() == block.suxAt(0).label() : "branch target must be the successor " + ((LIRBranch) instructions.get(instructions.size() - 1)).destination();
+        assert instructions.get(0) instanceof StandardOp.LabelOp : "first instruction must always be a label";
+        assert instructions.get(instructions.size() - 1) instanceof StandardOp.JumpOp : "last instruction must always be a branch";
+        assert ((StandardOp.JumpOp) instructions.get(instructions.size() - 1)).destination().label() == block.suxAt(0).label() : "branch target must be the successor";
 
         // block must have exactly one successor
 
@@ -123,7 +121,7 @@
             if (canDeleteBlock(block)) {
                 // adjust successor and predecessor lists
                 block.replaceWith(block.suxAt(0));
-                context.metrics.BlocksDeleted++;
+                Debug.metric("BlocksDeleted").increment();
             } else {
                 // adjust position of this block in the block list if blocks before
                 // have been deleted
@@ -147,22 +145,22 @@
             List<LIRInstruction> instructions = block.lir();
 
             LIRInstruction lastOp = instructions.get(instructions.size() - 1);
-            if (lastOp instanceof LIRBranch) {
-                LIRBranch lastBranch = (LIRBranch) lastOp;
+            if (lastOp instanceof StandardOp.JumpOp) {
+                StandardOp.JumpOp lastJump = (StandardOp.JumpOp) lastOp;
 
-                if (lastBranch.info == null) {
-                    if (lastBranch.destination().label() == code.get(i + 1).label()) {
+                if (lastOp.info == null) {
+                    if (lastJump.destination().label() == code.get(i + 1).label()) {
                         // delete last branch instruction
                         Util.truncate(instructions, instructions.size() - 1);
 
                     } else {
                         LIRInstruction prevOp = instructions.get(instructions.size() - 2);
-                        if (prevOp instanceof LIRBranch) {
-                            LIRBranch prevBranch = (LIRBranch) prevOp;
+                        if (prevOp instanceof StandardOp.BranchOp) {
+                            StandardOp.BranchOp prevBranch = (StandardOp.BranchOp) prevOp;
 
-                            if (prevBranch.destination().label() == code.get(i + 1).label && prevBranch.info == null) {
+                            if (prevBranch.destination().label() == code.get(i + 1).label && prevOp.info == null) {
                                 // eliminate a conditional branch to the immediate successor
-                                prevBranch.negate(lastBranch.destination());
+                                prevBranch.negate(lastJump.destination());
                                 Util.truncate(instructions, instructions.size() - 1);
                             }
                         }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/EdgeMoveOptimizer.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/EdgeMoveOptimizer.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,6 +25,7 @@
 import java.util.*;
 
 import com.oracle.max.graal.compiler.lir.*;
+import com.oracle.max.graal.compiler.lir.StandardOp.*;
 
 /**
  * This class optimizes moves, particularly those that result from eliminating SSA form.
@@ -88,10 +89,10 @@
         assert op1 != null;
         assert op2 != null;
 
-        if (op1 instanceof MoveInstruction && op2 instanceof MoveInstruction) {
-            MoveInstruction move1 = (MoveInstruction) op1;
-            MoveInstruction move2 = (MoveInstruction) op2;
-            if (move1.getSource() == move2.getSource() && move1.getDest() == move2.getDest()) {
+        if (op1 instanceof MoveOp && op2 instanceof MoveOp) {
+            MoveOp move1 = (MoveOp) op1;
+            MoveOp move2 = (MoveOp) op2;
+            if (move1.getInput() == move2.getInput() && move1.getResult() == move2.getResult()) {
                 // these moves are exactly equal and can be optimized
                 return true;
             }
@@ -128,12 +129,12 @@
                 return;
             }
 
-            if (predInstructions.get(predInstructions.size() - 1).code == StandardOpcode.XIR) {
+            if (predInstructions.get(predInstructions.size() - 1) instanceof LIRXirInstruction) {
                 return;
             }
 
             assert pred.suxAt(0) == block : "invalid control flow";
-            assert predInstructions.get(predInstructions.size() - 1).code == StandardOpcode.JUMP : "block must end with unconditional jump";
+            assert predInstructions.get(predInstructions.size() - 1) instanceof StandardOp.JumpOp : "block must end with unconditional jump";
 
             if (predInstructions.get(predInstructions.size() - 1).info != null) {
                 // can not optimize instructions that have debug info
@@ -185,12 +186,12 @@
 
         assert numSux == 2 : "method should not be called otherwise";
 
-        if (instructions.get(instructions.size() - 1).code == StandardOpcode.XIR) {
+        if (instructions.get(instructions.size() - 1) instanceof LIRXirInstruction) {
             // cannot optimize when last instruction is Xir.
             return;
         }
 
-        assert instructions.get(instructions.size() - 1).code == StandardOpcode.JUMP : "block must end with unconditional jump";
+        assert instructions.get(instructions.size() - 1) instanceof StandardOp.JumpOp : "block must end with unconditional jump";
 
         if (instructions.get(instructions.size() - 1).info != null) {
             // cannot optimize instructions when debug info is needed
@@ -198,7 +199,7 @@
         }
 
         LIRInstruction branch = instructions.get(instructions.size() - 2);
-        if (!(branch instanceof LIRBranch) || branch.info != null) {
+        if (!(branch instanceof StandardOp.BranchOp) || branch.info != null) {
             // not a valid case for optimization
             // currently, only blocks that end with two branches (conditional branch followed
             // by unconditional branch) are optimized
@@ -214,7 +215,7 @@
             LIRBlock sux = block.suxAt(i);
             List<LIRInstruction> suxInstructions = sux.lir();
 
-            assert suxInstructions.get(0).code == StandardOpcode.LABEL : "block must start with label";
+            assert suxInstructions.get(0) instanceof StandardOp.LabelOp : "block must start with label";
 
             if (sux.numberOfPreds() != 1) {
                 // this can happen with switch-statements where multiple edges are between
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/Interval.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/Interval.java	Thu Feb 02 16:07:52 2012 -0800
@@ -657,12 +657,9 @@
     /**
      * Sentinel interval to denote the end of an interval list.
      */
-    static final Interval EndMarker = new Interval(null, CiValue.IllegalValue, -1);
+    static final Interval EndMarker = new Interval(CiValue.IllegalValue, -1);
 
-    Interval(GraalContext context, CiValue operand, int operandNumber) {
-        if (GraalOptions.Meter && context != null) {
-            context.metrics.LSRAIntervalsCreated++;
-        }
+    Interval(CiValue operand, int operandNumber) {
         assert operand != null;
         this.operand = operand;
         this.operandNumber = operandNumber;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java	Thu Feb 02 16:07:52 2012 -0800
@@ -41,8 +41,9 @@
 import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandMode;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.ValueProcedure;
 import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
-import com.oracle.max.graal.nodes.*;
+import com.oracle.max.graal.compiler.lir.StandardOp.*;
 
 /**
  * An implementation of the linear scan register allocator algorithm described
@@ -51,7 +52,6 @@
  */
 public final class LinearScan {
 
-    final GraalContext context;
     final CiTarget target;
     final RiMethod method;
     final LIR ir;
@@ -119,14 +119,10 @@
      */
     private final int firstVariableNumber;
 
-    private final StructuredGraph graph;
 
-
-    public LinearScan(GraalContext context, CiTarget target, RiResolvedMethod method, StructuredGraph graph, LIR ir, LIRGenerator gen, FrameMap frameMap) {
-        this.context = context;
+    public LinearScan(CiTarget target, RiResolvedMethod method, LIR ir, LIRGenerator gen, FrameMap frameMap) {
         this.target = target;
         this.method = method;
-        this.graph = graph;
         this.ir = ir;
         this.gen = gen;
         this.frameMap = frameMap;
@@ -237,7 +233,7 @@
         assert isProcessed(operand);
         assert isLegal(operand);
         int operandNumber = operandNumber(operand);
-        Interval interval = new Interval(context, operand, operandNumber);
+        Interval interval = new Interval(operand, operandNumber);
         assert operandNumber < intervalsSize;
         assert intervals[operandNumber] == null;
         intervals[operandNumber] = interval;
@@ -288,7 +284,7 @@
     }
 
     int numLoops() {
-        return ir.loopCount();
+        return ir.numLoops();
     }
 
     boolean isIntervalInLoop(int interval, int loop) {
@@ -376,7 +372,7 @@
 
             case NoSpillStore:
                 assert defPos <= interval.spillDefinitionPos() : "positions are processed in reverse order when intervals are created";
-                if (defPos < interval.spillDefinitionPos() - 2 || instructionForId(interval.spillDefinitionPos()).code == StandardOpcode.XIR) {
+                if (defPos < interval.spillDefinitionPos() - 2 || instructionForId(interval.spillDefinitionPos()) instanceof LIRXirInstruction) {
                     // second definition found, so no spill optimization possible for this interval
                     interval.setSpillState(SpillState.NoOptimization);
                 } else {
@@ -471,17 +467,17 @@
                 int opId = op.id();
 
                 if (opId == -1) {
-                    MoveInstruction move = (MoveInstruction) op;
+                    MoveOp move = (MoveOp) op;
                     // remove move from register to stack if the stack slot is guaranteed to be correct.
                     // only moves that have been inserted by LinearScan can be removed.
-                    assert isVariable(move.getDest()) : "LinearScan inserts only moves to variables";
+                    assert isVariable(move.getResult()) : "LinearScan inserts only moves to variables";
 
-                    Interval curInterval = intervalFor(move.getDest());
+                    Interval curInterval = intervalFor(move.getResult());
 
                     if (!isRegister(curInterval.location()) && curInterval.alwaysInMemory()) {
                         // move target is a stack slot that is always correct, so eliminate instruction
                         if (GraalOptions.TraceLinearScanLevel >= 4) {
-                            TTY.println("eliminating move from interval %d to %d", operandNumber(move.getSource()), operandNumber(move.getDest()));
+                            TTY.println("eliminating move from interval %d to %d", operandNumber(move.getInput()), operandNumber(move.getResult()));
                         }
                         instructions.set(j, null); // null-instructions are deleted by assignRegNum
                     }
@@ -503,7 +499,7 @@
                         assert isRegister(fromLocation) : "from operand must be a register but is: " + fromLocation + " toLocation=" + toLocation + " spillState=" + interval.spillState();
                         assert isStackSlot(toLocation) : "to operand must be a stack slot";
 
-                        insertionBuffer.append(j + 1, StandardOpcode.SPILL_MOVE.create(toLocation, fromLocation));
+                        insertionBuffer.append(j + 1, ir.spillMoveFactory.createMove(toLocation, fromLocation));
 
                         if (GraalOptions.TraceLinearScanLevel >= 4) {
                             CiStackSlot slot = interval.spillSlot();
@@ -988,9 +984,9 @@
      * Determines the register priority for an instruction's output/result operand.
      */
     static RegisterPriority registerPriorityOfOutputOperand(LIRInstruction op) {
-        if (op instanceof MoveInstruction) {
-            MoveInstruction move = (MoveInstruction) op;
-            if (isStackSlot(move.getSource()) && move.getSource().kind != CiKind.Object) {
+        if (op instanceof MoveOp) {
+            MoveOp move = (MoveOp) op;
+            if (isStackSlot(move.getInput()) && move.getInput().kind != CiKind.Object) {
                 // method argument (condition must be equal to handleMethodArguments)
                 return RegisterPriority.None;
             }
@@ -1018,21 +1014,21 @@
      * spill slot.
      */
     void handleMethodArguments(LIRInstruction op) {
-        if (op instanceof MoveInstruction) {
-            MoveInstruction move = (MoveInstruction) op;
-            if (isStackSlot(move.getSource()) && move.getSource().kind != CiKind.Object) {
-                CiStackSlot slot = (CiStackSlot) move.getSource();
+        if (op instanceof MoveOp) {
+            MoveOp move = (MoveOp) op;
+            if (isStackSlot(move.getInput()) && move.getInput().kind != CiKind.Object) {
+                CiStackSlot slot = (CiStackSlot) move.getInput();
                 if (GraalOptions.DetailedAsserts) {
-                    assert move.id() > 0 : "invalid id";
-                    assert blockForId(move.id()).numberOfPreds() == 0 : "move from stack must be in first block";
-                    assert isVariable(move.getDest()) : "result of move must be a variable";
+                    assert op.id() > 0 : "invalid id";
+                    assert blockForId(op.id()).numberOfPreds() == 0 : "move from stack must be in first block";
+                    assert isVariable(move.getResult()) : "result of move must be a variable";
 
                     if (GraalOptions.TraceLinearScanLevel >= 4) {
-                        TTY.println("found move from stack slot %s to %s", slot, move.getDest());
+                        TTY.println("found move from stack slot %s to %s", slot, move.getResult());
                     }
                 }
 
-                Interval interval = intervalFor(move.getDest());
+                Interval interval = intervalFor(move.getResult());
                 interval.setSpillSlot(slot);
                 interval.assignLocation(slot);
             }
@@ -1420,9 +1416,8 @@
 
             List<LIRInstruction> instructions = fromBlock.lir();
             LIRInstruction instr = instructions.get(instructions.size() - 1);
-            if (instr instanceof LIRBranch) {
+            if (instr instanceof StandardOp.JumpOp) {
                 // insert moves before branch
-                assert instr.code == StandardOpcode.JUMP : "block does not end with an unconditional jump";
                 moveResolver.setInsertPosition(fromBlock.lir(), instructions.size() - 1);
             } else {
                 moveResolver.setInsertPosition(fromBlock.lir(), instructions.size());
@@ -1434,7 +1429,7 @@
             }
 
             if (GraalOptions.DetailedAsserts) {
-                assert fromBlock.lir().get(0).code == StandardOpcode.LABEL : "block does not start with a label";
+                assert fromBlock.lir().get(0) instanceof StandardOp.LabelOp : "block does not start with a label";
 
                 // because the number of predecessor edges matches the number of
                 // successor edges, blocks which are reached by switch statements
@@ -1466,8 +1461,8 @@
             // check if block has only one predecessor and only one successor
             if (block.numberOfPreds() == 1 && block.numberOfSux() == 1) {
                 List<LIRInstruction> instructions = block.lir();
-                assert instructions.get(0).code == StandardOpcode.LABEL : "block must start with label";
-                assert instructions.get(instructions.size() - 1).code == StandardOpcode.JUMP : "block with successor must end with unconditional jump";
+                assert instructions.get(0) instanceof StandardOp.LabelOp : "block must start with label";
+                assert instructions.get(instructions.size() - 1) instanceof StandardOp.JumpOp : "block with successor must end with unconditional jump";
 
                 // check if block is empty (only label and branch)
                 if (instructions.size() == 2) {
@@ -1591,10 +1586,8 @@
                     // before the branch instruction. So the split child information for this branch would
                     // be incorrect.
                     LIRInstruction instr = block.lir().get(block.lir().size() - 1);
-                    if (instr instanceof LIRBranch) {
-                        LIRBranch branch = (LIRBranch) instr;
+                    if (instr instanceof StandardOp.JumpOp) {
                         if (block.liveOut.get(operandNumber(operand))) {
-                            assert branch.code == StandardOpcode.JUMP : "block does not end with an unconditional jump";
                             assert false : "can't get split child for the last branch of a block because the information would be incorrect (moves are inserted before the branch in resolveDataFlow)";
                         }
                     }
@@ -1619,7 +1612,7 @@
         // intervals that have no oops inside need not to be processed.
         // to ensure a walking until the last instruction id, add a dummy interval
         // with a high operation id
-        nonOopIntervals = new Interval(context, CiValue.IllegalValue, -1);
+        nonOopIntervals = new Interval(CiValue.IllegalValue, -1);
         nonOopIntervals.addRange(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1);
 
         return new IntervalWalker(this, oopIntervals, nonOopIntervals);
@@ -1702,7 +1695,7 @@
                     // considered in the live ranges of intervals)
                     // Solution: use the first opId of the branch target block instead.
                     final LIRInstruction instr = block.lir().get(block.lir().size() - 1);
-                    if (instr instanceof LIRBranch) {
+                    if (instr instanceof StandardOp.JumpOp) {
                         if (block.liveOut.get(operandNumber(operand))) {
                             tempOpId = block.suxAt(0).firstLirInstructionId();
                             mode = OperandMode.Output;
@@ -1754,9 +1747,9 @@
             }
 
             // remove useless moves
-            if (op instanceof MoveInstruction) {
-                MoveInstruction move = (MoveInstruction) op;
-                if (move.getSource() == move.getDest()) {
+            if (op instanceof MoveOp) {
+                MoveOp move = (MoveOp) op;
+                if (move.getInput() == move.getResult()) {
                     instructions.set(j, null);
                     hasDead = true;
                 }
@@ -1787,70 +1780,65 @@
     }
 
     public void allocate() {
-        context.timers.startScope("Lifetime Analysis");
-        try {
-            numberInstructions();
 
-            printLir("Before register allocation", true);
+        Debug.scope("LifetimeAnalysis", new Runnable() {
 
-            computeLocalLiveSets();
-            computeGlobalLiveSets();
-
-            buildIntervals();
-            sortIntervalsBeforeAllocation();
-        } finally {
-            context.timers.endScope();
-        }
+            public void run() {
+                numberInstructions();
+                printLir("Before register allocation", true);
+                computeLocalLiveSets();
+                computeGlobalLiveSets();
+                buildIntervals();
+                sortIntervalsBeforeAllocation();
+            }
+        });
 
-        context.timers.startScope("Linear Scan");
-        try {
-            printIntervals("Before register allocation");
+        Debug.scope("RegisterAllocation", new Runnable() {
 
-            allocateRegisters();
+            public void run() {
+                printIntervals("Before register allocation");
+                allocateRegisters();
+            }
+        });
 
-        } finally {
-            context.timers.endScope();
-        }
+        Debug.scope("ResolveDataFlow", new Runnable() {
+            public void run() {
+                resolveDataFlow();
+            }
+        });
 
-        context.timers.startScope("Resolution");
-        try {
-            resolveDataFlow();
-        } finally {
-            context.timers.endScope();
-        }
+        Debug.scope("DebugInfo", new Runnable() {
 
-        context.timers.startScope("Create Debug Info");
-        try {
-            frameMap.finish();
+            public void run() {
+                frameMap.finish();
 
-            printIntervals("After register allocation");
-            printLir("After register allocation", true);
+                printIntervals("After register allocation");
+                printLir("After register allocation", true);
 
-            sortIntervalsAfterAllocation();
+                sortIntervalsAfterAllocation();
 
-            if (GraalOptions.DetailedAsserts) {
-                verify();
-            }
+                if (GraalOptions.DetailedAsserts) {
+                    verify();
+                }
 
-            eliminateSpillMoves();
-            assignLocations();
+                eliminateSpillMoves();
+                assignLocations();
 
-            if (GraalOptions.DetailedAsserts) {
-                verifyIntervals();
+                if (GraalOptions.DetailedAsserts) {
+                    verifyIntervals();
+                }
             }
-        } finally {
-            context.timers.endScope();
-        }
+        });
+
+        Debug.scope("ControlFlowOptimizations", new Runnable() {
 
-        context.timers.startScope("Control Flow Optimizations");
-        try {
-            printLir("After register number assignment", true);
-            EdgeMoveOptimizer.optimize(ir.linearScanOrder());
-            ControlFlowOptimizer.optimize(ir, context);
-            printLir("After control flow optimization", false);
-        } finally {
-            context.timers.endScope();
-        }
+            public void run() {
+                printLir("After register number assignment", true);
+                EdgeMoveOptimizer.optimize(ir.linearScanOrder());
+                ControlFlowOptimizer.optimize(ir);
+                printLir("After control flow optimization", false);
+            }
+        });
     }
 
     void printIntervals(String label) {
@@ -1875,12 +1863,11 @@
             TTY.println();
         }
 
-        if (context.isObserved()) {
-            context.observable.fireCompilationEvent(label, graph, this, Arrays.copyOf(intervals, intervalsSize));
-        }
+        Debug.dump(Arrays.copyOf(intervals, intervalsSize), label);
     }
 
-    void printLir(String label, boolean hirValid) {
+    void printLir(String label, @SuppressWarnings("unused") boolean hirValid) {
+        // TODO(tw): Fix printing.
         if (GraalOptions.TraceLinearScanLevel >= 1 && !TTY.isSuppressed()) {
             TTY.println();
             TTY.println(label);
@@ -1888,9 +1875,7 @@
             TTY.println();
         }
 
-        if (context.isObserved()) {
-            context.observable.fireCompilationEvent(label, hirValid ? graph : null, ir);
-        }
+        Debug.dump(ir, label);
     }
 
     boolean verify() {
@@ -2027,7 +2012,7 @@
         fixedIntervals = createUnhandledLists(IS_PRECOLORED_INTERVAL, null).first;
         // to ensure a walking until the last instruction id, add a dummy interval
         // with a high operation id
-        otherIntervals = new Interval(context, CiValue.IllegalValue, -1);
+        otherIntervals = new Interval(CiValue.IllegalValue, -1);
         otherIntervals.addRange(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1);
         IntervalWalker iw = new IntervalWalker(this, fixedIntervals, otherIntervals);
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java	Thu Feb 02 16:07:52 2012 -0800
@@ -37,6 +37,7 @@
 import com.oracle.max.graal.compiler.alloc.Interval.State;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.compiler.lir.StandardOp.*;
 
 /**
  */
@@ -824,9 +825,9 @@
     }
 
     static boolean isMove(LIRInstruction op, Interval from, Interval to) {
-        if (op instanceof MoveInstruction) {
-            MoveInstruction move = (MoveInstruction) op;
-            return isVariable(move.getSource()) && isVariable(move.getDest()) && move.getSource() == from.operand && move.getDest() == to.operand;
+        if (op instanceof MoveOp) {
+            MoveOp move = (MoveOp) op;
+            return isVariable(move.getInput()) && isVariable(move.getResult()) && move.getInput() == from.operand && move.getResult() == to.operand;
         }
         return false;
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/MoveResolver.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/MoveResolver.java	Thu Feb 02 16:07:52 2012 -0800
@@ -198,7 +198,7 @@
         CiValue fromOpr = fromInterval.operand;
         CiValue toOpr = toInterval.operand;
 
-        insertionBuffer.append(insertIdx, StandardOpcode.SPILL_MOVE.create(toOpr, fromOpr));
+        insertionBuffer.append(insertIdx, allocator.ir.spillMoveFactory.createMove(toOpr, fromOpr));
 
         if (GraalOptions.TraceLinearScanLevel >= 4) {
             TTY.println("MoveResolver: inserted move from %d (%s) to %d (%s)", fromInterval.operandNumber, fromInterval.location(), toInterval.operandNumber, toInterval.location());
@@ -210,7 +210,7 @@
         assert insertIdx != -1 : "must setup insert position first";
 
         CiValue toOpr = toInterval.operand;
-        insertionBuffer.append(insertIdx, StandardOpcode.SPILL_MOVE.create(toOpr, fromOpr));
+        insertionBuffer.append(insertIdx, allocator.ir.spillMoveFactory.createMove(toOpr, fromOpr));
 
         if (GraalOptions.TraceLinearScanLevel >= 4) {
             TTY.print("MoveResolver: inserted move from constant %s to %d (%s)", fromOpr, toInterval.operandNumber, toInterval.location());
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/asm/TargetMethodAssembler.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/asm/TargetMethodAssembler.java	Thu Feb 02 16:07:52 2012 -0800
@@ -34,6 +34,7 @@
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.lir.LIR.SlowPath;
 import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.debug.*;
 
 public class TargetMethodAssembler {
 
@@ -46,10 +47,7 @@
 
     private List<ExceptionInfo> exceptionInfoList;
     private int lastSafepointPos;
-    private final GraalContext context;
-
-    public TargetMethodAssembler(GraalContext context, CiTarget target, RiRuntime runtime, FrameMap frameMap, List<SlowPath> slowPaths, AbstractAssembler asm) {
-        this.context = context;
+    public TargetMethodAssembler(CiTarget target, RiRuntime runtime, FrameMap frameMap, List<SlowPath> slowPaths, AbstractAssembler asm) {
         this.target = target;
         this.runtime = runtime;
         this.frameMap = frameMap;
@@ -84,13 +82,11 @@
             }
         }
 
-        if (GraalOptions.Meter) {
-            context.metrics.TargetMethods++;
-            context.metrics.CodeBytesEmitted += targetMethod.targetCodeSize();
-            context.metrics.SafepointsEmitted += targetMethod.safepoints.size();
-            context.metrics.DataPatches += targetMethod.dataReferences.size();
-            context.metrics.ExceptionHandlersEmitted += targetMethod.exceptionHandlers.size();
-        }
+        Debug.metric("TargetMethods").increment();
+        Debug.metric("CodeBytesEmitted").add(targetMethod.targetCodeSize());
+        Debug.metric("SafepointsEmitted").add(targetMethod.safepoints.size());
+        Debug.metric("DataPatches").add(targetMethod.dataReferences.size());
+        Debug.metric("ExceptionHandlersEmitted").add(targetMethod.exceptionHandlers.size());
 
         if (GraalOptions.PrintAssembly && !TTY.isSuppressed() && !isStub) {
             Util.printSection("Target Method", Util.SECTION_CHARACTER);
@@ -181,13 +177,8 @@
 
     public CiAddress recordDataReferenceInCode(CiConstant data, int alignment) {
         assert data != null;
-
         int pos = asm.codeBuffer.position();
-
-        if (GraalOptions.TraceRelocation) {
-            TTY.print("Data reference in code: pos = %d, data = %s", pos, data.toString());
-        }
-
+        Debug.log("Data reference in code: pos = %d, data = %s", pos, data.toString());
         targetMethod.recordDataReference(pos, data, alignment);
         return CiAddress.Placeholder;
     }
@@ -242,6 +233,31 @@
         return recordDataReferenceInCode((CiConstant) value, 8);
     }
 
+    public CiAddress asIntAddr(CiValue value) {
+        assert value.kind == CiKind.Int;
+        return asAddress(value);
+    }
+
+    public CiAddress asLongAddr(CiValue value) {
+        assert value.kind == CiKind.Long;
+        return asAddress(value);
+    }
+
+    public CiAddress asObjectAddr(CiValue value) {
+        assert value.kind == CiKind.Object;
+        return asAddress(value);
+    }
+
+    public CiAddress asFloatAddr(CiValue value) {
+        assert value.kind == CiKind.Float;
+        return asAddress(value);
+    }
+
+    public CiAddress asDoubleAddr(CiValue value) {
+        assert value.kind == CiKind.Double;
+        return asAddress(value);
+    }
+
     public CiAddress asAddress(CiValue value) {
         if (isStackSlot(value)) {
             CiStackSlot slot = (CiStackSlot) value;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Thu Feb 02 16:07:52 2012 -0800
@@ -27,28 +27,30 @@
 import static com.oracle.max.cri.ci.CiValueUtil.*;
 import static com.oracle.max.cri.util.MemoryBarriers.*;
 import static com.oracle.max.graal.alloc.util.ValueUtil.*;
-import static com.oracle.max.graal.compiler.lir.StandardOpcode.*;
 
 import java.lang.reflect.*;
 import java.util.*;
 
 import com.oracle.max.asm.*;
 import com.oracle.max.cri.ci.*;
+import com.oracle.max.cri.ci.CiTargetMethod.Mark;
 import com.oracle.max.cri.ri.*;
 import com.oracle.max.cri.ri.RiType.Representation;
 import com.oracle.max.cri.xir.CiXirAssembler.XirConstant;
 import com.oracle.max.cri.xir.CiXirAssembler.XirInstruction;
+import com.oracle.max.cri.xir.CiXirAssembler.XirMark;
 import com.oracle.max.cri.xir.CiXirAssembler.XirOperand;
 import com.oracle.max.cri.xir.CiXirAssembler.XirParameter;
 import com.oracle.max.cri.xir.CiXirAssembler.XirRegister;
 import com.oracle.max.cri.xir.CiXirAssembler.XirTemp;
 import com.oracle.max.cri.xir.*;
 import com.oracle.max.criutils.*;
-import com.oracle.max.graal.alloc.util.*;
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.lir.*;
+import com.oracle.max.graal.compiler.lir.StandardOp.ParametersOp;
 import com.oracle.max.graal.compiler.schedule.*;
 import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.DeoptimizeNode.DeoptAction;
@@ -63,8 +65,6 @@
  * This class traverses the HIR instructions and generates LIR instructions from them.
  */
 public abstract class LIRGenerator extends LIRGeneratorTool {
-    public final GraalContext context;
-
     protected final Graph graph;
     protected final RiRuntime runtime;
     protected final CiTarget target;
@@ -138,8 +138,7 @@
     private LockScope curLocks;
 
 
-    public LIRGenerator(GraalContext context, Graph graph, RiRuntime runtime, CiTarget target, FrameMap frameMap, RiResolvedMethod method, LIR lir, RiXirGenerator xir) {
-        this.context = context;
+    public LIRGenerator(Graph graph, RiRuntime runtime, CiTarget target, FrameMap frameMap, RiResolvedMethod method, LIR lir, RiXirGenerator xir) {
         this.graph = graph;
         this.runtime = runtime;
         this.target = target;
@@ -393,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);
         }
@@ -417,15 +416,9 @@
         }
         currentInstruction = instr;
 
-        if (GraalOptions.TraceLIRVisit) {
-            TTY.println("Visiting    " + instr);
-        }
-
+        Debug.log("Visiting %s", instr);
         emitNode(instr);
-
-        if (GraalOptions.TraceLIRVisit) {
-            TTY.println("Operand for " + instr + " = " + operand(instr));
-        }
+        Debug.log("Operand for %s = %s", instr, operand(instr));
     }
 
     protected void emitNode(ValueNode node) {
@@ -444,11 +437,11 @@
         for (int i = 0; i < params.length; i++) {
             params[i] = toStackKind(incomingArguments.locations[i]);
         }
-        append(PARAMS.create(params));
+        append(new ParametersOp(params));
 
         XirSnippet prologue = xir.genPrologue(null, method);
         if (prologue != null) {
-            emitXir(prologue, null, null, null, false);
+            emitXir(prologue, null, null, false);
         }
 
         for (LocalNode local : graph.getNodes(LocalNode.class)) {
@@ -481,14 +474,14 @@
     public void visitArrayLength(ArrayLengthNode x) {
         XirArgument array = toXirArgument(x.array());
         XirSnippet snippet = xir.genArrayLength(site(x), array);
-        emitXir(snippet, x, state(), null, true);
+        emitXir(snippet, x, state(), true);
         operand(x);
     }
 
     @Override
     public void visitCheckCast(CheckCastNode x) {
         XirSnippet snippet = xir.genCheckCast(site(x), toXirArgument(x.object()), toXirArgument(x.targetClassInstruction()), x.targetClass());
-        emitXir(snippet, x, state(), null, true);
+        emitXir(snippet, x, state(), true);
         // The result of a checkcast is the unmodified object, so no need to allocate a new variable for it.
         setResult(x, operand(x.object()));
     }
@@ -513,7 +506,7 @@
         LIRDebugInfo stateAfter = stateFor(x.stateAfter());
 
         XirSnippet snippet = xir.genMonitorEnter(site(x), obj, lockAddress);
-        emitXir(snippet, x, stateBefore, stateAfter, null, true);
+        emitXir(snippet, x, stateBefore, stateAfter, true, null, null);
     }
 
     @Override
@@ -534,7 +527,7 @@
         curLocks = curLocks.outer;
 
         XirSnippet snippet = xir.genMonitorExit(site(x), obj, lockAddress);
-        emitXir(snippet, x, stateBefore, null, true);
+        emitXir(snippet, x, stateBefore, true);
     }
 
     @Override
@@ -546,7 +539,7 @@
         }
         XirArgument receiver = toXirArgument(x.object());
         XirSnippet snippet = x.isStatic() ? xir.genGetStatic(site(x), receiver, field) : xir.genGetField(site(x), receiver, field);
-        emitXir(snippet, x, info, null, true);
+        emitXir(snippet, x, info, true);
         if (x.isVolatile()) {
             emitMembar(JMM_POST_VOLATILE_READ);
         }
@@ -562,7 +555,7 @@
         XirArgument receiver = toXirArgument(x.object());
         XirArgument value = toXirArgument(x.value());
         XirSnippet snippet = x.isStatic() ? xir.genPutStatic(site(x), receiver, field, value) : xir.genPutField(site(x), receiver, field, value);
-        emitXir(snippet, x, info, null, true);
+        emitXir(snippet, x, info, true);
         if (x.isVolatile()) {
             emitMembar(JMM_POST_VOLATILE_WRITE);
         }
@@ -573,7 +566,7 @@
         XirArgument array = toXirArgument(x.array());
         XirArgument index = toXirArgument(x.index());
         XirSnippet snippet = xir.genArrayLoad(site(x), array, index, x.elementKind(), null);
-        emitXir(snippet, x, state(), null, true);
+        emitXir(snippet, x, state(), true);
     }
 
     @Override
@@ -582,27 +575,27 @@
         XirArgument index = toXirArgument(x.index());
         XirArgument value = toXirArgument(x.value());
         XirSnippet snippet = xir.genArrayStore(site(x), array, index, value, x.elementKind(), null);
-        emitXir(snippet, x, state(), null, true);
+        emitXir(snippet, x, state(), true);
     }
 
     @Override
     public void visitNewInstance(NewInstanceNode x) {
         XirSnippet snippet = xir.genNewInstance(site(x), x.instanceClass());
-        emitXir(snippet, x, state(), null, true);
+        emitXir(snippet, x, state(), true);
     }
 
     @Override
     public void visitNewTypeArray(NewTypeArrayNode x) {
         XirArgument length = toXirArgument(x.length());
         XirSnippet snippet = xir.genNewArray(site(x), length, x.elementType().kind(true), null, null);
-        emitXir(snippet, x, state(), null, true);
+        emitXir(snippet, x, state(), true);
     }
 
     @Override
     public void visitNewObjectArray(NewObjectArrayNode x) {
         XirArgument length = toXirArgument(x.length());
         XirSnippet snippet = xir.genNewArray(site(x), length, CiKind.Object, x.elementType(), x.exactType());
-        emitXir(snippet, x, state(), null, true);
+        emitXir(snippet, x, state(), true);
     }
 
     @Override
@@ -612,14 +605,14 @@
             dims[i] = toXirArgument(x.dimension(i));
         }
         XirSnippet snippet = xir.genNewMultiArray(site(x), dims, x.type());
-        emitXir(snippet, x, state(), null, true);
+        emitXir(snippet, x, state(), true);
     }
 
     @Override
     public void visitExceptionObject(ExceptionObjectNode x) {
         XirSnippet snippet = xir.genExceptionObject(site(x));
         LIRDebugInfo info = state();
-        emitXir(snippet, x, info, null, true);
+        emitXir(snippet, x, info, true);
     }
 
     @Override
@@ -631,18 +624,20 @@
         }
         XirSnippet epilogue = xir.genEpilogue(site(x), method);
         if (epilogue != null) {
-            emitXir(epilogue, x, null, method, false);
-            append(StandardOpcode.RETURN.create(operand));
+            emitXir(epilogue, x, null, false);
+            emitReturn(operand);
         }
     }
 
+    protected abstract void emitReturn(CiValue input);
+
     @SuppressWarnings("unused")
     protected void postGCWriteBarrier(CiValue addr, CiValue newVal) {
         XirSnippet writeBarrier = xir.genWriteBarrier(toXirArgument(addr));
         if (writeBarrier != null) {
-            emitXir(writeBarrier, null, null, null, false);
+            emitXir(writeBarrier, null, null, false);
         }
-    }
+     }
 
     @SuppressWarnings("unused")
     protected void preGCWriteBarrier(CiValue addrOpr, boolean patch, LIRDebugInfo info) {
@@ -677,7 +672,7 @@
     public void emitSafepointPoll(FixedNode x) {
         if (!lastState.method().noSafepointPolls()) {
             XirSnippet snippet = xir.genSafepointPoll(site(x));
-            emitXir(snippet, x, state(), null, false);
+            emitXir(snippet, x, state(), false);
         }
     }
 
@@ -701,13 +696,7 @@
         }
     }
 
-    private void emitNullCheckGuard(NullCheckNode node) {
-        assert !node.expectedNull;
-        NullCheckNode x = node;
-        Variable value = load(operand(x.object()));
-        LIRDebugInfo info = state();
-        append(StandardOpcode.NULL_CHECK.create(value, info));
-    }
+    protected abstract void emitNullCheckGuard(NullCheckNode node);
 
     public void emitBranch(BooleanNode node, LabelRef trueSuccessor, LabelRef falseSuccessor, LIRDebugInfo info) {
         if (node instanceof NullCheckNode) {
@@ -743,10 +732,7 @@
     private void emitInstanceOfBranch(InstanceOfNode x, LabelRef trueSuccessor, LabelRef falseSuccessor, LIRDebugInfo info) {
         XirArgument obj = toXirArgument(x.object());
         XirSnippet snippet = xir.genInstanceOf(site(x), obj, toXirArgument(x.targetClassInstruction()), x.targetClass());
-        emitXir(snippet, x, info, null, false);
-        LIRXirInstruction instr = (LIRXirInstruction) currentBlock.lir().get(currentBlock.lir().size() - 1);
-        instr.setTrueSuccessor(x.negated ? falseSuccessor : trueSuccessor);
-        instr.setFalseSuccessor(x.negated ? trueSuccessor : falseSuccessor);
+        emitXir(snippet, x, info, null, false, x.negated() ? falseSuccessor : trueSuccessor, x.negated() ? trueSuccessor : falseSuccessor);
     }
 
     public void emitConstantBranch(boolean value, LabelRef trueSuccessorBlock, LabelRef falseSuccessorBlock, LIRDebugInfo info) {
@@ -800,10 +786,10 @@
 
     private Variable emitInstanceOfConditional(InstanceOfNode x, CiValue trueValue, CiValue falseValue) {
         XirArgument obj = toXirArgument(x.object());
-        XirArgument trueArg = toXirArgument(x.negated ? falseValue : trueValue);
-        XirArgument falseArg = toXirArgument(x.negated ? trueValue : falseValue);
+        XirArgument trueArg = toXirArgument(x.negated() ? falseValue : trueValue);
+        XirArgument falseArg = toXirArgument(x.negated() ? trueValue : falseValue);
         XirSnippet snippet = xir.genMaterializeInstanceOf(site(x), obj, toXirArgument(x.targetClassInstruction()), trueArg, falseArg, x.targetClass());
-        return (Variable) emitXir(snippet, null, null, null, false);
+        return (Variable) emitXir(snippet, null, null, false);
     }
 
     private Variable emitConstantConditional(boolean value, CiValue trueValue, CiValue falseValue) {
@@ -885,7 +871,7 @@
             // TODO This is the version currently necessary for Maxine: since the invokeinterface-snippet uses a division, it
             // destroys rdx, which is also used to pass a parameter.  Therefore, the snippet must be before the parameters are assigned to their locations.
             LIRDebugInfo addrInfo = stateFor(stateBeforeCallWithArguments(x.stateAfter(), callTarget, x.bci()));
-            destinationAddress = emitXir(snippet, x.node(), addrInfo, null, callTarget.targetMethod(), false);
+            destinationAddress = emitXir(snippet, x.node(), addrInfo, false);
         }
 
         CiValue resultOperand = resultOperandFor(x.node().kind());
@@ -899,26 +885,20 @@
         if (target().invokeSnippetAfterArguments) {
             // TODO This is the version currently active for HotSpot.
             LIRDebugInfo addrInfo = stateFor(stateBeforeCallWithArguments(x.stateAfter(), callTarget, x.bci()), pointerSlots, null);
-            destinationAddress = emitXir(snippet, x.node(), addrInfo, null, callTarget.targetMethod(), false);
+            destinationAddress = emitXir(snippet, x.node(), addrInfo, false);
         }
 
         LIRDebugInfo callInfo = stateFor(x.stateDuring(), pointerSlots, x instanceof InvokeWithExceptionNode ? getLIRBlock(((InvokeWithExceptionNode) x).exceptionEdge()) : null);
-
-        // emit direct or indirect call to the destination address
-        if (destinationAddress instanceof CiConstant) {
-            // Direct call
-            assert ((CiConstant) destinationAddress).isDefaultValue() : "destination address should be zero";
-            append(StandardOpcode.DIRECT_CALL.create(targetMethod, resultOperand, argList, null, callInfo, snippet.marks));
-        } else {
-            // Indirect call
-            append(StandardOpcode.INDIRECT_CALL.create(targetMethod, resultOperand, argList, destinationAddress, callInfo, snippet.marks));
-        }
+        emitCall(targetMethod, resultOperand, argList, destinationAddress, callInfo, snippet.marks);
 
         if (isLegal(resultOperand)) {
             setResult(x.node(), emitMove(resultOperand));
         }
     }
 
+    protected abstract void emitCall(Object targetMethod, CiValue result, List<CiValue> arguments, CiValue targetAddress, LIRDebugInfo info, Map<XirMark, Mark> marks);
+
+
     private static CiValue toStackKind(CiValue value) {
         if (value.kind.stackKind() != value.kind) {
             // We only have stack-kinds in the LIR, so convert the operand kind for values from the calling convention.
@@ -986,7 +966,7 @@
             argumentList = Collections.emptyList();
         }
 
-        append(StandardOpcode.DIRECT_CALL.create(runtimeCall, physReg, argumentList, null, info, null));
+        emitCall(runtimeCall, physReg, argumentList, CiConstant.forLong(0), info, null);
 
         if (isLegal(physReg)) {
             return emitMove(physReg);
@@ -1015,7 +995,7 @@
             info = stateFor(stateBeforeReturn);
         }
 
-        append(StandardOpcode.DIRECT_CALL.create(x.call(), resultOperand, argList, null, info, null));
+        emitCall(x.call(), resultOperand, argList, CiConstant.forLong(0), info, null);
 
         if (isLegal(resultOperand)) {
             setResult(x, emitMove(resultOperand));
@@ -1214,11 +1194,11 @@
         return variable;
     }
 
-    protected CiValue emitXir(XirSnippet snippet, ValueNode x, LIRDebugInfo info, RiMethod currentMethod, boolean setInstructionResult) {
-        return emitXir(snippet, x, info, null, currentMethod, setInstructionResult);
+    protected CiValue emitXir(XirSnippet snippet, ValueNode x, LIRDebugInfo info, boolean setInstructionResult) {
+        return emitXir(snippet, x, info, null, setInstructionResult, null, null);
     }
 
-    protected CiValue emitXir(XirSnippet snippet, ValueNode instruction, LIRDebugInfo info, LIRDebugInfo infoAfter, RiMethod currentMethod, boolean setInstructionResult) {
+    protected CiValue emitXir(XirSnippet snippet, ValueNode instruction, LIRDebugInfo info, LIRDebugInfo infoAfter, boolean setInstructionResult, LabelRef trueSuccessor, LabelRef falseSuccessor) {
         if (GraalOptions.PrintXirTemplates) {
             TTY.println("Emit XIR template " + snippet.template.name);
         }
@@ -1315,18 +1295,19 @@
         XirInstruction[] slowPath = snippet.template.slowPath;
         if (!isConstant(operandsArray[resultOperand.index]) || snippet.template.fastPath.length != 0 || (slowPath != null && slowPath.length > 0)) {
             // XIR instruction is only needed when the operand is not a constant!
-            append(StandardOpcode.XIR.create(snippet, operandsArray, allocatedResultOperand,
+            emitXir(snippet, operandsArray, allocatedResultOperand,
                     inputOperandArray, tempOperandArray, inputOperandIndicesArray, tempOperandIndicesArray,
                     (allocatedResultOperand == IllegalValue) ? -1 : resultOperand.index,
-                    info, infoAfter, currentMethod));
-            if (GraalOptions.Meter) {
-                context.metrics.LIRXIRInstructions++;
-            }
+                    info, infoAfter, trueSuccessor, falseSuccessor);
+            Debug.metric("LIRXIRInstructions").increment();
         }
 
         return operandsArray[resultOperand.index];
     }
 
+    protected abstract void emitXir(XirSnippet snippet, CiValue[] operands, CiValue outputOperand, CiValue[] inputs, CiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex,
+                    LIRDebugInfo info, LIRDebugInfo infoAfter, LabelRef trueSuccessor, LabelRef falseSuccessor);
+
     protected final CiValue callRuntime(CiRuntimeCall runtimeCall, LIRDebugInfo info, CiValue... args) {
         // get a result register
         CiKind result = runtimeCall.resultKind;
@@ -1352,7 +1333,7 @@
             argumentList = Util.uncheckedCast(Collections.emptyList());
         }
 
-        append(StandardOpcode.DIRECT_CALL.create(runtimeCall, physReg, argumentList, null, info, null));
+        emitCall(runtimeCall, physReg, argumentList, CiConstant.forLong(0), info, null);
 
         return physReg;
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIR.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIR.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,6 +24,7 @@
 
 import java.util.*;
 
+import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.asm.*;
@@ -64,9 +65,14 @@
     public SlowPath methodEndMarker;
 
     private int numVariables;
+    private final int numLoops;
 
-    private final int loopCount;
+    public SpillMoveFactory spillMoveFactory;
 
+    public interface SpillMoveFactory {
+        LIRInstruction createMove(CiValue result, CiValue input);
+        LIRInstruction createExchange(CiValue input1, CiValue input2);
+    }
 
     public interface SlowPath {
         void emitCode(TargetMethodAssembler tasm);
@@ -74,15 +80,15 @@
 
     /**
      * Creates a new LIR instance for the specified compilation.
-     * @param loopCount number of loops
+     * @param numLoops number of loops
      * @param compilation the compilation
      */
-    public LIR(LIRBlock startBlock, List<LIRBlock> linearScanOrder, List<LIRBlock> codeEmittingOrder, NodeMap<LIRBlock> valueToBlock, int loopCount) {
+    public LIR(LIRBlock startBlock, List<LIRBlock> linearScanOrder, List<LIRBlock> codeEmittingOrder, NodeMap<LIRBlock> valueToBlock, int numLoops) {
         this.codeEmittingOrder = codeEmittingOrder;
         this.linearScanOrder = linearScanOrder;
         this.startBlock = startBlock;
         this.valueToBlock = valueToBlock;
-        this.loopCount = loopCount;
+        this.numLoops = numLoops;
 
         slowPaths = new ArrayList<>();
         deoptimizationStubs = new ArrayList<>();
@@ -108,10 +114,6 @@
         return valueToBlock;
     }
 
-    public int loopCount() {
-        return loopCount;
-    }
-
     public int numVariables() {
         return numVariables;
     }
@@ -256,4 +258,8 @@
             TTY.println();
         }
     }
+
+    public int numLoops() {
+        return numLoops;
+    }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBlock.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBlock.java	Thu Feb 02 16:07:52 2012 -0800
@@ -205,9 +205,9 @@
         LIRInstruction lirInstruction = lir.get(lir.size() - 1);
         if (lirInstruction instanceof LIRXirInstruction) {
             LIRXirInstruction lirXirInstruction = (LIRXirInstruction) lirInstruction;
-            return (lirXirInstruction.falseSuccessor() != null) && (lirXirInstruction.trueSuccessor() != null);
+            return (lirXirInstruction.falseSuccessor != null) && (lirXirInstruction.trueSuccessor != null);
         }
-        return lirInstruction instanceof LIRBranch;
+        return lirInstruction instanceof StandardOp.JumpOp;
     }
 
     public boolean isExceptionEntry() {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBranch.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2009, 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.compiler.lir;
-
-import com.oracle.max.graal.nodes.calc.*;
-
-public abstract class LIRBranch extends LIRInstruction {
-
-    /**
-     * The condition when this branch is taken, or {@code null} if it is an unconditional branch.
-     */
-    protected Condition cond;
-
-    /**
-     * For floating point branches only. True when the branch should be taken when the comparison is unordered.
-     */
-    protected boolean unorderedIsTrue;
-
-    /**
-     * The target of this branch.
-     */
-    protected LabelRef destination;
-
-
-    public LIRBranch(LIROpcode code, Condition cond, boolean unorderedIsTrue, LabelRef destination, LIRDebugInfo info) {
-        super(code, LIRInstruction.NO_OPERANDS, info, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
-        this.cond = cond;
-        this.unorderedIsTrue = unorderedIsTrue;
-        this.destination = destination;
-    }
-
-    public LabelRef destination() {
-        return destination;
-    }
-
-    public void negate(LabelRef newDestination) {
-        destination = newDestination;
-        cond = cond.negate();
-        unorderedIsTrue = !unorderedIsTrue;
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRCall.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2009, 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.compiler.lir;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiTargetMethod.*;
-import com.oracle.max.cri.ri.*;
-import com.oracle.max.cri.xir.CiXirAssembler.*;
-import com.oracle.max.graal.compiler.util.*;
-
-/**
- * This class represents a call instruction; either to a {@linkplain CiRuntimeCall runtime method},
- * a {@linkplain RiMethod Java method}, a native function or a global stub.
- */
-public abstract class LIRCall extends LIRInstruction {
-
-    /**
-     * The target of the call. This will be a {@link CiRuntimeCall}, {@link RiMethod} or {@link CiValue}
-     * object denoting a call to the runtime, a Java method or a native function respectively.
-     */
-    public final Object target;
-    /**
-     * The call site needs to be marked if this is non-null.
-     */
-    public final Map<XirMark, Mark> marks;
-
-    private final int targetAddressIndex;
-
-    private static CiValue[] toArray(List<CiValue> arguments, CiValue targetAddress) {
-        CiValue[] result = new CiValue[arguments.size() + (targetAddress != null ? 1 : 0)];
-        arguments.toArray(result);
-        if (targetAddress != null) {
-            result[arguments.size()] = targetAddress;
-        }
-        return result;
-    }
-
-    public LIRCall(LIROpcode opcode,
-                   Object target,
-                   CiValue result,
-                   List<CiValue> arguments,
-                   CiValue targetAddress,
-                   LIRDebugInfo info,
-                   Map<XirMark, Mark> marks) {
-        super(opcode, isLegal(result) ? new CiValue[] {result} : LIRInstruction.NO_OPERANDS, info, toArray(arguments, targetAddress), LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
-        this.marks = marks;
-        if (targetAddress == null) {
-            this.targetAddressIndex = -1;
-        } else {
-            // The last argument is the operand holding the address for the indirect call
-            assert inputs.length - 1 == arguments.size();
-            this.targetAddressIndex = arguments.size();
-        }
-        this.target = target;
-    }
-
-    public CiValue targetAddress() {
-        if (targetAddressIndex >= 0) {
-            return input(targetAddressIndex);
-        }
-        return null;
-    }
-
-    @Override
-    protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-        if (mode == OperandMode.Input) {
-            return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
-        } else if (mode == OperandMode.Output) {
-            return EnumSet.of(OperandFlag.Register, OperandFlag.Illegal);
-        }
-        throw Util.shouldNotReachHere();
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -157,7 +157,7 @@
     /**
      * The opcode of this instruction.
      */
-    public final LIROpcode code;
+    protected final Object code;
 
     /**
      * The output operands for this instruction (modified by the register allocator).
@@ -198,7 +198,7 @@
      * @param inputs the input operands for the instruction.
      * @param temps the temp operands for the instruction.
      */
-    public LIRInstruction(LIROpcode opcode, CiValue[] outputs, LIRDebugInfo info, CiValue[] inputs, CiValue[] alives, CiValue[] temps) {
+    public LIRInstruction(Object opcode, CiValue[] outputs, LIRDebugInfo info, CiValue[] inputs, CiValue[] alives, CiValue[] temps) {
         this.code = opcode;
         this.outputs = outputs;
         this.inputs = inputs;
@@ -319,8 +319,8 @@
     /**
      * Returns true when this instruction is a call instruction that destroys all caller-saved registers.
      */
-    public boolean hasCall() {
-        return false;
+    public final boolean hasCall() {
+        return this instanceof StandardOp.CallOp;
     }
 
     /**
@@ -362,8 +362,9 @@
      * @return The flags for the operand.
      */
     // TODO this method will go away when we have named operands, the flags will be specified as annotations instead.
-    protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-        return EnumSet.of(OperandFlag.Register);
+    protected abstract EnumSet<OperandFlag> flagsFor(OperandMode mode, int index);
+
+    protected void verify() {
     }
 
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIROpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2011, 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.lir;
-
-public interface LIROpcode {
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRVerifier.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2009, 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.compiler.lir;
+
+import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+
+import java.util.*;
+
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.criutils.*;
+import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandFlag;
+import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandMode;
+import com.oracle.max.graal.compiler.lir.LIRInstruction.ValueProcedure;
+import com.oracle.max.graal.compiler.lir.LIRPhiMapping.PhiValueProcedure;
+import com.oracle.max.graal.compiler.schedule.*;
+import com.oracle.max.graal.compiler.util.*;
+
+public final class LIRVerifier {
+    private final LIR lir;
+    private final FrameMap frameMap;
+
+    private final boolean beforeRegisterAllocation;
+
+    private final BitSet[] blockLiveOut;
+    private final Object[] variableDefinitions;
+
+    private BitSet liveOutFor(Block block) {
+        return blockLiveOut[block.blockID()];
+    }
+    private void setLiveOutFor(Block block, BitSet liveOut) {
+        blockLiveOut[block.blockID()] = liveOut;
+    }
+
+    private int maxRegisterNum() {
+        return frameMap.target.arch.registers.length;
+    }
+
+    private boolean isAllocatableRegister(CiValue value) {
+        return isRegister(value) && frameMap.registerConfig.getAttributesMap()[asRegister(value).number].isAllocatable;
+    }
+
+    public static boolean verify(final LIRInstruction op) {
+        ValueProcedure allowedProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) { return allowed(op, value, mode, flags); } };
+
+        op.forEachInput(allowedProc);
+        op.forEachAlive(allowedProc);
+        op.forEachState(allowedProc);
+        op.forEachTemp(allowedProc);
+        op.forEachOutput(allowedProc);
+
+        op.verify();
+        return true;
+    }
+
+    public static boolean verify(boolean beforeRegisterAllocation, LIR lir, FrameMap frameMap) {
+        LIRVerifier verifier = new LIRVerifier(beforeRegisterAllocation, lir, frameMap);
+        verifier.verify();
+        return true;
+    }
+
+
+    private LIRVerifier(boolean beforeRegisterAllocation, LIR lir, FrameMap frameMap) {
+        this.beforeRegisterAllocation = beforeRegisterAllocation;
+        this.lir = lir;
+        this.frameMap = frameMap;
+        this.blockLiveOut = new BitSet[lir.linearScanOrder().size()];
+        this.variableDefinitions = new Object[lir.numVariables()];
+    }
+
+    private BitSet curVariablesLive;
+    private CiValue[] curRegistersLive;
+
+    private LIRBlock curBlock;
+    private Object curInstruction;
+    private BitSet curRegistersDefined;
+
+    private void verify() {
+        PhiValueProcedure useProc = new PhiValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) { return use(value, mode, flags); } };
+        ValueProcedure defProc =    new ValueProcedure() {    @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) { return def(value, mode, flags); } };
+
+        curRegistersDefined = new BitSet();
+        for (LIRBlock block : lir.linearScanOrder()) {
+            curBlock = block;
+            curVariablesLive = new BitSet();
+            curRegistersLive = new CiValue[maxRegisterNum()];
+
+            if (block.dominator() != null) {
+                curVariablesLive.or(liveOutFor(block.dominator()));
+            }
+
+            if (block.phis != null) {
+                assert beforeRegisterAllocation;
+                curInstruction = block.phis;
+                block.phis.forEachOutput(defProc);
+            }
+
+            assert block.lir().get(0) instanceof StandardOp.LabelOp : "block must start with label";
+            if (block.numberOfSux() > 0) {
+                LIRInstruction last = block.lir().get(block.lir().size() - 1);
+                assert last instanceof StandardOp.JumpOp || last instanceof LIRXirInstruction : "block with successor must end with unconditional jump";
+            }
+
+            for (LIRInstruction op : block.lir()) {
+                curInstruction = op;
+
+                op.forEachInput(useProc);
+                if (op.hasCall()) {
+                    for (CiRegister register : frameMap.registerConfig.getCallerSaveRegisters()) {
+                        curRegistersLive[register.number] = null;
+                    }
+                }
+                curRegistersDefined.clear();
+                op.forEachAlive(useProc);
+                op.forEachState(useProc);
+                op.forEachTemp(defProc);
+                op.forEachOutput(defProc);
+
+                curInstruction = null;
+            }
+
+            for (LIRBlock sux : block.getLIRSuccessors()) {
+                if (sux.phis != null) {
+                    assert beforeRegisterAllocation;
+                    curInstruction = sux.phis;
+                    sux.phis.forEachInput(block, useProc);
+                }
+            }
+
+            setLiveOutFor(block, curVariablesLive);
+        }
+    }
+
+    private CiValue use(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) {
+        allowed(curInstruction, value, mode, flags);
+
+        if (isVariable(value)) {
+            assert beforeRegisterAllocation;
+
+            int variableIdx = asVariable(value).index;
+            if (!curVariablesLive.get(variableIdx)) {
+                TTY.println("block %s  instruction %s", curBlock, curInstruction);
+                TTY.println("live variables: %s", curVariablesLive);
+                if (variableDefinitions[variableIdx] != null) {
+                    TTY.println("definition of %s: %s", value, variableDefinitions[variableIdx]);
+                }
+                TTY.println("ERROR: Use of variable %s that is not defined in dominator", value);
+                throw Util.shouldNotReachHere();
+            }
+
+        } else if (isAllocatableRegister(value)) {
+            int regNum = asRegister(value).number;
+            if (mode == OperandMode.Alive) {
+                curRegistersDefined.set(regNum);
+            }
+
+            if (beforeRegisterAllocation && curRegistersLive[regNum] != value) {
+                TTY.println("block %s  instruction %s", curBlock, curInstruction);
+                TTY.println("live registers: %s", Arrays.toString(curRegistersLive));
+                TTY.println("ERROR: Use of fixed register %s that is not defined in this block", value);
+                throw Util.shouldNotReachHere();
+            }
+        }
+        return value;
+    }
+
+    private CiValue def(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) {
+        allowed(curInstruction, value, mode, flags);
+
+        if (isVariable(value)) {
+            assert beforeRegisterAllocation;
+
+            int variableIdx = asVariable(value).index;
+            if (variableDefinitions[variableIdx] != null) {
+                TTY.println("block %s  instruction %s", curBlock, curInstruction);
+                TTY.println("live variables: %s", curVariablesLive);
+                TTY.println("definition of %s: %s", value, variableDefinitions[variableIdx]);
+                TTY.println("ERROR: Variable %s defined multiple times", value);
+                throw Util.shouldNotReachHere();
+            }
+            assert curInstruction != null;
+            variableDefinitions[variableIdx] = curInstruction;
+            assert !curVariablesLive.get(variableIdx);
+            if (mode == OperandMode.Output) {
+                curVariablesLive.set(variableIdx);
+            }
+
+        } else if (isAllocatableRegister(value)) {
+            int regNum = asRegister(value).number;
+            if (curRegistersDefined.get(regNum)) {
+                TTY.println("block %s  instruction %s", curBlock, curInstruction);
+                TTY.println("ERROR: Same register defined twice in the same instruction: %s", value);
+                throw Util.shouldNotReachHere();
+            }
+            curRegistersDefined.set(regNum);
+
+            if (beforeRegisterAllocation) {
+                if (mode == OperandMode.Output) {
+                    curRegistersLive[regNum] = value;
+                } else {
+                    curRegistersLive[regNum] = null;
+                }
+            }
+        }
+        return value;
+    }
+
+    private static CiValue allowed(Object op, CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) {
+        if ((isVariable(value)  && flags.contains(OperandFlag.Register)) ||
+            (isRegister(value)  && flags.contains(OperandFlag.Register)) ||
+            (isStackSlot(value) && flags.contains(OperandFlag.Stack)) ||
+            (isConstant(value)  && flags.contains(OperandFlag.Constant) && mode != OperandMode.Output) ||
+            (isIllegal(value)   && flags.contains(OperandFlag.Illegal))) {
+            return value;
+        }
+        TTY.println("instruction %s", op);
+        TTY.println("mode: %s  flags: %s", mode, flags);
+        TTY.println("Unexpected value: %s %s", value.getClass().getSimpleName(), value);
+        throw Util.shouldNotReachHere();
+    }
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRXirInstruction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRXirInstruction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -27,8 +27,8 @@
 import java.util.*;
 
 import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 import com.oracle.max.cri.xir.*;
+import com.oracle.max.graal.compiler.util.*;
 
 public abstract class LIRXirInstruction extends LIRInstruction {
 
@@ -37,12 +37,11 @@
     public final int[] inputOperandIndices;
     public final int[] tempOperandIndices;
     public final XirSnippet snippet;
-    public final RiMethod method;
     public final LIRDebugInfo infoAfter;
-    private LabelRef trueSuccessor;
-    private LabelRef falseSuccessor;
+    public final LabelRef trueSuccessor;
+    public final LabelRef falseSuccessor;
 
-    public LIRXirInstruction(LIROpcode opcode,
+    public LIRXirInstruction(Object opcode,
                              XirSnippet snippet,
                              CiValue[] originalOperands,
                              CiValue outputOperand,
@@ -51,17 +50,19 @@
                              int outputOperandIndex,
                              LIRDebugInfo info,
                              LIRDebugInfo infoAfter,
-                             RiMethod method) {
+                             LabelRef trueSuccessor,
+                             LabelRef falseSuccessor) {
         // Note that we register the XIR input operands as Alive, because the XIR specification allows that input operands
         // are used at any time, even when the temp operands and the actual output operands have already be assigned.
         super(opcode, isLegal(outputOperand) ? new CiValue[] {outputOperand} : LIRInstruction.NO_OPERANDS, info, LIRInstruction.NO_OPERANDS, inputs, temps);
         this.infoAfter = infoAfter;
-        this.method = method;
         this.snippet = snippet;
         this.inputOperandIndices = inputOperandIndices;
         this.tempOperandIndices = tempOperandIndices;
         this.outputOperandIndex = outputOperandIndex;
         this.originalOperands = originalOperands;
+        this.falseSuccessor = falseSuccessor;
+        this.trueSuccessor = trueSuccessor;
         assert isLegal(outputOperand) || outputOperandIndex == -1;
     }
 
@@ -69,25 +70,10 @@
     protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
         if (mode == OperandMode.Alive || mode == OperandMode.Temp) {
             return EnumSet.of(OperandFlag.Register, OperandFlag.Constant, OperandFlag.Illegal);
+        } else if (mode == OperandMode.Output && index == 0) {
+            return EnumSet.of(OperandFlag.Register);
         }
-        return super.flagsFor(mode, index);
-    }
-
-    public void setFalseSuccessor(LabelRef falseSuccessor) {
-        this.falseSuccessor = falseSuccessor;
-    }
-
-
-    public void setTrueSuccessor(LabelRef trueSuccessor) {
-        this.trueSuccessor = trueSuccessor;
-    }
-
-    public LabelRef falseSuccessor() {
-        return falseSuccessor;
-    }
-
-    public LabelRef trueSuccessor() {
-        return trueSuccessor;
+        throw Util.shouldNotReachHere();
     }
 
     public CiValue[] getOperands() {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/MoveInstruction.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2012, 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.compiler.lir;
-
-import com.oracle.max.cri.ci.*;
-
-public abstract class MoveInstruction extends LIRInstruction {
-    public MoveInstruction(LIROpcode opcode, CiValue[] outputs, LIRDebugInfo info, CiValue[] inputs, CiValue[] alives, CiValue[] temps) {
-        super(opcode, outputs, info, inputs, alives, temps);
-    }
-
-    public abstract CiValue getSource();
-    public abstract CiValue getDest();
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/StandardOp.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2011, 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.compiler.lir;
+
+import java.util.*;
+
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.graal.compiler.asm.*;
+import com.oracle.max.graal.compiler.util.*;
+
+/**
+ * A collection of machine-independent LIR operations, as well as interfaces to be implemented for specific kinds or LIR
+ * operations.
+ */
+public class StandardOp {
+
+    /**
+     * Marker interface for a LIR operation that defines the position of a label.
+     * The first operation of every block must implement this interface.
+     */
+    public interface LabelOp {
+    }
+
+    /**
+     * Marker interface for a LIR operation that is an unconditional jump to {@link #destination()}.
+     * When the LIR is constructed, the last operation of every block must implement this interface. After
+     * register allocation, unnecessary jumps can be deleted.
+     *
+     * TODO Currently, a block can also end with an XIR operation.
+     */
+    public interface JumpOp {
+        LabelRef destination();
+    }
+
+    /**
+     * Marker interface for a LIR operation that is a conditional jump to {@link #destination()}.
+     * Conditional jumps may be negated or optimized away after register allocation.
+     */
+    public interface BranchOp {
+        LabelRef destination();
+        void negate(LabelRef newDestination);
+    }
+
+    /**
+     * Marker interface for a LIR operation that moves a value from {@link #getInput()} to {@link #getResult()}.
+     */
+    public interface MoveOp {
+        CiValue getInput();
+        CiValue getResult();
+    }
+
+    /**
+     * Marker interface for a LIR operation that calls a method, i.e., destroys all caller-saved registers.
+     */
+    public interface CallOp {
+    }
+
+
+    /**
+     * Meta-operation that defines the incoming method parameters. In the LIR, every register and variable must be
+     * defined before it is used. This operation is the definition point of method parameters, but is otherwise a no-op.
+     * In particular, it is not the actual method prologue.
+     */
+    public static final class ParametersOp extends LIRInstruction {
+        public ParametersOp(CiValue[] params) {
+            super("PARAMS", params, null, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm) {
+            // No code to emit.
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Output) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/StandardOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.lir;
-
-import java.util.*;
-
-import com.oracle.max.cri.ci.CiTargetMethod.Mark;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
-import com.oracle.max.cri.xir.CiXirAssembler.XirMark;
-import com.oracle.max.cri.xir.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public class StandardOpcode {
-    // Checkstyle: stop
-    public static MoveOpcode SPILL_MOVE;
-    public static NullCheckOpcode NULL_CHECK;
-    public static CallOpcode DIRECT_CALL;
-    public static CallOpcode INDIRECT_CALL;
-    public static LIROpcode LABEL;
-    public static LIROpcode JUMP;
-    public static ReturnOpcode RETURN;
-    public static XirOpcode XIR;
-    public static ParametersOpcode PARAMS = ParametersOpcode.PARAMS;
-    // Checkstyle: resume
-
-    public interface MoveOpcode extends LIROpcode {
-        MoveInstruction create(CiValue result, CiValue input);
-    }
-
-    public interface NullCheckOpcode extends LIROpcode {
-        LIRInstruction create(Variable input, LIRDebugInfo info);
-    }
-
-    public interface CallOpcode extends LIROpcode {
-        LIRInstruction create(Object target, CiValue result, List<CiValue> arguments, CiValue targetAddress, LIRDebugInfo info, Map<XirMark, Mark> marks);
-    }
-
-    public interface ReturnOpcode extends LIROpcode {
-        LIRInstruction create(CiValue input);
-    }
-
-    public interface XirOpcode extends LIROpcode {
-        LIRInstruction create(XirSnippet snippet, CiValue[] operands, CiValue outputOperand, CiValue[] inputs, CiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex,
-                        LIRDebugInfo info, LIRDebugInfo infoAfter, RiMethod method);
-    }
-
-
-    public enum ParametersOpcode implements LIROpcode {
-        @SuppressWarnings("hiding")
-        PARAMS;
-
-        public LIRInstruction create(CiValue[] params) {
-            return new LIRInstruction(this, params, null, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm) {
-                    // No code to emit. This is not the actual method prologue, but only a meta-instruction that defines the incoming method parameters.
-                }
-
-                @Override
-                protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                    if (mode == OperandMode.Output) {
-                        return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
-                    }
-                    throw Util.shouldNotReachHere();
-                }
-            };
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/package-info.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2009, 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.
- */
-
-/**
- *
- * Port of the backend (LIR) of the client compiler to Java.
- */
-package com.oracle.max.graal.compiler.lir;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/Loop.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/Loop.java	Thu Feb 02 16:07:52 2012 -0800
@@ -75,12 +75,12 @@
         return parent == l || (parent != null && parent.isChildOf(l));
     }
 
-    public boolean localContainsFixed(FixedNode n) {
+    public boolean containsDirectFixed(FixedNode n) {
         return directCFGNodes.isMarked(n);
     }
 
     public boolean containsFixed(FixedNode n) {
-        if (localContainsFixed(n)) {
+        if (containsDirectFixed(n)) {
             return true;
         }
         for (Loop child : children()) {
@@ -104,7 +104,7 @@
     }
 
     @SuppressWarnings("unchecked")
-    public Iterable<FixedNode> fixedNodes() {
+    public Iterable<FixedNode> directFixedNodes() {
         return (Iterable) directCFGNodes;
     }
 
@@ -113,7 +113,7 @@
         loop.parent = this;
     }
 
-    NodeBitMap directCFGNode() {
+    NodeBitMap directCFGNodes() {
         return directCFGNodes;
     }
 
@@ -134,4 +134,27 @@
         }
         return loopVariant;
     }
+
+    public int depth() {
+        if (parent() == null) {
+            return 0;
+        }
+        return parent().depth() + 1;
+    }
+
+    public int directFixedNodesCount() {
+        return directCFGNodes.cardinality();
+    }
+
+    public int fixedNodesCount() {
+        int count = directFixedNodesCount();
+        for (Loop child : children()) {
+            count += child.directFixedNodesCount();
+        }
+        return count;
+    }
+
+    public int exitsCount() {
+        return exits().cardinality();
+    }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/LoopInfo.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/LoopInfo.java	Thu Feb 02 16:07:52 2012 -0800
@@ -65,17 +65,26 @@
         }
     }
 
-    private void print(Loop loop) {
-        TTY.println("%s", loop.loopBegin());
-        TTY.println("-- subnodes");
-        for (Node node : loop.fixedNodes()) {
-            TTY.println("  " + node);
+    private void print(final Loop loop) {
+        TTY.out().printf("%s\n", loop.loopBegin());
+        TTY.out().println("-- exits");
+        TTY.out().adjustIndentation(+2);
+        for (Node n : loop.exits()) {
+            TTY.out().printf("%s from %s\n", n, n.predecessor());
         }
-        TTY.println("-- subloops");
+        TTY.out().adjustIndentation(-2);
+        TTY.out().println("-- directNodes");
+        TTY.out().adjustIndentation(+2);
+        for (final Node node : loop.directFixedNodes()) {
+            TTY.out().printf("%s\n", node);
+        }
+        TTY.out().adjustIndentation(-2);
+        TTY.out().println("-- subloops");
+        TTY.out().adjustIndentation(+2);
         for (Loop sub : loop.children()) {
             print(sub);
         }
-        TTY.println("-- sub");
-        TTY.println();
+        TTY.out().adjustIndentation(-2);
+        TTY.out().println("-- sub");
     }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/LoopUtil.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/LoopUtil.java	Thu Feb 02 16:07:52 2012 -0800
@@ -53,11 +53,13 @@
 
         //Find exits
         for (Loop loop : info.loops()) {
-            for (FixedNode n : loop.fixedNodes()) {
+            for (FixedNode n : loop.directFixedNodes()) {
                 if (n instanceof ControlSplitNode) {
                     for (BeginNode sux : ((ControlSplitNode) n).blockSuccessors()) {
-                        if (!loop.containsFixed(sux)) {
-                            loop.exits().mark(sux);
+                        Loop l = loop;
+                        while (l != null && !l.containsFixed(sux)) {
+                            l.exits().mark(sux);
+                            l = l.parent();
                         }
                     }
                 }
@@ -103,10 +105,10 @@
                 mark((LoopBeginNode) n, nodeToLoop);
             } else {
                 if (oldMark != null) {
-                    oldMark.directCFGNode().clear(n);
+                    oldMark.directCFGNodes().clear(n);
                 }
                 nodeToLoop.set(n, loop);
-                loop.directCFGNode().mark(n);
+                loop.directCFGNodes().mark(n);
             }
         }
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/BoxingEliminationPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/BoxingEliminationPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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.*;
@@ -36,7 +39,7 @@
 
     @Override
     protected void run(StructuredGraph graph) {
-        if (graph.getNodes(UnboxNode.class).iterator().hasNext()) {
+        if (graph.getNodes(UnboxNode.class).isNotEmpty()) {
 
             Map<PhiNode, PhiNode> phiReplacements = new HashMap<>();
             for (UnboxNode unboxNode : graph.getNodes(UnboxNode.class)) {
@@ -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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -22,10 +22,11 @@
  */
 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.criutils.*;
-import com.oracle.max.graal.compiler.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.calc.*;
@@ -64,9 +65,7 @@
         Tool tool = new Tool(nodeWorkList, runtime, target, assumptions);
         for (Node node : nodeWorkList) {
             if (node instanceof Canonicalizable) {
-                if (GraalOptions.TraceCanonicalizer) {
-                    TTY.println("Canonicalizer: work on " + node);
-                }
+                Debug.log("Canonicalizer: work on %s", node);
                 graph.mark();
                 ValueNode canonical = ((Canonicalizable) node).canonical(tool);
 //     cases:                                           original node:
@@ -235,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/ComputeProbabilityPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ComputeProbabilityPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,9 +24,8 @@
 
 import java.util.*;
 
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.graph.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 
@@ -50,27 +49,13 @@
     @Override
     protected void run(StructuredGraph graph) {
         new PropagateProbability(graph.start()).apply();
-        if (currentContext.isObserved() && GraalOptions.TraceProbability) {
-            currentContext.observable.fireCompilationEvent("After PropagateProbability", graph);
-        }
+        Debug.dump(graph, "After PropagateProbability");
         computeLoopFactors();
-        if (currentContext.isObserved() && GraalOptions.TraceProbability) {
-            currentContext.observable.fireCompilationEvent("After computeLoopFactors", graph);
-        }
+        Debug.dump(graph, "After computeLoopFactors");
         new PropagateLoopFrequency(graph.start()).apply();
     }
 
     private void computeLoopFactors() {
-        if (GraalOptions.TraceProbability) {
-            for (LoopInfo info : loopInfos) {
-                TTY.println("\nLoop " + info.loopBegin);
-                TTY.print("  requires: ");
-                for (LoopInfo r : info.requires) {
-                    TTY.print(r.loopBegin + " ");
-                }
-                TTY.println();
-            }
-        }
         for (LoopInfo info : loopInfos) {
             double frequency = info.loopFrequency();
             assert frequency != -1;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -22,8 +22,7 @@
  */
 package com.oracle.max.graal.compiler.phases;
 
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 
@@ -81,9 +80,7 @@
             if (!flood.isMarked(node)) {
                 LoopBeginNode loop = node.loopBegin();
                 if (flood.isMarked(loop)) {
-                    if (GraalOptions.TraceDeadCodeElimination) {
-                        TTY.println("Removing loop with unreachable end: " + loop);
-                    }
+                    Debug.log("Removing loop with unreachable end: %s", loop);
                     node.setLoopBegin(null);
                     EndNode endNode = loop.endAt(0);
                     assert endNode.predecessor() != null;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -29,6 +29,7 @@
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.graph.*;
 import com.oracle.max.graal.cri.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.PhiNode.PhiType;
@@ -305,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) {
@@ -428,21 +429,10 @@
             }
             if (invokes.size() == 0) {
 
-                if (currentContext.isObserved()) {
-                    currentContext.observable.fireCompilationEvent("Before escape " + node, graph);
-                }
-                if (GraalOptions.TraceEscapeAnalysis || GraalOptions.PrintEscapeAnalysis) {
-                    TTY.println("%n!!!!!!!! non-escaping object: %s (%s)", node, node.exactType());
-                }
-                try {
-                    currentContext.timers.startScope("Escape Analysis Fixup");
-                    removeAllocation(node, op);
-                } finally {
-                    currentContext.timers.endScope();
-                }
-                if (currentContext.isObserved()) {
-                    currentContext.observable.fireCompilationEvent("After escape", graph);
-                }
+                Debug.dump(graph, "Before escape %s", node);
+                Debug.log("!!!!!!!! non-escaping object: %s (%s)", node, node.exactType());
+                removeAllocation(node, op);
+                Debug.dump(graph, "After escape", graph);
                 break;
             }
             if (weight < minimumWeight) {
@@ -457,8 +447,8 @@
             if (GraalOptions.TraceEscapeAnalysis || GraalOptions.PrintEscapeAnalysis) {
                 TTY.println("Trying inlining to get a non-escaping object for %s", node);
             }
-            new InliningPhase(target, runtime, invokes, assumptions, plan).apply(graph, currentContext);
-            new DeadCodeEliminationPhase().apply(graph, currentContext);
+            new InliningPhase(target, runtime, invokes, assumptions, plan).apply(graph);
+            new DeadCodeEliminationPhase().apply(graph);
             if (node.isDeleted()) {
                 if (GraalOptions.TraceEscapeAnalysis || GraalOptions.PrintEscapeAnalysis) {
                     TTY.println("%n!!!!!!!! object died while performing escape analysis: %s (%s)", node, node.exactType());
@@ -514,9 +504,7 @@
                     }
                 } else {
                     exits.add(usage);
-                    if (!GraalOptions.TraceEscapeAnalysis) {
-                        break;
-                    }
+                    break;
                 }
             } else {
                 if (GraalOptions.ProbabilityAnalysis && usage instanceof FixedNode) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/FindInductionVariablesPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +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.phases;
-
-import java.util.*;
-
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.util.*;
-import com.oracle.max.graal.compiler.util.LoopUtil.Loop;
-import com.oracle.max.graal.graph.*;
-import com.oracle.max.graal.nodes.*;
-import com.oracle.max.graal.nodes.calc.*;
-import com.oracle.max.graal.nodes.loop.*;
-
-
-/**
- * Looks for linear induction variables in loops.
- * Saves the information in the graph by replacing these induction variables computations with subclasses of {@link InductionVariableNode} :
- * <ul>
- * <li> {@link LoopCounterNode} is the iteration counter (from 0 to Niter)</li>
- * <li> {@link BasicInductionVariableNode} is an induction variable of the form {@code stride * loopCount + init}. Computed using a phi and an add node</li>
- * <li> {@link DerivedInductionVariableNode} is an induction variable of the form {@code scale * base + offset} where base is an other of {@link InductionVariableNode}. Computed using multiply and add</li>
- * </ul>
- * This phase works in collaboration with {@link RemoveInductionVariablesPhase} which will convert the {@link InductionVariableNode}s back to phis and arithmetic nodes.
- */
-public class FindInductionVariablesPhase extends Phase {
-
-    @Override
-    protected void run(StructuredGraph graph) {
-        List<Loop> loops = LoopUtil.computeLoops(graph);
-
-        for (Loop loop : loops) {
-            findInductionVariables(loop);
-        }
-    }
-
-    private static void findInductionVariables(Loop loop) {
-        LoopBeginNode loopBegin = loop.loopBegin();
-        NodeBitMap loopNodes = loop.nodes();
-        for (PhiNode phi : loopBegin.phis().snapshot()) {
-            ValueNode init = phi.valueAt(loopBegin.forwardEdge());
-            ValueNode backEdge = phi.valueAt(loopBegin.loopEnd());
-            if (loopNodes.isNew(init) || loopNodes.isNew(backEdge)) {
-                continue;
-            }
-            if (loopNodes.isMarked(backEdge)) {
-                if (backEdge instanceof IntegerAddNode || backEdge instanceof IntegerSubNode) {
-                    final IntegerArithmeticNode arithmetic = (IntegerArithmeticNode) backEdge;
-                    ValueNode stride;
-                    if (arithmetic.x() == phi) {
-                        stride = arithmetic.y();
-                    } else if (arithmetic.y() == phi) {
-                        stride = arithmetic.x();
-                    } else {
-                        continue;
-                    }
-                    if (loopNodes.isNotNewNotMarked(stride)) {
-                        Graph graph = loopBegin.graph();
-                        if (arithmetic instanceof IntegerSubNode) {
-                            stride = graph.unique(new NegateNode(stride));
-                        }
-                        CiKind kind = phi.kind();
-                        LoopCounterNode counter = loopBegin.loopCounter(kind);
-                        BasicInductionVariableNode biv1 = null;
-                        BasicInductionVariableNode biv2 = null;
-                        if (phi.usages().size() > 1) {
-                            biv1 = graph.add(new BasicInductionVariableNode(kind, init, stride, counter));
-                            ((StructuredGraph) phi.graph()).replaceFloating(phi, biv1);
-                        } else {
-                            phi.replaceFirstInput(arithmetic, null);
-                            phi.safeDelete();
-                        }
-                        if (arithmetic.usages().size() > 0) {
-                            biv2 = graph.add(new BasicInductionVariableNode(kind, IntegerArithmeticNode.add(init, stride), stride, counter));
-                            ((StructuredGraph) arithmetic.graph()).replaceFloating(arithmetic, biv2);
-                        } else {
-                            arithmetic.safeDelete();
-                        }
-                        if (biv1 != null) {
-                            findDerivedInductionVariable(biv1, kind, loopNodes);
-                        }
-                        if (biv2 != null) {
-                            findDerivedInductionVariable(biv2, kind, loopNodes);
-                        }
-                    }
-                }
-            }
-        }
-    }
-    private static void findDerivedInductionVariable(BasicInductionVariableNode biv, CiKind kind, NodeBitMap loopNodes) {
-        for (Node usage : biv.usages().snapshot()) {
-            ValueNode scale = scale(usage, biv, loopNodes);
-            ValueNode offset = null;
-            Node node = null;
-            if (scale == null) {
-                if (usage instanceof IntegerAddNode) {
-                    IntegerAddNode add = (IntegerAddNode) usage;
-                    if (add.x() == biv || (scale = scale(add.x(), biv, loopNodes)) != null) {
-                        offset = add.y();
-                    } else if (add.y() == biv || (scale = scale(add.y(), biv, loopNodes)) != null) {
-                        offset = add.x();
-                    }
-                    if (offset != null) {
-                        if (loopNodes.isNotNewNotMarked(offset)) {
-                            node = add;
-                        } else {
-                            offset = null;
-                        }
-                    }
-                }
-            } else {
-                node = usage;
-            }
-            if (scale != null || offset != null) {
-                if (scale == null) {
-                    scale = ConstantNode.forIntegerKind(kind, 1, biv.graph());
-                } else if (offset == null) {
-                    offset = ConstantNode.forIntegerKind(kind, 0, biv.graph());
-                }
-                DerivedInductionVariableNode div = biv.graph().add(new DerivedInductionVariableNode(kind, offset, scale, biv));
-                assert node instanceof FloatingNode;
-                ((StructuredGraph) node.graph()).replaceFloating((FloatingNode) node, div);
-            }
-        }
-    }
-
-    private static ValueNode scale(Node n, BasicInductionVariableNode biv, NodeBitMap loopNodes) {
-        if (n instanceof IntegerMulNode) {
-            IntegerMulNode mul = (IntegerMulNode) n;
-            ValueNode scale = null;
-            if (mul.x() == biv) {
-                scale = mul.y();
-            } else if (mul.y() == biv) {
-                scale = mul.x();
-            }
-            if (scale != null && loopNodes.isNotNewNotMarked(scale)) {
-                return scale;
-            }
-        }
-        return null;
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/FloatingReadPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/FloatingReadPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,13 +25,12 @@
 import java.util.*;
 
 import com.oracle.max.cri.ci.*;
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.loop.*;
 import com.oracle.max.graal.compiler.schedule.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
-import com.oracle.max.graal.nodes.PhiNode.*;
+import com.oracle.max.graal.nodes.PhiNode.PhiType;
 import com.oracle.max.graal.nodes.extended.*;
 
 public class FloatingReadPhase extends Phase {
@@ -74,9 +73,7 @@
         }
 
         public void mergeWith(MemoryMap otherMemoryMap, Block b) {
-            if (GraalOptions.TraceMemoryMaps) {
-                TTY.println("merging block " + otherMemoryMap.block + " into block " + block);
-            }
+            Debug.log("Merging block %s into block %s.", otherMemoryMap.block, block);
             IdentityHashMap<Object, Node> otherMap = otherMemoryMap.map;
 
             for (Map.Entry<Object, Node> entry : map.entrySet()) {
@@ -109,19 +106,14 @@
 
         private void mergeNodes(Object location, Node original, Node newValue, Block mergeBlock) {
             if (original == newValue) {
-                // Nothing to merge.
-                if (GraalOptions.TraceMemoryMaps) {
-                    TTY.println("Nothing to merge both nodes are " + original);
-                }
+                Debug.log("Nothing to merge both nodes are %s.", original);
                 return;
             }
             MergeNode m = (MergeNode) mergeBlock.firstNode();
             if (m.isPhiAtMerge(original)) {
                 PhiNode phi = (PhiNode) original;
                 phi.addInput((ValueNode) newValue);
-                if (GraalOptions.TraceMemoryMaps) {
-                    TTY.println("Add new input to " + original + ": " + newValue);
-                }
+                Debug.log("Add new input to %s: %s.", original, newValue);
                 assert phi.valueCount() <= phi.merge().endCount() : phi.merge();
             } else {
                 PhiNode phi = m.graph().unique(new PhiNode(CiKind.Illegal, m, PhiType.Memory));
@@ -129,9 +121,7 @@
                     phi.addInput((ValueNode) original);
                 }
                 phi.addInput((ValueNode) newValue);
-                if (GraalOptions.TraceMemoryMaps) {
-                    TTY.println("Creating new " + phi + " merge=" + phi.merge() + ", mergeOperationCount=" + mergeOperationCount + ", newValue=" + newValue + ", location=" + location);
-                }
+                Debug.log("Creating new %s merge=%s newValue=%s location=%s.", phi, phi.merge(), newValue, location);
                 assert phi.valueCount() <= phi.merge().endCount() + ((phi.merge() instanceof LoopBeginNode) ? 1 : 0) : phi.merge() + "/" + phi.valueCount() + "/" + phi.merge().endCount() + "/" + mergeOperationCount;
                 assert m.usages().contains(phi);
                 assert phi.merge().usages().contains(phi);
@@ -155,10 +145,7 @@
             StructuredGraph graph = (StructuredGraph) readNode.graph();
             assert readNode.getNullCheck() == false;
 
-            if (GraalOptions.TraceMemoryMaps) {
-                TTY.println("Register read to node " + readNode);
-            }
-
+            Debug.log("Register read to node %s.", readNode);
             FloatingReadNode floatingRead;
             if (readNode.location().locationIdentity() == LocationNode.FINAL_LOCATION) {
                 floatingRead = graph.unique(new FloatingReadNode(readNode.kind(), readNode.object(), readNode.guard(), readNode.location()));
@@ -245,13 +232,11 @@
             propagateFromChildren(loop, modifiedValues);
         }
 
-        if (GraalOptions.TraceMemoryMaps) {
-            print(loopInfo, modifiedValues);
-        }
+        Debug.log("Modified values: %s.", modifiedValues);
 
         // Identify blocks.
         final IdentifyBlocksPhase s = new IdentifyBlocksPhase(false);
-        s.apply(graph, currentContext);
+        s.apply(graph);
         List<Block> blocks = s.getBlocks();
 
         // Process blocks (predecessors first).
@@ -343,15 +328,6 @@
         modifiedValues.get(loop).add(locationIdentity);
     }
 
-    private static void print(LoopInfo loopInfo, HashMap<Loop, Set<Object>> modifiedValues) {
-        TTY.println();
-        TTY.println("Loops:");
-        for (Loop loop : loopInfo.loops()) {
-            TTY.print(loop + " modified values: " + modifiedValues.get(loop));
-            TTY.println();
-        }
-    }
-
     private void mark(LoopBeginNode begin, LoopBeginNode outer, NodeMap<LoopBeginNode> nodeToLoop) {
 
         if (nodeToLoop.get(begin) != null) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GlobalValueNumberingPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GlobalValueNumberingPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -22,13 +22,14 @@
  */
 package com.oracle.max.graal.compiler.phases;
 
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 
 public class GlobalValueNumberingPhase extends Phase {
 
+    public static final DebugMetric metricGlobalValueNumberingHits = Debug.metric("GlobalValueNumberingHits");
+
     @Override
     protected void run(StructuredGraph graph) {
         NodeBitMap visited = graph.createNodeBitMap();
@@ -46,13 +47,11 @@
             if (n.getNodeClass().valueNumberable()) {
                 Node newNode = compilerGraph.findDuplicate(n);
                 if (newNode != null) {
-                    n.replaceAndDelete(newNode);
-                    if (GraalOptions.Meter) {
-                        currentContext.metrics.GlobalValueNumberingHits++;
-                    }
-                    if (GraalOptions.TraceGVN) {
-                        TTY.println("GVN applied and new node is " + newNode);
-                    }
+                    assert !(n instanceof FixedNode || newNode instanceof FixedNode);
+                    n.replaceAtUsages(newNode);
+                    n.safeDelete();
+                    metricGlobalValueNumberingHits.increment();
+                    Debug.log("GVN applied and new node is %1s", newNode);
                 }
             }
         }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -26,13 +26,13 @@
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
-import com.oracle.max.criutils.*;
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.phases.PhasePlan.PhasePosition;
 import com.oracle.max.graal.compiler.util.*;
 import com.oracle.max.graal.compiler.util.InliningUtil.InlineInfo;
 import com.oracle.max.graal.compiler.util.InliningUtil.InliningCallback;
 import com.oracle.max.graal.cri.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 
@@ -54,6 +54,10 @@
 
     private final PhasePlan plan;
 
+    // Metrics
+    private static final DebugMetric metricInliningPerformed = Debug.metric("InliningPerformed");
+    private static final DebugMetric metricInliningConsidered = Debug.metric("InliningConsidered");
+
     public InliningPhase(CiTarget target, GraalRuntime runtime, Collection<Invoke> hints, CiAssumptions assumptions, PhasePlan plan) {
         this.target = target;
         this.runtime = runtime;
@@ -78,36 +82,24 @@
             InlineInfo info = inlineCandidates.remove();
             double penalty = Math.pow(GraalOptions.InliningSizePenaltyExp, graph.getNodeCount() / (double) GraalOptions.MaximumDesiredSize) / GraalOptions.InliningSizePenaltyExp;
             if (info.weight > GraalOptions.MaximumInlineWeight / (1 + penalty * GraalOptions.InliningSizePenalty)) {
-                if (GraalOptions.TraceInlining) {
-                    TTY.println("not inlining (cut off by weight):");
-                    while (info != null) {
-                        TTY.println("    %f %s", info.weight, info);
-                        info = inlineCandidates.poll();
-                    }
-                }
+                Debug.log("not inlining (cut off by weight): %e", info.weight);
                 return;
             }
             Iterable<Node> newNodes = null;
             if (info.invoke.node().isAlive()) {
                 try {
                     info.inline(graph, runtime, this);
-                    if (GraalOptions.TraceInlining) {
-                        TTY.println("inlining %f: %s", info.weight, info);
-                    }
-                    if (GraalOptions.TraceInlining) {
-                        currentContext.observable.fireCompilationEvent("after inlining " + info, graph);
-                    }
+                    Debug.log("inlining %f: %s", info.weight, info);
+                    Debug.dump(graph, "after inlining %s", info);
                     // get the new nodes here, the canonicalizer phase will reset the mark
                     newNodes = graph.getNewNodes();
                     if (GraalOptions.OptCanonicalizer) {
                         new CanonicalizerPhase(target, runtime, true, assumptions).apply(graph);
                     }
                     if (GraalOptions.Intrinsify) {
-                        new IntrinsificationPhase(runtime).apply(graph, currentContext);
+                        new IntrinsificationPhase(runtime).apply(graph);
                     }
-                    if (GraalOptions.Meter) {
-                        currentContext.metrics.InlinePerformed++;
-                    }
+                    metricInliningPerformed.increment();
                 } catch (CiBailout bailout) {
                     // TODO determine if we should really bail out of the whole compilation.
                     throw bailout;
@@ -133,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);
                 }
             }
         }
@@ -146,10 +135,7 @@
     private void scanInvoke(Invoke invoke, int level) {
         InlineInfo info = InliningUtil.getInlineInfo(invoke, level, runtime, assumptions, this);
         if (info != null) {
-            if (GraalOptions.Meter) {
-                currentContext.metrics.InlineConsidered++;
-            }
-
+            metricInliningConsidered.increment();
             inlineCandidates.add(info);
         }
     }
@@ -161,14 +147,14 @@
         StructuredGraph newGraph = new StructuredGraph(method);
 
         if (plan != null) {
-            plan.runPhases(PhasePosition.AFTER_PARSING, newGraph, currentContext);
+            plan.runPhases(PhasePosition.AFTER_PARSING, newGraph);
         }
 
         if (GraalOptions.ProbabilityAnalysis) {
-            new DeadCodeEliminationPhase().apply(newGraph, currentContext, false);
-            new ComputeProbabilityPhase().apply(newGraph, currentContext, false);
+            new DeadCodeEliminationPhase().apply(newGraph);
+            new ComputeProbabilityPhase().apply(newGraph);
         }
-        new CanonicalizerPhase(target, runtime, assumptions).apply(newGraph, currentContext, false);
+        new CanonicalizerPhase(target, runtime, assumptions).apply(newGraph);
         return newGraph;
     }
 
@@ -214,9 +200,9 @@
             if (!parsedMethods.containsKey(method)) {
                 StructuredGraph newGraph = new StructuredGraph(method);
                 if (plan != null) {
-                    plan.runPhases(PhasePosition.AFTER_PARSING, newGraph, currentContext);
+                    plan.runPhases(PhasePosition.AFTER_PARSING, newGraph);
                 }
-                new CanonicalizerPhase(target, runtime, assumptions).apply(newGraph, currentContext, false);
+                new CanonicalizerPhase(target, runtime, assumptions).apply(newGraph);
                 count = graphComplexity(newGraph);
                 parsedMethods.put(method, count);
             } else {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InsertStateAfterPlaceholderPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,38 @@
+/*
+ * 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.compiler.phases;
+
+import com.oracle.max.graal.nodes.*;
+
+public class InsertStateAfterPlaceholderPhase extends Phase {
+
+    @Override
+    protected void run(StructuredGraph graph) {
+        for (ReturnNode ret : graph.getNodes(ReturnNode.class)) {
+            PlaceholderNode p = graph.add(new PlaceholderNode());
+            p.setStateAfter(graph.add(new FrameState(null, FrameState.AFTER_BCI, 0, 0, false)));
+            graph.addBeforeFixed(ret, p);
+        }
+    }
+
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoweringPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoweringPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -40,7 +40,7 @@
     @Override
     protected void run(final StructuredGraph graph) {
         final IdentifyBlocksPhase s = new IdentifyBlocksPhase(false);
-        s.apply(graph, currentContext);
+        s.apply(graph);
         s.calculateAlwaysReachedBlock();
 
         NodeBitMap processed = graph.createNodeBitMap();
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -22,100 +22,35 @@
  */
 package com.oracle.max.graal.compiler.phases;
 
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.*;
-import com.oracle.max.graal.compiler.schedule.*;
-import com.oracle.max.graal.graph.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.nodes.*;
 
 public abstract class Phase {
 
-    private final String name;
-    private final boolean shouldVerify;
-    protected GraalContext currentContext;
+    private String name;
 
     protected Phase() {
         this.name = this.getClass().getSimpleName();
-        this.shouldVerify = GraalOptions.VerifyPhases;
+        if (name.endsWith("Phase")) {
+            name = name.substring(0, name.length() - "Phase".length());
+        }
     }
 
     protected Phase(String name) {
-        this(name, GraalOptions.VerifyPhases);
-    }
-
-    protected Phase(String name, boolean shouldVerify) {
         this.name = name;
-        this.shouldVerify = shouldVerify;
     }
 
     protected String getDetailedName() {
         return getName();
     }
 
-    public final void apply(StructuredGraph graph) {
-        apply(graph, GraalContext.EMPTY_CONTEXT);
-    }
-
-    public final void apply(StructuredGraph graph, GraalContext context) {
-        apply(graph, context, true);
-    }
-
-    public final void apply(StructuredGraph graph, boolean plot) {
-        apply(graph,  GraalContext.EMPTY_CONTEXT, plot);
-    }
-
-    public final void apply(StructuredGraph graph, GraalContext context, boolean plot) {
-
-        this.currentContext = context;
-        try {
-            assert graph != null && (!shouldVerify || graph.verify());
-        } catch (GraalInternalError e) {
-            throw e.addContext("start of phase", getDetailedName());
-        }
-
-        int startDeletedNodeCount = graph.getDeletedNodeCount();
-        int startNodeCount = graph.getNodeCount();
-        if (context != null) {
-            context.timers.startScope(getName());
-        }
-        try {
-            try {
-                run(graph);
-            } catch (CiBailout bailout) {
-                throw bailout;
-            } catch (AssertionError e) {
-                throw new GraalInternalError(e);
-            } catch (RuntimeException e) {
-                throw new GraalInternalError(e);
-            } finally {
-                if (context != null) {
-                    context.timers.endScope();
-                }
+    public final void apply(final StructuredGraph graph) {
+        Debug.scope(name, this, new Runnable() {
+            public void run() {
+                Phase.this.run(graph);
+                Debug.dump(graph, "After phase %s", name);
             }
-        } catch (GraalInternalError e) {
-            throw e.addContext(graph).addContext("phase", getDetailedName());
-        }
-
-        if (context != null) {
-            if (GraalOptions.Meter) {
-                int deletedNodeCount = graph.getDeletedNodeCount() - startDeletedNodeCount;
-                int createdNodeCount = graph.getNodeCount() - startNodeCount + deletedNodeCount;
-                context.metrics.get(getName().concat(".executed")).increment();
-                context.metrics.get(getName().concat(".deletedNodes")).increment(deletedNodeCount);
-                context.metrics.get(getName().concat(".createdNodes")).increment(createdNodeCount);
-            }
-
-            boolean shouldFireCompilationEvents = context.isObserved() && this.getClass() != IdentifyBlocksPhase.class && (plot || GraalOptions.PlotVerbose);
-            if (shouldFireCompilationEvents && context.timers.currentLevel() < GraalOptions.PlotLevel) {
-                context.observable.fireCompilationEvent("After " + getName(), graph);
-            }
-        }
-
-        try {
-            assert !shouldVerify || graph.verify();
-        } catch (GraalInternalError e) {
-            throw e.addContext("end of phase", getDetailedName());
-        }
+        });
     }
 
     public final String getName() {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/PhasePlan.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/PhasePlan.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.nodes.*;
 
 /**
@@ -68,10 +67,10 @@
         phases[pos.ordinal()].add(phase);
     }
 
-    public void runPhases(PhasePosition pos, StructuredGraph graph, GraalContext context) {
+    public void runPhases(PhasePosition pos, StructuredGraph graph) {
         if (phases[pos.ordinal()] != null) {
             for (Phase p : phases[pos.ordinal()]) {
-                p.apply(graph, context);
+                p.apply(graph);
             }
         }
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/PhiStampPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/PhiStampPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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/ReadEliminationPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ReadEliminationPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -22,8 +22,7 @@
  */
 package com.oracle.max.graal.compiler.phases;
 
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.extended.*;
@@ -39,9 +38,7 @@
                 if (memoryInput instanceof WriteNode) {
                     WriteNode other = (WriteNode) memoryInput;
                     if (other.object() == n.object() && other.location() == n.location()) {
-                        if (GraalOptions.TraceReadElimination) {
-                            TTY.println("Eliminated memory read " + n + "and replaced with node " + other.value());
-                        }
+                        Debug.log("Eliminated memory read %1.1s and replaced with node %s", n, other.value());
                         graph.replaceFloating(n, other.value());
                     }
                 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/RemoveInductionVariablesPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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.phases;
-
-import java.util.*;
-import java.util.Map.Entry;
-
-import com.oracle.max.graal.graph.*;
-import com.oracle.max.graal.nodes.*;
-import com.oracle.max.graal.nodes.loop.*;
-
-/**
- * This phase looks for {@link InductionVariableNode}s and converts them to Phis and arithmetic nodes.
- */
-public class RemoveInductionVariablesPhase extends Phase {
-
-    private NodeMap<ValueNode> loweredIV;
-
-    @Override
-    protected void run(StructuredGraph graph) {
-        loweredIV = graph.createNodeMap();
-
-        for (LoopBeginNode loopBegin : graph.getNodes(LoopBeginNode.class)) {
-            Collection<InductionVariableNode> inductionVariables = loopBegin.inductionVariables();
-            Map<InductionVariableNode, InductionVariableNode> nextIterOf = null;
-            for (InductionVariableNode iv1 : inductionVariables) {
-                for (InductionVariableNode iv2 : inductionVariables) {
-                    if (iv1 != iv2 && iv1.isNextIteration(iv2)) {
-                        if (nextIterOf == null) {
-                            nextIterOf = new IdentityHashMap<>();
-                        }
-                        nextIterOf.put(iv2, iv1);
-                    }
-                }
-            }
-
-            for (InductionVariableNode iv : inductionVariables) {
-                if (nextIterOf == null || !nextIterOf.containsKey(iv)) {
-                    loweredIV.set(iv, iv.lowerInductionVariable());
-                }
-            }
-
-            if (nextIterOf != null) {
-                for (Entry<InductionVariableNode, InductionVariableNode> entry : nextIterOf.entrySet()) {
-                    InductionVariableNode it = entry.getValue();
-                    InductionVariableNode nextIt = entry.getKey();
-                    // can't fuse if nextIt is used in the loopBegin's framestate because this would pop the backedge value out of the loop in scheduler
-                    if (it != null && !nextIt.usages().contains(loopBegin.stateAfter())) {
-                        ValueNode itValue = loweredIV.get(it);
-                        if (itValue instanceof PhiNode) {
-                            PhiNode phi = (PhiNode) itValue;
-                            loweredIV.set(nextIt, phi.valueAt(loopBegin.loopEnd()));
-                            continue;
-                        }
-                    }
-                    loweredIV.set(nextIt, nextIt.lowerInductionVariable());
-                }
-            }
-        }
-        for (Entry<Node, ValueNode> entry : loweredIV.entries()) {
-            InductionVariableNode iv = (InductionVariableNode) entry.getKey();
-            ValueNode lower = entry.getValue();
-            for (Node usage : iv.usages().snapshot()) {
-                if (!(usage instanceof InductionVariableNode)) {
-                    usage.replaceFirstInput(iv, lower);
-                } else {
-                    usage.replaceFirstInput(iv, null);
-                }
-            }
-            iv.safeDelete();
-        }
-    }
-
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/RemovePlaceholderPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +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.phases;
-
-import com.oracle.max.graal.nodes.*;
-
-public class RemovePlaceholderPhase extends Phase {
-    @Override
-    protected void run(StructuredGraph graph) {
-        for (PlaceholderNode n : graph.getNodes(PlaceholderNode.class)) {
-            graph.removeFixed(n);
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/SafepointPollingEliminationPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/SafepointPollingEliminationPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/SnippetIntrinsificationPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -156,6 +156,7 @@
         Constructor< ? > constructor;
         try {
             constructor = nodeClass.getDeclaredConstructor(parameterTypes);
+            constructor.setAccessible(true);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
@@ -169,36 +170,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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -33,7 +33,6 @@
 import com.oracle.max.graal.graph.Node.Verbosity;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.extended.*;
-import com.oracle.max.graal.nodes.loop.*;
 import com.oracle.max.graal.nodes.virtual.*;
 
 
@@ -58,7 +57,7 @@
     }
 
     public IdentifyBlocksPhase(boolean scheduleAllNodes, BlockFactory blockFactory) {
-        super(scheduleAllNodes ? "FullSchedule" : "PartSchedule", false);
+        super(scheduleAllNodes ? "FullSchedule" : "PartSchedule");
         this.blockFactory = blockFactory;
         this.scheduleAllNodes = scheduleAllNodes;
     }
@@ -180,15 +179,8 @@
         }
 
         if (n instanceof MergeNode) {
-            for (Node usage : n.usages()) {
-                if (usage instanceof PhiNode) {
-                    nodeToBlock.set(usage, b);
-                }
-            }
-            if (n instanceof LoopBeginNode) {
-                for (InductionVariableNode iv : ((LoopBeginNode) n).inductionVariables()) {
-                    nodeToBlock.set(iv, b);
-                }
+            for (PhiNode phi : ((MergeNode) n).phis()) {
+                nodeToBlock.set(phi, b);
             }
         }
         if (n instanceof EndNode) {
@@ -454,12 +446,6 @@
                 block = getCommonDominator(block, nodeToBlock.get(pred));
             }
             closure.apply(block);
-        } else if (usage instanceof LinearInductionVariableNode) {
-            LinearInductionVariableNode liv = (LinearInductionVariableNode) usage;
-            if (liv.isLinearInductionVariableInput(node)) {
-                Block mergeBlock = nodeToBlock.get(liv.loopBegin());
-                closure.apply(mergeBlock.dominator());
-            }
         } else {
             assignBlockToNode(usage);
             closure.apply(nodeToBlock.get(usage));
@@ -531,7 +517,7 @@
     }
 
     private void addToSorting(Block b, Node i, List<Node> sortedInstructions, NodeBitMap map) {
-        if (i == null || map.isMarked(i) || nodeToBlock.get(i) != b || i instanceof PhiNode || i instanceof LocalNode || i instanceof InductionVariableNode) {
+        if (i == null || map.isMarked(i) || nodeToBlock.get(i) != b || i instanceof PhiNode || i instanceof LocalNode) {
             return;
         }
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/Backend.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/Backend.java	Thu Feb 02 16:07:52 2012 -0800
@@ -28,7 +28,6 @@
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
 import com.oracle.max.cri.xir.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.gen.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.graph.*;
@@ -57,7 +56,7 @@
     }
 
     public abstract FrameMap newFrameMap(RiRegisterConfig registerConfig);
-    public abstract LIRGenerator newLIRGenerator(GraalContext context, Graph graph, FrameMap frameMap, RiResolvedMethod method, LIR lir, RiXirGenerator xir);
+    public abstract LIRGenerator newLIRGenerator(Graph graph, FrameMap frameMap, RiResolvedMethod method, LIR lir, RiXirGenerator xir);
     public abstract AbstractAssembler newAssembler(RiRegisterConfig registerConfig);
     public abstract CiXirAssembler newXirAssembler();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Arithmetic.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,559 @@
+/*
+ * Copyright (c) 2011, 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.compiler.target.amd64;
+
+import static com.oracle.max.cri.ci.CiValueUtil.*;
+
+import java.util.*;
+
+import com.oracle.max.asm.*;
+import com.oracle.max.asm.target.amd64.*;
+import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag;
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.graal.compiler.asm.*;
+import com.oracle.max.graal.compiler.lir.*;
+import com.oracle.max.graal.compiler.util.*;
+
+public enum AMD64Arithmetic {
+    IADD, ISUB, IMUL, IDIV, IREM, IUDIV, IUREM, IAND, IOR, IXOR, ISHL, ISHR, IUSHR,
+    LADD, LSUB, LMUL, LDIV, LREM, LUDIV, LUREM, LAND, LOR, LXOR, LSHL, LSHR, LUSHR,
+    FADD, FSUB, FMUL, FDIV, FAND, FOR, FXOR,
+    DADD, DSUB, DMUL, DDIV, DAND, DOR, DXOR,
+    INEG, LNEG,
+    I2L, L2I, I2B, I2C, I2S,
+    F2D, D2F,
+    I2F, I2D, F2I, D2I,
+    L2F, L2D, F2L, D2L,
+    MOV_I2F, MOV_L2D, MOV_F2I, MOV_D2L;
+
+
+    public static class Op1Reg extends AMD64LIRInstruction {
+        public Op1Reg(AMD64Arithmetic opcode, CiValue result, CiValue x) {
+            super(opcode, new CiValue[] {result}, null, new CiValue[] {x}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            CiValue result = output(0);
+            CiValue x = input(0);
+
+            emit(tasm, masm, (AMD64Arithmetic) code, result, x, null);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+    public static class Op1Stack extends AMD64LIRInstruction {
+        public Op1Stack(AMD64Arithmetic opcode, CiValue result, CiValue x) {
+            super(opcode, new CiValue[] {result}, null, new CiValue[] {x}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            CiValue result = output(0);
+            CiValue x = input(0);
+
+            AMD64Move.move(tasm, masm, result, x);
+            emit(tasm, masm, (AMD64Arithmetic) code, result);
+        }
+
+        @Override
+        public EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+    public static class Op2Stack extends AMD64LIRInstruction {
+        public Op2Stack(AMD64Arithmetic opcode, CiValue result, CiValue x, CiValue y) {
+            super(opcode, new CiValue[] {result}, null, new CiValue[] {x}, new CiValue[] {y}, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            CiValue result = output(0);
+            CiValue x = input(0);
+            CiValue y = alive(0);
+
+            AMD64Move.move(tasm, masm, result, x);
+            emit(tasm, masm, (AMD64Arithmetic) code, result, y, null);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
+            } else if (mode == OperandMode.Alive && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
+            }
+            throw Util.shouldNotReachHere();
+        }
+
+        @Override
+        public void verify() {
+            CiValue result = output(0);
+            CiValue x = input(0);
+            CiValue y = alive(0);
+
+            super.verify();
+            assert differentRegisters(result, y) || sameRegister(x, y);
+            verifyKind((AMD64Arithmetic) code, result, x, y);
+        }
+    }
+
+    public static class Op2Reg extends AMD64LIRInstruction {
+        public Op2Reg(AMD64Arithmetic opcode, CiValue result, CiValue x, CiValue y) {
+            super(opcode, new CiValue[] {result}, null, new CiValue[] {x}, new CiValue[] {y}, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            CiValue result = output(0);
+            CiValue x = input(0);
+            CiValue y = alive(0);
+
+            AMD64Move.move(tasm, masm, result, x);
+            emit(tasm, masm, (AMD64Arithmetic) code, result, y, null);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
+            } else if (mode == OperandMode.Alive && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Constant);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
+            }
+            throw Util.shouldNotReachHere();
+        }
+
+        @Override
+        public void verify() {
+            CiValue result = output(0);
+            CiValue x = input(0);
+            CiValue y = alive(0);
+
+            super.verify();
+            assert differentRegisters(result, y) || sameRegister(x, y);
+            verifyKind((AMD64Arithmetic) code, result, x, y);
+        }
+    }
+
+    public static class Op2RegCommutative extends AMD64LIRInstruction {
+        public Op2RegCommutative(AMD64Arithmetic opcode, CiValue result, CiValue x, CiValue y) {
+            super(opcode, new CiValue[] {result}, null, new CiValue[] {x, y}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            CiValue result = output(0);
+            CiValue x = input(0);
+            CiValue y = input(1);
+
+            if (sameRegister(result, y)) {
+                emit(tasm, masm, (AMD64Arithmetic) code, result, x, null);
+            } else {
+                AMD64Move.move(tasm, masm, result, x);
+                emit(tasm, masm, (AMD64Arithmetic) code, result, y, null);
+            }
+        }
+
+        @Override
+        public EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
+            } else if (mode == OperandMode.Input && index == 1) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Constant);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
+            }
+            throw Util.shouldNotReachHere();
+        }
+
+        @Override
+        protected void verify() {
+            CiValue result = output(0);
+            CiValue x = input(0);
+            CiValue y = input(1);
+
+            super.verify();
+            verifyKind((AMD64Arithmetic) code, result, x, y);
+        }
+    }
+
+    public static class ShiftOp extends AMD64LIRInstruction {
+        public ShiftOp(AMD64Arithmetic opcode, CiValue result, CiValue x, CiValue y) {
+            super(opcode, new CiValue[] {result}, null, new CiValue[] {x}, new CiValue[] {y}, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            CiValue result = output(0);
+            CiValue x = input(0);
+            CiValue y = alive(0);
+
+            AMD64Move.move(tasm, masm, result, x);
+            emit(tasm, masm, (AMD64Arithmetic) code, result, y, null);
+        }
+
+        @Override
+        public EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
+            } else if (mode == OperandMode.Alive && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Constant);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
+            }
+            throw Util.shouldNotReachHere();
+        }
+
+        @Override
+        public void verify() {
+            CiValue result = output(0);
+            CiValue x = input(0);
+            CiValue y = alive(0);
+
+            super.verify();
+            assert isConstant(y) || asRegister(y) == AMD64.rcx;
+            assert differentRegisters(result, y) || sameRegister(x, y);
+            verifyKind((AMD64Arithmetic) code, result, x, x);
+            assert y.kind.stackKind() == CiKind.Int;
+        }
+    }
+
+    public static class DivOp extends AMD64LIRInstruction {
+        public DivOp(AMD64Arithmetic opcode, CiValue result, CiValue x, CiValue y, LIRDebugInfo info) {
+            super(opcode, new CiValue[] {result}, info, new CiValue[] {x}, new CiValue[] {y}, new CiValue[] {asRegister(result) == AMD64.rax ? AMD64.rdx.asValue(result.kind) : AMD64.rax.asValue(result.kind)});
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            CiValue result = output(0);
+            CiValue y = alive(0);
+
+            emit(tasm, masm, (AMD64Arithmetic) code, result, y, info);
+        }
+
+        @Override
+        public EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            } else if (mode == OperandMode.Alive && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            } else if (mode == OperandMode.Temp && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            }
+            throw Util.shouldNotReachHere();
+        }
+
+        @Override
+        protected void verify() {
+            CiValue result = output(0);
+            CiValue x = input(0);
+            CiValue y = alive(0);
+
+            super.verify();
+            // left input in rax, right input in any register but rax and rdx, result quotient in rax, result remainder in rdx
+            assert asRegister(x) == AMD64.rax;
+            assert differentRegisters(y, AMD64.rax.asValue(), AMD64.rdx.asValue());
+            assert (name().endsWith("DIV") && asRegister(result) == AMD64.rax) || (name().endsWith("REM") && asRegister(result) == AMD64.rdx);
+            verifyKind((AMD64Arithmetic) code, result, x, y);
+        }
+    }
+
+
+    @SuppressWarnings("unused")
+    protected static void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Arithmetic opcode, CiValue result) {
+        switch (opcode) {
+            case INEG: masm.negl(asIntReg(result)); break;
+            case LNEG: masm.negq(asLongReg(result)); break;
+            case L2I:  masm.andl(asIntReg(result), 0xFFFFFFFF); break;
+            case I2B:  masm.signExtendByte(asIntReg(result)); break;
+            case I2C:  masm.andl(asIntReg(result), 0xFFFF); break;
+            case I2S:  masm.signExtendShort(asIntReg(result)); break;
+            default:   throw Util.shouldNotReachHere();
+        }
+    }
+
+    protected static void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Arithmetic opcode, CiValue dst, CiValue src, LIRDebugInfo info) {
+        int exceptionOffset = -1;
+        if (isRegister(src)) {
+            switch (opcode) {
+                case IADD: masm.addl(asIntReg(dst),  asIntReg(src)); break;
+                case ISUB: masm.subl(asIntReg(dst),  asIntReg(src)); break;
+                case IAND: masm.andl(asIntReg(dst),  asIntReg(src)); break;
+                case IMUL: masm.imull(asIntReg(dst), asIntReg(src)); break;
+                case IOR:  masm.orl(asIntReg(dst),   asIntReg(src)); break;
+                case IXOR: masm.xorl(asIntReg(dst),  asIntReg(src)); break;
+                case ISHL: masm.shll(asIntReg(dst)); break;
+                case ISHR: masm.sarl(asIntReg(dst)); break;
+                case IUSHR:masm.shrl(asIntReg(dst)); break;
+
+                case LADD: masm.addq(asLongReg(dst),  asLongReg(src)); break;
+                case LSUB: masm.subq(asLongReg(dst),  asLongReg(src)); break;
+                case LMUL: masm.imulq(asLongReg(dst), asLongReg(src)); break;
+                case LAND: masm.andq(asLongReg(dst),  asLongReg(src)); break;
+                case LOR:  masm.orq(asLongReg(dst),   asLongReg(src)); break;
+                case LXOR: masm.xorq(asLongReg(dst),  asLongReg(src)); break;
+                case LSHL: masm.shlq(asLongReg(dst)); break;
+                case LSHR: masm.sarq(asLongReg(dst)); break;
+                case LUSHR:masm.shrq(asLongReg(dst)); break;
+
+                case FADD: masm.addss(asFloatReg(dst), asFloatReg(src)); break;
+                case FSUB: masm.subss(asFloatReg(dst), asFloatReg(src)); break;
+                case FMUL: masm.mulss(asFloatReg(dst), asFloatReg(src)); break;
+                case FDIV: masm.divss(asFloatReg(dst), asFloatReg(src)); break;
+                case FAND: masm.andps(asFloatReg(dst), asFloatReg(src)); break;
+                case FOR:  masm.orps(asFloatReg(dst),  asFloatReg(src)); break;
+                case FXOR: masm.xorps(asFloatReg(dst), asFloatReg(src)); break;
+
+                case DADD: masm.addsd(asDoubleReg(dst), asDoubleReg(src)); break;
+                case DSUB: masm.subsd(asDoubleReg(dst), asDoubleReg(src)); break;
+                case DMUL: masm.mulsd(asDoubleReg(dst), asDoubleReg(src)); break;
+                case DDIV: masm.divsd(asDoubleReg(dst), asDoubleReg(src)); break;
+                case DAND: masm.andpd(asDoubleReg(dst), asDoubleReg(src)); break;
+                case DOR:  masm.orpd(asDoubleReg(dst),  asDoubleReg(src)); break;
+                case DXOR: masm.xorpd(asDoubleReg(dst), asDoubleReg(src)); break;
+
+                case I2L: masm.movslq(asLongReg(dst), asIntReg(src)); break;
+                case F2D: masm.cvtss2sd(asDoubleReg(dst), asFloatReg(src)); break;
+                case D2F: masm.cvtsd2ss(asFloatReg(dst), asDoubleReg(src)); break;
+                case I2F: masm.cvtsi2ssl(asFloatReg(dst), asIntReg(src)); break;
+                case I2D: masm.cvtsi2sdl(asDoubleReg(dst), asIntReg(src)); break;
+                case L2F: masm.cvtsi2ssq(asFloatReg(dst), asLongReg(src)); break;
+                case L2D: masm.cvtsi2sdq(asDoubleReg(dst), asLongReg(src)); break;
+                case F2I:
+                    masm.cvttss2sil(asIntReg(dst), asFloatReg(src));
+                    emitConvertFixup(tasm, masm, dst, src);
+                    break;
+                case D2I:
+                    masm.cvttsd2sil(asIntReg(dst), asDoubleReg(src));
+                    emitConvertFixup(tasm, masm, dst, src);
+                    break;
+                case F2L:
+                    masm.cvttss2siq(asLongReg(dst), asFloatReg(src));
+                    emitConvertFixup(tasm, masm, dst, src);
+                    break;
+                case D2L:
+                    masm.cvttsd2siq(asLongReg(dst), asDoubleReg(src));
+                    emitConvertFixup(tasm, masm, dst, src);
+                    break;
+                case MOV_I2F: masm.movdl(asFloatReg(dst), asIntReg(src)); break;
+                case MOV_L2D: masm.movdq(asDoubleReg(dst), asLongReg(src)); break;
+                case MOV_F2I: masm.movdl(asIntReg(dst), asFloatReg(src)); break;
+                case MOV_D2L: masm.movdq(asLongReg(dst), asDoubleReg(src)); break;
+
+                case IDIV:
+                case IREM:
+                    masm.cdql();
+                    exceptionOffset = masm.codeBuffer.position();
+                    masm.idivl(asRegister(src));
+                    break;
+
+                case LDIV:
+                case LREM:
+                    Label continuation = new Label();
+                    if (opcode == LDIV) {
+                        // check for special case of Long.MIN_VALUE / -1
+                        Label normalCase = new Label();
+                        masm.movq(AMD64.rdx, java.lang.Long.MIN_VALUE);
+                        masm.cmpq(AMD64.rax, AMD64.rdx);
+                        masm.jcc(ConditionFlag.notEqual, normalCase);
+                        masm.cmpl(asRegister(src), -1);
+                        masm.jcc(ConditionFlag.equal, continuation);
+                        masm.bind(normalCase);
+                    }
+
+                    masm.cdqq();
+                    exceptionOffset = masm.codeBuffer.position();
+                    masm.idivq(asRegister(src));
+                    masm.bind(continuation);
+                    break;
+
+                case IUDIV:
+                case IUREM:
+                    // Must zero the high 64-bit word (in RDX) of the dividend
+                    masm.xorq(AMD64.rdx, AMD64.rdx);
+                    exceptionOffset = masm.codeBuffer.position();
+                    masm.divl(asRegister(src));
+                    break;
+
+                case LUDIV:
+                case LUREM:
+                    // Must zero the high 64-bit word (in RDX) of the dividend
+                    masm.xorq(AMD64.rdx, AMD64.rdx);
+                    exceptionOffset = masm.codeBuffer.position();
+                    masm.divq(asRegister(src));
+                    break;
+                default:
+                    throw Util.shouldNotReachHere();
+            }
+        } else if (isConstant(src)) {
+            switch (opcode) {
+                case IADD: masm.incrementl(asIntReg(dst), tasm.asIntConst(src)); break;
+                case ISUB: masm.decrementl(asIntReg(dst), tasm.asIntConst(src)); break;
+                case IMUL: masm.imull(asIntReg(dst), asIntReg(dst), tasm.asIntConst(src)); break;
+                case IAND: masm.andl(asIntReg(dst), tasm.asIntConst(src)); break;
+                case IOR:  masm.orl(asIntReg(dst),  tasm.asIntConst(src)); break;
+                case IXOR: masm.xorl(asIntReg(dst), tasm.asIntConst(src)); break;
+                case ISHL: masm.shll(asIntReg(dst), tasm.asIntConst(src) & 31); break;
+                case ISHR: masm.sarl(asIntReg(dst), tasm.asIntConst(src) & 31); break;
+                case IUSHR:masm.shrl(asIntReg(dst), tasm.asIntConst(src) & 31); break;
+
+                case LADD: masm.addq(asLongReg(dst), tasm.asIntConst(src)); break;
+                case LSUB: masm.subq(asLongReg(dst), tasm.asIntConst(src)); break;
+                case LMUL: masm.imulq(asLongReg(dst), asLongReg(dst), tasm.asIntConst(src)); break;
+                case LAND: masm.andq(asLongReg(dst), tasm.asIntConst(src)); break;
+                case LOR:  masm.orq(asLongReg(dst),  tasm.asIntConst(src)); break;
+                case LXOR: masm.xorq(asLongReg(dst), tasm.asIntConst(src)); break;
+                case LSHL: masm.shlq(asLongReg(dst), tasm.asIntConst(src) & 63); break;
+                case LSHR: masm.sarq(asLongReg(dst), tasm.asIntConst(src) & 63); break;
+                case LUSHR:masm.shrq(asLongReg(dst), tasm.asIntConst(src) & 63); break;
+
+                case FADD: masm.addss(asFloatReg(dst), tasm.asFloatConstRef(src)); break;
+                case FSUB: masm.subss(asFloatReg(dst), tasm.asFloatConstRef(src)); break;
+                case FMUL: masm.mulss(asFloatReg(dst), tasm.asFloatConstRef(src)); break;
+                case FAND: masm.andps(asFloatReg(dst), tasm.asFloatConstRef(src, 16)); break;
+                case FOR:  masm.orps(asFloatReg(dst),  tasm.asFloatConstRef(src, 16)); break;
+                case FXOR: masm.xorps(asFloatReg(dst), tasm.asFloatConstRef(src, 16)); break;
+                case FDIV: masm.divss(asFloatReg(dst), tasm.asFloatConstRef(src)); break;
+
+                case DADD: masm.addsd(asDoubleReg(dst), tasm.asDoubleConstRef(src)); break;
+                case DSUB: masm.subsd(asDoubleReg(dst), tasm.asDoubleConstRef(src)); break;
+                case DMUL: masm.mulsd(asDoubleReg(dst), tasm.asDoubleConstRef(src)); break;
+                case DDIV: masm.divsd(asDoubleReg(dst), tasm.asDoubleConstRef(src)); break;
+                case DAND: masm.andpd(asDoubleReg(dst), tasm.asDoubleConstRef(src, 16)); break;
+                case DOR:  masm.orpd(asDoubleReg(dst),  tasm.asDoubleConstRef(src, 16)); break;
+                case DXOR: masm.xorpd(asDoubleReg(dst), tasm.asDoubleConstRef(src, 16)); break;
+                default:   throw Util.shouldNotReachHere();
+            }
+        } else {
+            switch (opcode) {
+                case IADD: masm.addl(asIntReg(dst), tasm.asIntAddr(src)); break;
+                case ISUB: masm.subl(asIntReg(dst), tasm.asIntAddr(src)); break;
+                case IAND: masm.andl(asIntReg(dst), tasm.asIntAddr(src)); break;
+                case IOR:  masm.orl(asIntReg(dst),  tasm.asIntAddr(src)); break;
+                case IXOR: masm.xorl(asIntReg(dst), tasm.asIntAddr(src)); break;
+
+                case LADD: masm.addq(asLongReg(dst), tasm.asLongAddr(src)); break;
+                case LSUB: masm.subq(asLongReg(dst), tasm.asLongAddr(src)); break;
+                case LAND: masm.andq(asLongReg(dst), tasm.asLongAddr(src)); break;
+                case LOR:  masm.orq(asLongReg(dst),  tasm.asLongAddr(src)); break;
+                case LXOR: masm.xorq(asLongReg(dst), tasm.asLongAddr(src)); break;
+
+                case FADD: masm.addss(asFloatReg(dst), tasm.asFloatAddr(src)); break;
+                case FSUB: masm.subss(asFloatReg(dst), tasm.asFloatAddr(src)); break;
+                case FMUL: masm.mulss(asFloatReg(dst), tasm.asFloatAddr(src)); break;
+                case FDIV: masm.divss(asFloatReg(dst), tasm.asFloatAddr(src)); break;
+
+                case DADD: masm.addsd(asDoubleReg(dst), tasm.asDoubleAddr(src)); break;
+                case DSUB: masm.subsd(asDoubleReg(dst), tasm.asDoubleAddr(src)); break;
+                case DMUL: masm.mulsd(asDoubleReg(dst), tasm.asDoubleAddr(src)); break;
+                case DDIV: masm.divsd(asDoubleReg(dst), tasm.asDoubleAddr(src)); break;
+                default:   throw Util.shouldNotReachHere();
+            }
+        }
+
+        if (info != null) {
+            assert exceptionOffset != -1;
+            tasm.recordImplicitException(exceptionOffset, info);
+        }
+    }
+
+    private static void emitConvertFixup(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue x) {
+        ConvertSlowPath slowPath = new ConvertSlowPath(result, x);
+        tasm.slowPaths.add(slowPath);
+        switch (result.kind) {
+            case Int:  masm.cmpl(asIntReg(result),  Integer.MIN_VALUE); break;
+            case Long: masm.cmpq(asLongReg(result), tasm.asLongConstRef(CiConstant.forLong(java.lang.Long.MIN_VALUE))); break;
+            default:   throw Util.shouldNotReachHere();
+        }
+        masm.jcc(ConditionFlag.equal, slowPath.start);
+        masm.bind(slowPath.continuation);
+    }
+
+    private static class ConvertSlowPath extends AMD64SlowPath {
+        public final Label start = new Label();
+        public final Label continuation = new Label();
+        private final CiValue result;
+        private final CiValue x;
+
+        public ConvertSlowPath(CiValue result, CiValue x) {
+            this.result = result;
+            this.x = x;
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            masm.bind(start);
+            switch (x.kind) {
+                case Float:  masm.ucomiss(asFloatReg(x),  tasm.asFloatConstRef(CiConstant.FLOAT_0)); break;
+                case Double: masm.ucomisd(asDoubleReg(x), tasm.asDoubleConstRef(CiConstant.DOUBLE_0)); break;
+                default:     throw Util.shouldNotReachHere();
+            }
+            Label nan = new Label();
+            masm.jcc(ConditionFlag.parity, nan);
+            masm.jcc(ConditionFlag.below, continuation);
+
+            // input is > 0 -> return maxInt
+            // result register already contains 0x80000000, so subtracting 1 gives 0x7fffffff
+            switch (result.kind) {
+                case Int:  masm.decrementl(asIntReg(result),  1); break;
+                case Long: masm.decrementq(asLongReg(result), 1); break;
+                default:   throw Util.shouldNotReachHere();
+            }
+            masm.jmp(continuation);
+
+            // input is NaN -> return 0
+            masm.bind(nan);
+            masm.xorptr(asRegister(result), asRegister(result));
+            masm.jmp(continuation);
+        }
+    }
+
+
+    private static void verifyKind(AMD64Arithmetic opcode, CiValue result, CiValue x, CiValue y) {
+        assert (opcode.name().startsWith("I") && result.kind == CiKind.Int && x.kind.stackKind() == CiKind.Int && y.kind.stackKind() == CiKind.Int)
+            || (opcode.name().startsWith("L") && result.kind == CiKind.Long && x.kind == CiKind.Long && y.kind == CiKind.Long)
+            || (opcode.name().startsWith("F") && result.kind == CiKind.Float && x.kind == CiKind.Float && y.kind == CiKind.Float)
+            || (opcode.name().startsWith("D") && result.kind == CiKind.Double && x.kind == CiKind.Double && y.kind == CiKind.Double);
+    }
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ArithmeticOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public enum AMD64ArithmeticOpcode implements LIROpcode {
-    IADD, ISUB, IAND, IOR, IXOR,
-    LADD, LSUB, LAND, LOR, LXOR,
-    FADD, FSUB, FMUL, FDIV,
-    DADD, DSUB, DMUL, DDIV;
-
-    public LIRInstruction create(CiValue result, CiValue x, CiValue y) {
-        assert (name().startsWith("I") && result.kind == CiKind.Int && x.kind.stackKind() == CiKind.Int && y.kind.stackKind() == CiKind.Int)
-            || (name().startsWith("L") && result.kind == CiKind.Long && x.kind == CiKind.Long && y.kind == CiKind.Long)
-            || (name().startsWith("F") && result.kind == CiKind.Float && x.kind == CiKind.Float && y.kind == CiKind.Float)
-            || (name().startsWith("D") && result.kind == CiKind.Double && x.kind == CiKind.Double && y.kind == CiKind.Double);
-
-        CiValue[] inputs = new CiValue[] {x};
-        CiValue[] alives = new CiValue[] {y};
-        CiValue[] outputs = new CiValue[] {result};
-
-        return new AMD64LIRInstruction(this, outputs, null, inputs, alives, LIRInstruction.NO_OPERANDS) {
-            @Override
-            public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                emit(tasm, masm, output(0), input(0), alive(0));
-            }
-
-            @Override
-            public EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                if (mode == OperandMode.Input && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
-                } else if (mode == OperandMode.Alive && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
-                } else if (mode == OperandMode.Output && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
-                }
-                return super.flagsFor(mode, index);
-            }
-        };
-    }
-
-    protected void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue x, CiValue y) {
-        assert sameRegister(x, y) || differentRegisters(result, y);
-        AMD64MoveOpcode.move(tasm, masm, result, x);
-
-        CiRegister dst = asRegister(result);
-        if (isRegister(y)) {
-            CiRegister rreg = asRegister(y);
-            switch (this) {
-                case IADD: masm.addl(dst,  rreg); break;
-                case ISUB: masm.subl(dst,  rreg); break;
-                case IAND: masm.andl(dst,  rreg); break;
-                case IOR:  masm.orl(dst,   rreg); break;
-                case IXOR: masm.xorl(dst,  rreg); break;
-                case LADD: masm.addq(dst,  rreg); break;
-                case LSUB: masm.subq(dst,  rreg); break;
-                case LAND: masm.andq(dst,  rreg); break;
-                case LOR:  masm.orq(dst,   rreg); break;
-                case LXOR: masm.xorq(dst,  rreg); break;
-                case FADD: masm.addss(dst, rreg); break;
-                case FSUB: masm.subss(dst, rreg); break;
-                case FMUL: masm.mulss(dst, rreg); break;
-                case FDIV: masm.divss(dst, rreg); break;
-                case DADD: masm.addsd(dst, rreg); break;
-                case DSUB: masm.subsd(dst, rreg); break;
-                case DMUL: masm.mulsd(dst, rreg); break;
-                case DDIV: masm.divsd(dst, rreg); break;
-                default:   throw Util.shouldNotReachHere();
-            }
-        } else if (isConstant(y)) {
-            switch (this) {
-                case IADD: masm.incrementl(dst, tasm.asIntConst(y)); break;
-                case ISUB: masm.decrementl(dst, tasm.asIntConst(y)); break;
-                case IAND: masm.andl(dst,  tasm.asIntConst(y)); break;
-                case IOR:  masm.orl(dst,   tasm.asIntConst(y)); break;
-                case IXOR: masm.xorl(dst,  tasm.asIntConst(y)); break;
-                case LADD: masm.addq(dst,  tasm.asIntConst(y)); break;
-                case LSUB: masm.subq(dst,  tasm.asIntConst(y)); break;
-                case LAND: masm.andq(dst,  tasm.asIntConst(y)); break;
-                case LOR:  masm.orq(dst,   tasm.asIntConst(y)); break;
-                case LXOR: masm.xorq(dst,  tasm.asIntConst(y)); break;
-                case FADD: masm.addss(dst, tasm.asFloatConstRef(y)); break;
-                case FSUB: masm.subss(dst, tasm.asFloatConstRef(y)); break;
-                case FMUL: masm.mulss(dst, tasm.asFloatConstRef(y)); break;
-                case FDIV: masm.divss(dst, tasm.asFloatConstRef(y)); break;
-                case DADD: masm.addsd(dst, tasm.asDoubleConstRef(y)); break;
-                case DSUB: masm.subsd(dst, tasm.asDoubleConstRef(y)); break;
-                case DMUL: masm.mulsd(dst, tasm.asDoubleConstRef(y)); break;
-                case DDIV: masm.divsd(dst, tasm.asDoubleConstRef(y)); break;
-                default:   throw Util.shouldNotReachHere();
-            }
-        } else {
-            CiAddress raddr = tasm.asAddress(y);
-            switch (this) {
-                case IADD: masm.addl(dst,  raddr); break;
-                case ISUB: masm.subl(dst,  raddr); break;
-                case IAND: masm.andl(dst,  raddr); break;
-                case IOR:  masm.orl(dst,   raddr); break;
-                case IXOR: masm.xorl(dst,  raddr); break;
-                case LADD: masm.addq(dst,  raddr); break;
-                case LSUB: masm.subq(dst,  raddr); break;
-                case LAND: masm.andq(dst,  raddr); break;
-                case LOR:  masm.orq(dst,   raddr); break;
-                case LXOR: masm.xorq(dst,  raddr); break;
-                case FADD: masm.addss(dst, raddr); break;
-                case FSUB: masm.subss(dst, raddr); break;
-                case FMUL: masm.mulss(dst, raddr); break;
-                case FDIV: masm.divss(dst, raddr); break;
-                case DADD: masm.addsd(dst, raddr); break;
-                case DSUB: masm.subsd(dst, raddr); break;
-                case DMUL: masm.mulsd(dst, raddr); break;
-                case DDIV: masm.divsd(dst, raddr); break;
-                default:  throw Util.shouldNotReachHere();
-            }
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Backend.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Backend.java	Thu Feb 02 16:07:52 2012 -0800
@@ -27,7 +27,6 @@
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
 import com.oracle.max.cri.xir.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.gen.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.target.*;
@@ -47,8 +46,8 @@
      * @return an appropriate LIR generator instance
      */
     @Override
-    public LIRGenerator newLIRGenerator(GraalContext context, Graph graph, FrameMap frameMap, RiResolvedMethod method, LIR lir, RiXirGenerator xir) {
-        return new AMD64LIRGenerator(context, graph, runtime, target, frameMap, method, lir, xir);
+    public LIRGenerator newLIRGenerator(Graph graph, FrameMap frameMap, RiResolvedMethod method, LIR lir, RiXirGenerator xir) {
+        return new AMD64LIRGenerator(graph, runtime, target, frameMap, method, lir, xir);
     }
 
     @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Call.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2011, 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.compiler.target.amd64;
+
+import static com.oracle.max.cri.ci.CiValueUtil.*;
+
+import java.util.*;
+
+import com.oracle.max.asm.target.amd64.*;
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.cri.ci.CiTargetMethod.Mark;
+import com.oracle.max.cri.xir.CiXirAssembler.XirMark;
+import com.oracle.max.graal.compiler.*;
+import com.oracle.max.graal.compiler.asm.*;
+import com.oracle.max.graal.compiler.lir.*;
+import com.oracle.max.graal.compiler.util.*;
+
+public class AMD64Call {
+
+    public static class DirectCallOp extends AMD64LIRInstruction implements StandardOp.CallOp {
+        private final Object targetMethod;
+        private final Map<XirMark, Mark> marks;
+
+        public DirectCallOp(Object targetMethod, CiValue result, CiValue[] parameters, LIRDebugInfo info, Map<XirMark, Mark> marks) {
+            super("CALL_DIRECT", new CiValue[] {result}, info, parameters, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+            this.targetMethod = targetMethod;
+            this.marks = marks;
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            callAlignment(tasm, masm);
+            if (marks != null) {
+                marks.put(XirMark.CALLSITE, tasm.recordMark(null, new Mark[0]));
+            }
+            directCall(tasm, masm, targetMethod, info);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
+            } else if (mode == OperandMode.Output) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Illegal);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+    public static class IndirectCallOp extends AMD64LIRInstruction implements StandardOp.CallOp {
+        private final Object targetMethod;
+        private final Map<XirMark, Mark> marks;
+
+        private static CiValue[] concat(CiValue[] parameters, CiValue targetAddress) {
+            CiValue[] result = Arrays.copyOf(parameters, parameters.length + 1);
+            result[result.length - 1] = targetAddress;
+            return result;
+        }
+
+        public IndirectCallOp(Object targetMethod, CiValue result, CiValue[] parameters, CiValue targetAddress, LIRDebugInfo info, Map<XirMark, Mark> marks) {
+            super("CALL_INDIRECT", new CiValue[] {result}, info, concat(parameters, targetAddress), LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+            this.targetMethod = targetMethod;
+            this.marks = marks;
+        }
+
+        private CiValue targetAddress() {
+            return input(inputs.length - 1);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            callAlignment(tasm, masm);
+            if (marks != null) {
+                marks.put(XirMark.CALLSITE, tasm.recordMark(null, new Mark[0]));
+            }
+            indirectCall(tasm, masm, asRegister(targetAddress()), targetMethod, info);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
+            } else if (mode == OperandMode.Output) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Illegal);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static void callAlignment(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+        if (GraalOptions.AlignCallsForPatching) {
+            // make sure that the displacement word of the call ends up word aligned
+            int offset = masm.codeBuffer.position();
+            offset += tasm.target.arch.machineCodeCallDisplacementOffset;
+            while (offset++ % tasm.target.wordSize != 0) {
+                masm.nop();
+            }
+        }
+    }
+
+    public static void directCall(TargetMethodAssembler tasm, AMD64MacroAssembler masm, Object target, LIRDebugInfo info) {
+        int before = masm.codeBuffer.position();
+        if (target instanceof CiRuntimeCall) {
+            long maxOffset = tasm.runtime.getMaxCallTargetOffset((CiRuntimeCall) target);
+            if (maxOffset != (int) maxOffset) {
+                // offset might not fit a 32-bit immediate, generate an
+                // indirect call with a 64-bit immediate
+                CiRegister scratch = tasm.frameMap.registerConfig.getScratchRegister();
+                // TODO(cwi): we want to get rid of a generally reserved scratch register.
+                masm.movq(scratch, 0L);
+                masm.call(scratch);
+            } else {
+                masm.call();
+            }
+        } else {
+            masm.call();
+        }
+        int after = masm.codeBuffer.position();
+        tasm.recordDirectCall(before, after, tasm.runtime.asCallTarget(target), info);
+        tasm.recordExceptionHandlers(after, info);
+        masm.ensureUniquePC();
+    }
+
+    public static void directJmp(TargetMethodAssembler tasm, AMD64MacroAssembler masm, Object target) {
+        int before = masm.codeBuffer.position();
+        masm.jmp(0, true);
+        int after = masm.codeBuffer.position();
+        tasm.recordDirectCall(before, after, tasm.runtime.asCallTarget(target), null);
+        masm.ensureUniquePC();
+    }
+
+    public static void indirectCall(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiRegister dst, Object target, LIRDebugInfo info) {
+        int before = masm.codeBuffer.position();
+        masm.call(dst);
+        int after = masm.codeBuffer.position();
+        tasm.recordIndirectCall(before, after, tasm.runtime.asCallTarget(target), info);
+        tasm.recordExceptionHandlers(after, info);
+        masm.ensureUniquePC();
+    }
+
+    public static void shouldNotReachHere(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+        if (GraalOptions.GenAssertionCode) {
+            directCall(tasm, masm, CiRuntimeCall.Debug, null);
+            masm.hlt();
+        }
+    }
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CallOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiTargetMethod.Mark;
-import com.oracle.max.cri.xir.CiXirAssembler.XirMark;
-import com.oracle.max.graal.compiler.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public enum AMD64CallOpcode implements StandardOpcode.CallOpcode {
-    DIRECT_CALL, INDIRECT_CALL, NATIVE_CALL;
-
-    public LIRInstruction create(Object target, CiValue result, List<CiValue> arguments, CiValue targetAddress, LIRDebugInfo info, Map<XirMark, Mark> marks) {
-        return new LIRCall(this, target, result, arguments, targetAddress, info, marks) {
-            @Override
-            public void emitCode(TargetMethodAssembler tasm) {
-                emit(tasm, (AMD64MacroAssembler) tasm.asm, this);
-            }
-
-            @Override
-            public boolean hasCall() {
-                return true;
-            }
-        };
-    }
-
-    private void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, LIRCall op) {
-        switch (this) {
-            case DIRECT_CALL: {
-                callAlignment(tasm, masm);
-                if (op.marks != null) {
-                    op.marks.put(XirMark.CALLSITE, tasm.recordMark(null, new Mark[0]));
-                }
-                directCall(tasm, masm, op.target, op.info);
-                break;
-            }
-            case INDIRECT_CALL: {
-                callAlignment(tasm, masm);
-                if (op.marks != null) {
-                    op.marks.put(XirMark.CALLSITE, tasm.recordMark(null, new Mark[0]));
-                }
-                CiRegister reg = asRegister(op.targetAddress());
-                indirectCall(tasm, masm, reg, op.target, op.info);
-                break;
-            }
-            case NATIVE_CALL: {
-                CiRegister reg = asRegister(op.targetAddress());
-                indirectCall(tasm, masm, reg, op.target, op.info);
-                break;
-            }
-            default:
-                throw Util.shouldNotReachHere();
-        }
-    }
-
-
-    public static void callAlignment(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-        if (GraalOptions.AlignCallsForPatching) {
-            // make sure that the displacement word of the call ends up word aligned
-            int offset = masm.codeBuffer.position();
-            offset += tasm.target.arch.machineCodeCallDisplacementOffset;
-            while (offset++ % tasm.target.wordSize != 0) {
-                masm.nop();
-            }
-        }
-    }
-
-    public static void directCall(TargetMethodAssembler tasm, AMD64MacroAssembler masm, Object target, LIRDebugInfo info) {
-        int before = masm.codeBuffer.position();
-        if (target instanceof CiRuntimeCall) {
-            long maxOffset = tasm.runtime.getMaxCallTargetOffset((CiRuntimeCall) target);
-            if (maxOffset != (int) maxOffset) {
-                // offset might not fit a 32-bit immediate, generate an
-                // indirect call with a 64-bit immediate
-                CiRegister scratch = tasm.frameMap.registerConfig.getScratchRegister();
-                // TODO(cwi): we want to get rid of a generally reserved scratch register.
-                masm.movq(scratch, 0L);
-                masm.call(scratch);
-            } else {
-                masm.call();
-            }
-        } else {
-            masm.call();
-        }
-        int after = masm.codeBuffer.position();
-        tasm.recordDirectCall(before, after, asCallTarget(tasm, target), info);
-        tasm.recordExceptionHandlers(after, info);
-        masm.ensureUniquePC();
-    }
-
-    public static void directJmp(TargetMethodAssembler tasm, AMD64MacroAssembler masm, Object target) {
-        int before = masm.codeBuffer.position();
-        masm.jmp(0, true);
-        int after = masm.codeBuffer.position();
-        tasm.recordDirectCall(before, after, asCallTarget(tasm, target), null);
-        masm.ensureUniquePC();
-    }
-
-    public static void indirectCall(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiRegister dst, Object target, LIRDebugInfo info) {
-        int before = masm.codeBuffer.position();
-        masm.call(dst);
-        int after = masm.codeBuffer.position();
-        tasm.recordIndirectCall(before, after, asCallTarget(tasm, target), info);
-        tasm.recordExceptionHandlers(after, info);
-        masm.ensureUniquePC();
-    }
-
-    private static Object asCallTarget(TargetMethodAssembler tasm, Object o) {
-        return tasm.runtime.asCallTarget(o);
-    }
-
-    public static void shouldNotReachHere(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-        if (GraalOptions.GenAssertionCode) {
-            directCall(tasm, masm, CiRuntimeCall.Debug, null);
-            masm.hlt();
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Compare.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2011, 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.compiler.target.amd64;
+
+import static com.oracle.max.cri.ci.CiValueUtil.*;
+
+import java.util.*;
+
+import com.oracle.max.asm.target.amd64.*;
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.graal.compiler.asm.*;
+import com.oracle.max.graal.compiler.lir.*;
+import com.oracle.max.graal.compiler.util.*;
+
+public enum AMD64Compare {
+    ICMP, LCMP, ACMP, FCMP, DCMP;
+
+    public static class CompareOp extends AMD64LIRInstruction {
+        public CompareOp(AMD64Compare opcode, CiValue x, CiValue y) {
+            super(opcode, LIRInstruction.NO_OPERANDS, null, new CiValue[] {x, y}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            CiValue x = input(0);
+            CiValue y = input(1);
+            emit(tasm, masm, (AMD64Compare) code, x, y);
+        }
+
+        @Override
+        public EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            } else if (mode == OperandMode.Input && index == 1) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
+            }
+            throw Util.shouldNotReachHere();
+        }
+
+        @Override
+        protected void verify() {
+            CiValue x = input(0);
+            CiValue y = input(1);
+
+            super.verify();
+            assert (name().startsWith("I") && x.kind == CiKind.Int && y.kind.stackKind() == CiKind.Int)
+                || (name().startsWith("I") && x.kind == CiKind.Jsr && y.kind == CiKind.Jsr)
+                || (name().startsWith("L") && x.kind == CiKind.Long && y.kind == CiKind.Long)
+                || (name().startsWith("A") && x.kind == CiKind.Object && y.kind == CiKind.Object)
+                || (name().startsWith("F") && x.kind == CiKind.Float && y.kind == CiKind.Float)
+                || (name().startsWith("D") && x.kind == CiKind.Double && y.kind == CiKind.Double);
+        }
+    }
+
+    protected static void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Compare opcode, CiValue x, CiValue y) {
+        if (isRegister(y)) {
+            switch (opcode) {
+                case ICMP: masm.cmpl(asIntReg(x), asIntReg(y)); break;
+                case LCMP: masm.cmpq(asLongReg(x), asLongReg(y)); break;
+                case ACMP: masm.cmpptr(asObjectReg(x), asObjectReg(y)); break;
+                case FCMP: masm.ucomiss(asFloatReg(x), asFloatReg(y)); break;
+                case DCMP: masm.ucomisd(asDoubleReg(x), asDoubleReg(y)); break;
+                default:   throw Util.shouldNotReachHere();
+            }
+        } else if (isConstant(y)) {
+            switch (opcode) {
+                case ICMP: masm.cmpl(asIntReg(x), tasm.asIntConst(y)); break;
+                case LCMP: masm.cmpq(asLongReg(x), tasm.asIntConst(y)); break;
+                case ACMP:
+                    if (((CiConstant) y).isNull()) {
+                        masm.cmpq(asObjectReg(x), 0); break;
+                    } else {
+                        throw Util.shouldNotReachHere("Only null object constants are allowed in comparisons");
+                    }
+                case FCMP: masm.ucomiss(asFloatReg(x), tasm.asFloatConstRef(y)); break;
+                case DCMP: masm.ucomisd(asDoubleReg(x), tasm.asDoubleConstRef(y)); break;
+                default:   throw Util.shouldNotReachHere();
+            }
+        } else {
+            switch (opcode) {
+                case ICMP: masm.cmpl(asIntReg(x), tasm.asIntAddr(y)); break;
+                case LCMP: masm.cmpq(asLongReg(x), tasm.asLongAddr(y)); break;
+                case ACMP: masm.cmpptr(asObjectReg(x), tasm.asObjectAddr(y)); break;
+                case FCMP: masm.ucomiss(asFloatReg(x), tasm.asFloatAddr(y)); break;
+                case DCMP: masm.ucomisd(asDoubleReg(x), tasm.asDoubleAddr(y)); break;
+                default:  throw Util.shouldNotReachHere();
+            }
+        }
+    }
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CompareOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public enum AMD64CompareOpcode implements LIROpcode {
-    ICMP, LCMP, ACMP, FCMP, DCMP;
-
-    public LIRInstruction create(CiValue x, CiValue y) {
-        assert (name().startsWith("I") && x.kind == CiKind.Int && y.kind.stackKind() == CiKind.Int)
-            || (name().startsWith("I") && x.kind == CiKind.Jsr && y.kind == CiKind.Jsr)
-            || (name().startsWith("L") && x.kind == CiKind.Long && y.kind == CiKind.Long)
-            || (name().startsWith("A") && x.kind == CiKind.Object && y.kind == CiKind.Object)
-            || (name().startsWith("F") && x.kind == CiKind.Float && y.kind == CiKind.Float)
-            || (name().startsWith("D") && x.kind == CiKind.Double && y.kind == CiKind.Double);
-        CiValue[] inputs = new CiValue[] {x, y};
-
-        return new AMD64LIRInstruction(this, LIRInstruction.NO_OPERANDS, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-            @Override
-            public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                emit(tasm, masm, input(0), input(1));
-            }
-
-            @Override
-            public EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                if (mode == OperandMode.Input && index == 1) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
-                }
-                return super.flagsFor(mode, index);
-            }
-        };
-    }
-
-    protected void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue x, CiValue y) {
-        CiRegister lreg = asRegister(x);
-        if (isRegister(y)) {
-            CiRegister rreg = asRegister(y);
-            switch (this) {
-                case ICMP: masm.cmpl(lreg, rreg); break;
-                case LCMP: masm.cmpq(lreg, rreg); break;
-                case ACMP: masm.cmpptr(lreg, rreg); break;
-                case FCMP: masm.ucomiss(lreg, rreg); break;
-                case DCMP: masm.ucomisd(lreg, rreg); break;
-                default:   throw Util.shouldNotReachHere();
-            }
-        } else if (isConstant(y)) {
-            switch (this) {
-                case ICMP: masm.cmpl(lreg, tasm.asIntConst(y)); break;
-                case LCMP: masm.cmpq(lreg, tasm.asIntConst(y)); break;
-                case ACMP:
-                    if (((CiConstant) y).isNull()) {
-                        masm.cmpq(lreg, 0); break;
-                    } else {
-                        throw Util.shouldNotReachHere("Only null object constants are allowed in comparisons");
-                    }
-                case FCMP: masm.ucomiss(lreg, tasm.asFloatConstRef(y)); break;
-                case DCMP: masm.ucomisd(lreg, tasm.asDoubleConstRef(y)); break;
-                default:   throw Util.shouldNotReachHere();
-            }
-        } else {
-            CiAddress raddr = tasm.asAddress(y);
-            switch (this) {
-                case ICMP: masm.cmpl(lreg, raddr); break;
-                case LCMP: masm.cmpq(lreg, raddr); break;
-                case ACMP: masm.cmpptr(lreg, raddr); break;
-                case FCMP: masm.ucomiss(lreg, raddr); break;
-                case DCMP: masm.ucomisd(lreg, raddr); break;
-                default:  throw Util.shouldNotReachHere();
-            }
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CompareToIntOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CompareToIntOpcode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,6 +24,8 @@
 
 import static com.oracle.max.cri.ci.CiValueUtil.*;
 
+import java.util.*;
+
 import com.oracle.max.asm.*;
 import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag;
 import com.oracle.max.asm.target.amd64.*;
@@ -37,7 +39,7 @@
  * integer constants -1, 0, 1 on less, equal, or greater, respectively.  For floating point compares,
  * unordered can be either greater {@link #CMP2INT_UG} or less {@link #CMP2INT_UL}.
  */
-public enum AMD64CompareToIntOpcode implements LIROpcode {
+public enum AMD64CompareToIntOpcode {
     CMP2INT, CMP2INT_UG, CMP2INT_UL;
 
     public LIRInstruction create(CiValue result) {
@@ -48,6 +50,14 @@
             public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
                 emit(masm, output(0));
             }
+
+            @Override
+            protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+                if (mode == OperandMode.Output && index == 0) {
+                    return EnumSet.of(OperandFlag.Register);
+                }
+                throw Util.shouldNotReachHere();
+            }
         };
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ControlFlow.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,443 @@
+/*
+ * Copyright (c) 2011, 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.compiler.target.amd64;
+
+import static com.oracle.max.cri.ci.CiValueUtil.*;
+
+import java.util.*;
+
+import com.oracle.max.asm.*;
+import com.oracle.max.asm.target.amd64.*;
+import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag;
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.cri.ci.CiAddress.Scale;
+import com.oracle.max.cri.ci.CiTargetMethod.JumpTable;
+import com.oracle.max.graal.compiler.asm.*;
+import com.oracle.max.graal.compiler.lir.*;
+import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.nodes.calc.*;
+
+public class AMD64ControlFlow {
+
+    public static class LabelOp extends AMD64LIRInstruction implements StandardOp.LabelOp {
+        private final Label label;
+        private final boolean align;
+
+        public LabelOp(Label label, boolean align) {
+            super("LABEL", LIRInstruction.NO_OPERANDS, null, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+            this.label = label;
+            this.align = align;
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            if (align) {
+                masm.align(tasm.target.wordSize);
+            }
+            masm.bind(label);
+        }
+
+        @Override
+        public String operationString() {
+            return label.toString();
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class ReturnOp extends AMD64LIRInstruction {
+        public ReturnOp(CiValue input) {
+            super("RETURN", LIRInstruction.NO_OPERANDS, null, new CiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            masm.ret(0);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Illegal);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class JumpOp extends AMD64LIRInstruction implements StandardOp.JumpOp {
+        private final LabelRef destination;
+
+        public JumpOp(LabelRef destination, LIRDebugInfo info) {
+            super("JUMP", LIRInstruction.NO_OPERANDS, info, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+            this.destination = destination;
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            masm.jmp(destination.label());
+        }
+
+        @Override
+        public LabelRef destination() {
+            return destination;
+        }
+
+        @Override
+        public String operationString() {
+            return  "[" + destination + "]";
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class BranchOp extends AMD64LIRInstruction implements StandardOp.BranchOp {
+        protected Condition condition;
+        protected LabelRef destination;
+
+        public BranchOp(Condition condition, LabelRef destination, LIRDebugInfo info) {
+            super("BRANCH", LIRInstruction.NO_OPERANDS, info, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+            this.condition = condition;
+            this.destination = destination;
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            masm.jcc(intCond(condition), destination.label());
+        }
+
+        @Override
+        public LabelRef destination() {
+            return destination;
+        }
+
+        @Override
+        public void negate(LabelRef newDestination) {
+            destination = newDestination;
+            condition = condition.negate();
+        }
+
+        @Override
+        public String operationString() {
+            return condition.operator + " [" + destination + "]";
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class FloatBranchOp extends BranchOp {
+        protected boolean unorderedIsTrue;
+
+        public FloatBranchOp(Condition condition, boolean unorderedIsTrue, LabelRef destination, LIRDebugInfo info) {
+            super(condition, destination, info);
+            this.unorderedIsTrue = unorderedIsTrue;
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            floatJcc(masm, condition, unorderedIsTrue, destination.label());
+        }
+
+        @Override
+        public void negate(LabelRef newDestination) {
+            super.negate(newDestination);
+            unorderedIsTrue = !unorderedIsTrue;
+        }
+
+        @Override
+        public String operationString() {
+            return condition.operator + " [" + destination + "]" + (unorderedIsTrue ? " unorderedIsTrue" : " unorderedIsFalse");
+        }
+    }
+
+
+    public static class TableSwitchOp extends AMD64LIRInstruction {
+        private final int lowKey;
+        private final LabelRef defaultTarget;
+        private final LabelRef[] targets;
+
+        public TableSwitchOp(final int lowKey, final LabelRef defaultTarget, final LabelRef[] targets, Variable index, Variable scratch) {
+            super("TABLE_SWITCH", LIRInstruction.NO_OPERANDS, null, LIRInstruction.NO_OPERANDS, new CiValue[] {index}, new CiValue[] {scratch});
+            this.lowKey = lowKey;
+            this.defaultTarget = defaultTarget;
+            this.targets = targets;
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            tableswitch(tasm, masm, lowKey, defaultTarget, targets, asIntReg(alive(0)), asLongReg(temp(0)));
+        }
+
+        @Override
+        public String operationString() {
+            StringBuilder buf = new StringBuilder(super.operationString());
+            buf.append("\ndefault: [").append(defaultTarget).append(']');
+            int key = lowKey;
+            for (LabelRef l : targets) {
+                buf.append("\ncase ").append(key).append(": [").append(l).append(']');
+                key++;
+            }
+            return buf.toString();
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Alive && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            } else if (mode == OperandMode.Temp && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class CondMoveOp extends AMD64LIRInstruction {
+        private final Condition condition;
+
+        public CondMoveOp(Variable result, Condition condition, Variable trueValue, CiValue falseValue) {
+            super("CMOVE", new CiValue[] {result}, null, new CiValue[] {falseValue}, new CiValue[] {trueValue}, LIRInstruction.NO_OPERANDS);
+            this.condition = condition;
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            cmove(tasm, masm, output(0), false, condition, false, alive(0), input(0));
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
+            } else if (mode == OperandMode.Alive && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
+            }
+            throw Util.shouldNotReachHere();
+        }
+
+        @Override
+        public String operationString() {
+            return condition.toString() + " " + super.operationString();
+        }
+    }
+
+
+    public static class FloatCondMoveOp extends AMD64LIRInstruction {
+        private final Condition condition;
+        private final boolean unorderedIsTrue;
+
+        public FloatCondMoveOp(Variable result, Condition condition, boolean unorderedIsTrue, Variable trueValue, Variable falseValue) {
+            super("FLOAT_CMOVE", new CiValue[] {result}, null, LIRInstruction.NO_OPERANDS, new CiValue[] {trueValue, falseValue}, LIRInstruction.NO_OPERANDS);
+            this.condition = condition;
+            this.unorderedIsTrue = unorderedIsTrue;
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            cmove(tasm, masm, output(0), true, condition, unorderedIsTrue, alive(0), alive(1));
+        }
+
+        @Override
+        public String operationString() {
+            return condition.toString() + " unordered=" + unorderedIsTrue + " " + super.operationString();
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Alive && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            } else if (mode == OperandMode.Alive && index == 1) {
+                return EnumSet.of(OperandFlag.Register);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    private static void tableswitch(TargetMethodAssembler tasm, AMD64MacroAssembler masm, int lowKey, LabelRef defaultTarget, LabelRef[] targets, CiRegister value, CiRegister scratch) {
+        Buffer buf = masm.codeBuffer;
+        // Compare index against jump table bounds
+        int highKey = lowKey + targets.length - 1;
+        if (lowKey != 0) {
+            // subtract the low value from the switch value
+            masm.subl(value, lowKey);
+            masm.cmpl(value, highKey - lowKey);
+        } else {
+            masm.cmpl(value, highKey);
+        }
+
+        // Jump to default target if index is not within the jump table
+        masm.jcc(ConditionFlag.above, defaultTarget.label());
+
+        // Set scratch to address of jump table
+        int leaPos = buf.position();
+        masm.leaq(scratch, new CiAddress(tasm.target.wordKind, AMD64.rip.asValue(), 0));
+        int afterLea = buf.position();
+
+        // Load jump table entry into scratch and jump to it
+        masm.movslq(value, new CiAddress(CiKind.Int, scratch.asValue(), value.asValue(), Scale.Times4, 0));
+        masm.addq(scratch, value);
+        masm.jmp(scratch);
+
+        // Inserting padding so that jump table address is 4-byte aligned
+        if ((buf.position() & 0x3) != 0) {
+            masm.nop(4 - (buf.position() & 0x3));
+        }
+
+        // Patch LEA instruction above now that we know the position of the jump table
+        int jumpTablePos = buf.position();
+        buf.setPosition(leaPos);
+        masm.leaq(scratch, new CiAddress(tasm.target.wordKind, AMD64.rip.asValue(), jumpTablePos - afterLea));
+        buf.setPosition(jumpTablePos);
+
+        // Emit jump table entries
+        for (LabelRef target : targets) {
+            Label label = target.label();
+            int offsetToJumpTableBase = buf.position() - jumpTablePos;
+            if (label.isBound()) {
+                int imm32 = label.position() - jumpTablePos;
+                buf.emitInt(imm32);
+            } else {
+                label.addPatchAt(buf.position());
+
+                buf.emitByte(0); // psuedo-opcode for jump table entry
+                buf.emitShort(offsetToJumpTableBase);
+                buf.emitByte(0); // padding to make jump table entry 4 bytes wide
+            }
+        }
+
+        JumpTable jt = new JumpTable(jumpTablePos, lowKey, highKey, 4);
+        tasm.targetMethod.addAnnotation(jt);
+    }
+
+    private static void floatJcc(AMD64MacroAssembler masm, Condition condition, boolean unorderedIsTrue, Label label) {
+        ConditionFlag cond = floatCond(condition);
+        Label endLabel = new Label();
+        if (unorderedIsTrue && !trueOnUnordered(cond)) {
+            masm.jcc(ConditionFlag.parity, label);
+        } else if (!unorderedIsTrue && trueOnUnordered(cond)) {
+            masm.jcc(ConditionFlag.parity, endLabel);
+        }
+        masm.jcc(cond, label);
+        masm.bind(endLabel);
+    }
+
+    private static void cmove(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, boolean isFloat, Condition condition, boolean unorderedIsTrue, CiValue trueValue, CiValue falseValue) {
+        ConditionFlag cond = isFloat ? floatCond(condition) : intCond(condition);
+        // check that we don't overwrite an input operand before it is used.
+        assert !result.equals(trueValue);
+
+        AMD64Move.move(tasm, masm, result, falseValue);
+        cmove(tasm, masm, result, cond, trueValue);
+
+        if (isFloat) {
+            if (unorderedIsTrue && !trueOnUnordered(cond)) {
+                cmove(tasm, masm, result, ConditionFlag.parity, trueValue);
+            } else if (!unorderedIsTrue && trueOnUnordered(cond)) {
+                cmove(tasm, masm, result, ConditionFlag.parity, falseValue);
+            }
+        }
+    }
+
+    private static void cmove(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, ConditionFlag cond, CiValue other) {
+        if (isRegister(other)) {
+            assert asRegister(other) != asRegister(result) : "other already overwritten by previous move";
+            switch (other.kind) {
+                case Int:  masm.cmovl(cond, asRegister(result), asRegister(other)); break;
+                case Long: masm.cmovq(cond, asRegister(result), asRegister(other)); break;
+                default:   throw Util.shouldNotReachHere();
+            }
+        } else {
+            switch (other.kind) {
+                case Int:  masm.cmovl(cond, asRegister(result), tasm.asAddress(other)); break;
+                case Long: masm.cmovq(cond, asRegister(result), tasm.asAddress(other)); break;
+                default:   throw Util.shouldNotReachHere();
+            }
+        }
+    }
+
+    private static ConditionFlag intCond(Condition cond) {
+        switch (cond) {
+            case EQ: return ConditionFlag.equal;
+            case NE: return ConditionFlag.notEqual;
+            case LT: return ConditionFlag.less;
+            case LE: return ConditionFlag.lessEqual;
+            case GE: return ConditionFlag.greaterEqual;
+            case GT: return ConditionFlag.greater;
+            case BE: return ConditionFlag.belowEqual;
+            case AE: return ConditionFlag.aboveEqual;
+            case AT: return ConditionFlag.above;
+            case BT: return ConditionFlag.below;
+            case OF: return ConditionFlag.overflow;
+            case NOF: return ConditionFlag.noOverflow;
+            default: throw Util.shouldNotReachHere();
+        }
+    }
+
+    private static ConditionFlag floatCond(Condition cond) {
+        switch (cond) {
+            case EQ: return ConditionFlag.equal;
+            case NE: return ConditionFlag.notEqual;
+            case BT: return ConditionFlag.below;
+            case BE: return ConditionFlag.belowEqual;
+            case AE: return ConditionFlag.aboveEqual;
+            case AT: return ConditionFlag.above;
+            default: throw Util.shouldNotReachHere();
+        }
+    }
+
+    private static boolean trueOnUnordered(ConditionFlag condition) {
+        switch(condition) {
+            case aboveEqual:
+            case notEqual:
+            case above:
+            case less:
+            case overflow:
+                return false;
+            case equal:
+            case belowEqual:
+            case below:
+            case greaterEqual:
+            case noOverflow:
+                return true;
+            default:
+                throw Util.shouldNotReachHere();
+        }
+    }
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ControlFlowOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,381 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.max.asm.*;
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiAddress.Scale;
-import com.oracle.max.cri.ci.CiTargetMethod.JumpTable;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
-import com.oracle.max.graal.nodes.calc.*;
-
-public class AMD64ControlFlowOpcode {
-
-    public enum LabelOpcode implements LIROpcode {
-        LABEL;
-
-        public LIRInstruction create(final Label label, final boolean align) {
-            return new AMD64LIRInstruction(this, LIRInstruction.NO_OPERANDS, null, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                    if (align) {
-                        masm.align(tasm.target.wordSize);
-                    }
-                    masm.bind(label);
-                }
-
-                @Override
-                public String operationString() {
-                    return label.toString();
-                }
-            };
-        }
-    }
-
-
-    public enum ReturnOpcode implements StandardOpcode.ReturnOpcode {
-        RETURN;
-
-        public LIRInstruction create(CiValue input) {
-            CiValue[] inputs = new CiValue[] {input};
-
-            return new AMD64LIRInstruction(this, LIRInstruction.NO_OPERANDS, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                    masm.ret(0);
-                }
-
-                @Override
-                protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                    if (mode == OperandMode.Input && index == 0) {
-                        return EnumSet.of(OperandFlag.Register, OperandFlag.Illegal);
-                    }
-                    throw Util.shouldNotReachHere();
-                }
-            };
-        }
-    }
-
-
-    public enum JumpOpcode implements LIROpcode {
-        JUMP;
-
-        public LIRInstruction create(LabelRef label, LIRDebugInfo info) {
-            return new LIRBranch(this, null, false, label, info) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm) {
-                    AMD64MacroAssembler masm = (AMD64MacroAssembler) tasm.asm;
-                    masm.jmp(this.destination.label());
-                }
-
-                @Override
-                public String operationString() {
-                    return  "[" + destination + "]";
-                }
-            };
-        }
-    }
-
-
-    public enum BranchOpcode implements LIROpcode {
-        BRANCH;
-
-        public LIRInstruction create(Condition cond, LabelRef label, LIRDebugInfo info) {
-            return new LIRBranch(this, cond, false, label, info) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm) {
-                    AMD64MacroAssembler masm = (AMD64MacroAssembler) tasm.asm;
-                    masm.jcc(intCond(cond), destination.label());
-                }
-
-                @Override
-                public String operationString() {
-                    return cond.operator + " [" + destination + "]";
-                }
-            };
-        }
-    }
-
-
-    public enum FloatBranchOpcode implements LIROpcode {
-        FLOAT_BRANCH;
-
-        public LIRInstruction create(Condition cond, boolean unorderedIsTrue, LabelRef label, LIRDebugInfo info) {
-            return new LIRBranch(this, cond, unorderedIsTrue, label, info) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm) {
-                    floatJcc((AMD64MacroAssembler) tasm.asm, cond, unorderedIsTrue, destination.label());
-                }
-
-                @Override
-                public String operationString() {
-                    return cond.operator + " [" + destination + "]" + (unorderedIsTrue ? " unorderedIsTrue" : " unorderedIsFalse");
-                }
-            };
-        }
-    }
-
-
-    public enum TableSwitchOpcode implements LIROpcode {
-        TABLE_SWITCH;
-
-        public LIRInstruction create(final int lowKey, final LabelRef defaultTarget, final LabelRef[] targets, Variable index, Variable scratch) {
-            CiValue[] alives = new CiValue[] {index};
-            CiValue[] temps = new CiValue[] {scratch};
-
-            return new AMD64LIRInstruction(this, LIRInstruction.NO_OPERANDS, null, LIRInstruction.NO_OPERANDS, alives, temps) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                    tableswitch(tasm, masm, lowKey, defaultTarget, targets, asIntReg(alive(0)), asLongReg(temp(0)));
-                }
-
-                @Override
-                public String operationString() {
-                    StringBuilder buf = new StringBuilder(super.operationString());
-                    buf.append("\ndefault: [").append(defaultTarget).append(']');
-                    int key = lowKey;
-                    for (LabelRef l : targets) {
-                        buf.append("\ncase ").append(key).append(": [").append(l).append(']');
-                        key++;
-                    }
-                    return buf.toString();
-                }
-            };
-        }
-    }
-
-
-    public enum CondMoveOpcode implements LIROpcode {
-        CMOVE;
-
-        public LIRInstruction create(Variable result, final Condition condition, Variable trueValue, CiValue falseValue) {
-            CiValue[] inputs = new CiValue[] {falseValue};
-            CiValue[] alives = new CiValue[] {trueValue};
-            CiValue[] outputs = new CiValue[] {result};
-
-            return new AMD64LIRInstruction(this, outputs, null, inputs, alives, LIRInstruction.NO_OPERANDS) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                    cmove(tasm, masm, output(0), false, condition, false, alive(0), input(0));
-                }
-
-                @Override
-                protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                    if (mode == OperandMode.Input && index == 0) {
-                        return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
-                    } else if (mode == OperandMode.Output && index == 0) {
-                        return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
-                    }
-                    return super.flagsFor(mode, index);
-                }
-
-                @Override
-                public String operationString() {
-                    return condition.toString() + " " + super.operationString();
-                }
-            };
-        }
-    }
-
-
-    public enum FloatCondMoveOpcode implements LIROpcode {
-        FLOAT_CMOVE;
-
-        public LIRInstruction create(Variable result, final Condition condition, final boolean unorderedIsTrue, Variable trueValue, Variable falseValue) {
-            CiValue[] alives = new CiValue[] {trueValue, falseValue};
-            CiValue[] outputs = new CiValue[] {result};
-
-            return new AMD64LIRInstruction(this, outputs, null, LIRInstruction.NO_OPERANDS, alives, LIRInstruction.NO_OPERANDS) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                    cmove(tasm, masm, output(0), true, condition, unorderedIsTrue, alive(0), alive(1));
-                }
-
-                @Override
-                public String operationString() {
-                    return condition.toString() + " unordered=" + unorderedIsTrue + " " + super.operationString();
-                }
-            };
-        }
-    }
-
-
-    private static void tableswitch(TargetMethodAssembler tasm, AMD64MacroAssembler masm, int lowKey, LabelRef defaultTarget, LabelRef[] targets, CiRegister value, CiRegister scratch) {
-        Buffer buf = masm.codeBuffer;
-        // Compare index against jump table bounds
-        int highKey = lowKey + targets.length - 1;
-        if (lowKey != 0) {
-            // subtract the low value from the switch value
-            masm.subl(value, lowKey);
-            masm.cmpl(value, highKey - lowKey);
-        } else {
-            masm.cmpl(value, highKey);
-        }
-
-        // Jump to default target if index is not within the jump table
-        masm.jcc(ConditionFlag.above, defaultTarget.label());
-
-        // Set scratch to address of jump table
-        int leaPos = buf.position();
-        masm.leaq(scratch, new CiAddress(tasm.target.wordKind, AMD64.rip.asValue(), 0));
-        int afterLea = buf.position();
-
-        // Load jump table entry into scratch and jump to it
-        masm.movslq(value, new CiAddress(CiKind.Int, scratch.asValue(), value.asValue(), Scale.Times4, 0));
-        masm.addq(scratch, value);
-        masm.jmp(scratch);
-
-        // Inserting padding so that jump table address is 4-byte aligned
-        if ((buf.position() & 0x3) != 0) {
-            masm.nop(4 - (buf.position() & 0x3));
-        }
-
-        // Patch LEA instruction above now that we know the position of the jump table
-        int jumpTablePos = buf.position();
-        buf.setPosition(leaPos);
-        masm.leaq(scratch, new CiAddress(tasm.target.wordKind, AMD64.rip.asValue(), jumpTablePos - afterLea));
-        buf.setPosition(jumpTablePos);
-
-        // Emit jump table entries
-        for (LabelRef target : targets) {
-            Label label = target.label();
-            int offsetToJumpTableBase = buf.position() - jumpTablePos;
-            if (label.isBound()) {
-                int imm32 = label.position() - jumpTablePos;
-                buf.emitInt(imm32);
-            } else {
-                label.addPatchAt(buf.position());
-
-                buf.emitByte(0); // psuedo-opcode for jump table entry
-                buf.emitShort(offsetToJumpTableBase);
-                buf.emitByte(0); // padding to make jump table entry 4 bytes wide
-            }
-        }
-
-        JumpTable jt = new JumpTable(jumpTablePos, lowKey, highKey, 4);
-        tasm.targetMethod.addAnnotation(jt);
-    }
-
-    private static void floatJcc(AMD64MacroAssembler masm, Condition condition, boolean unorderedIsTrue, Label label) {
-        ConditionFlag cond = floatCond(condition);
-        Label endLabel = new Label();
-        if (unorderedIsTrue && !trueOnUnordered(cond)) {
-            masm.jcc(ConditionFlag.parity, label);
-        } else if (!unorderedIsTrue && trueOnUnordered(cond)) {
-            masm.jcc(ConditionFlag.parity, endLabel);
-        }
-        masm.jcc(cond, label);
-        masm.bind(endLabel);
-    }
-
-    private static void cmove(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, boolean isFloat, Condition condition, boolean unorderedIsTrue, CiValue trueValue, CiValue falseValue) {
-        ConditionFlag cond = isFloat ? floatCond(condition) : intCond(condition);
-        // check that we don't overwrite an input operand before it is used.
-        assert !result.equals(trueValue);
-
-        AMD64MoveOpcode.move(tasm, masm, result, falseValue);
-        cmove(tasm, masm, result, cond, trueValue);
-
-        if (isFloat) {
-            if (unorderedIsTrue && !trueOnUnordered(cond)) {
-                cmove(tasm, masm, result, ConditionFlag.parity, trueValue);
-            } else if (!unorderedIsTrue && trueOnUnordered(cond)) {
-                cmove(tasm, masm, result, ConditionFlag.parity, falseValue);
-            }
-        }
-    }
-
-    private static void cmove(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, ConditionFlag cond, CiValue other) {
-        if (isRegister(other)) {
-            assert asRegister(other) != asRegister(result) : "other already overwritten by previous move";
-            switch (other.kind) {
-                case Int:  masm.cmovl(cond, asRegister(result), asRegister(other)); break;
-                case Long: masm.cmovq(cond, asRegister(result), asRegister(other)); break;
-                default:   throw Util.shouldNotReachHere();
-            }
-        } else {
-            switch (other.kind) {
-                case Int:  masm.cmovl(cond, asRegister(result), tasm.asAddress(other)); break;
-                case Long: masm.cmovq(cond, asRegister(result), tasm.asAddress(other)); break;
-                default:   throw Util.shouldNotReachHere();
-            }
-        }
-    }
-
-    private static ConditionFlag intCond(Condition cond) {
-        switch (cond) {
-            case EQ: return ConditionFlag.equal;
-            case NE: return ConditionFlag.notEqual;
-            case LT: return ConditionFlag.less;
-            case LE: return ConditionFlag.lessEqual;
-            case GE: return ConditionFlag.greaterEqual;
-            case GT: return ConditionFlag.greater;
-            case BE: return ConditionFlag.belowEqual;
-            case AE: return ConditionFlag.aboveEqual;
-            case AT: return ConditionFlag.above;
-            case BT: return ConditionFlag.below;
-            case OF: return ConditionFlag.overflow;
-            case NOF: return ConditionFlag.noOverflow;
-            default: throw Util.shouldNotReachHere();
-        }
-    }
-
-    private static ConditionFlag floatCond(Condition cond) {
-        switch (cond) {
-            case EQ: return ConditionFlag.equal;
-            case NE: return ConditionFlag.notEqual;
-            case BT: return ConditionFlag.below;
-            case BE: return ConditionFlag.belowEqual;
-            case AE: return ConditionFlag.aboveEqual;
-            case AT: return ConditionFlag.above;
-            default: throw Util.shouldNotReachHere();
-        }
-    }
-
-    private static boolean trueOnUnordered(ConditionFlag condition) {
-        switch(condition) {
-            case aboveEqual:
-            case notEqual:
-            case above:
-            case less:
-            case overflow:
-                return false;
-            case equal:
-            case belowEqual:
-            case below:
-            case greaterEqual:
-            case noOverflow:
-                return true;
-            default:
-                throw Util.shouldNotReachHere();
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ConvertOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.max.asm.*;
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.asm.target.amd64.AMD64Assembler.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public enum AMD64ConvertOpcode implements LIROpcode {
-    I2L, L2I, I2B, I2C, I2S,
-    F2D, D2F,
-    I2F, I2D, F2I, D2I,
-    L2F, L2D, F2L, D2L,
-    MOV_I2F, MOV_L2D, MOV_F2I, MOV_D2L;
-
-    public LIRInstruction create(CiValue result, CiValue x) {
-        CiValue[] inputs = new CiValue[] {x};
-        CiValue[] outputs = new CiValue[] {result};
-
-        return new AMD64LIRInstruction(this, outputs, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-            @Override
-            public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                emit(tasm, masm, output(0), input(0));
-            }
-
-            @Override
-            protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                if (mode == OperandMode.Output && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
-                }
-                return super.flagsFor(mode, index);
-            }
-        };
-    }
-
-    private void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue x) {
-        switch (this) {
-            case L2I:
-                AMD64MoveOpcode.move(tasm, masm, result, x);
-                masm.andl(asIntReg(result), 0xFFFFFFFF);
-                break;
-            case I2B:
-                AMD64MoveOpcode.move(tasm, masm, result, x);
-                masm.signExtendByte(asIntReg(result));
-                break;
-            case I2C:
-                AMD64MoveOpcode.move(tasm, masm, result, x);
-                masm.andl(asIntReg(result), 0xFFFF);
-                break;
-            case I2S:
-                AMD64MoveOpcode.move(tasm, masm, result, x);
-                masm.signExtendShort(asIntReg(result));
-                break;
-            case I2L: masm.movslq(asLongReg(result), asIntReg(x)); break;
-            case F2D: masm.cvtss2sd(asDoubleReg(result), asFloatReg(x)); break;
-            case D2F: masm.cvtsd2ss(asFloatReg(result), asDoubleReg(x)); break;
-            case I2F: masm.cvtsi2ssl(asFloatReg(result), asIntReg(x)); break;
-            case I2D: masm.cvtsi2sdl(asDoubleReg(result), asIntReg(x)); break;
-            case L2F: masm.cvtsi2ssq(asFloatReg(result), asLongReg(x)); break;
-            case L2D: masm.cvtsi2sdq(asDoubleReg(result), asLongReg(x)); break;
-            case F2I:
-                masm.cvttss2sil(asIntReg(result), asFloatReg(x));
-                emitFixup(tasm, masm, result, x);
-                break;
-            case D2I:
-                masm.cvttsd2sil(asIntReg(result), asDoubleReg(x));
-                emitFixup(tasm, masm, result, x);
-                break;
-            case F2L:
-                masm.cvttss2siq(asLongReg(result), asFloatReg(x));
-                emitFixup(tasm, masm, result, x);
-                break;
-            case D2L:
-                masm.cvttsd2siq(asLongReg(result), asDoubleReg(x));
-                emitFixup(tasm, masm, result, x);
-                break;
-            case MOV_I2F: masm.movdl(asFloatReg(result), asIntReg(x)); break;
-            case MOV_L2D: masm.movdq(asDoubleReg(result), asLongReg(x)); break;
-            case MOV_F2I: masm.movdl(asIntReg(result), asFloatReg(x)); break;
-            case MOV_D2L: masm.movdq(asLongReg(result), asDoubleReg(x)); break;
-            default: throw Util.shouldNotReachHere();
-        }
-    }
-
-    private static void emitFixup(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue x) {
-        FixupSlowPath slowPath = new FixupSlowPath(result, x);
-        tasm.slowPaths.add(slowPath);
-        switch (result.kind) {
-            case Int:  masm.cmpl(asIntReg(result),  Integer.MIN_VALUE); break;
-            case Long: masm.cmpq(asLongReg(result), tasm.asLongConstRef(CiConstant.forLong(java.lang.Long.MIN_VALUE))); break;
-            default:   throw Util.shouldNotReachHere();
-        }
-        masm.jcc(ConditionFlag.equal, slowPath.start);
-        masm.bind(slowPath.continuation);
-    }
-
-    private static class FixupSlowPath extends AMD64SlowPath {
-        public final Label start = new Label();
-        public final Label continuation = new Label();
-        private final CiValue result;
-        private final CiValue x;
-
-        public FixupSlowPath(CiValue result, CiValue x) {
-            this.result = result;
-            this.x = x;
-        }
-
-        @Override
-        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-            masm.bind(start);
-            switch (x.kind) {
-                case Float:  masm.ucomiss(asFloatReg(x),  tasm.asFloatConstRef(CiConstant.FLOAT_0)); break;
-                case Double: masm.ucomisd(asDoubleReg(x), tasm.asDoubleConstRef(CiConstant.DOUBLE_0)); break;
-                default:     throw Util.shouldNotReachHere();
-            }
-            Label nan = new Label();
-            masm.jcc(ConditionFlag.parity, nan);
-            masm.jcc(ConditionFlag.below, continuation);
-
-            // input is > 0 -> return maxInt
-            // result register already contains 0x80000000, so subtracting 1 gives 0x7fffffff
-            switch (result.kind) {
-                case Int:  masm.decrementl(asIntReg(result),  1); break;
-                case Long: masm.decrementq(asLongReg(result), 1); break;
-                default:   throw Util.shouldNotReachHere();
-            }
-            masm.jmp(continuation);
-
-            // input is NaN -> return 0
-            masm.bind(nan);
-            masm.xorptr(asRegister(result), asRegister(result));
-            masm.jmp(continuation);
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64DeoptimizationStub.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64DeoptimizationStub.java	Thu Feb 02 16:07:52 2012 -0800
@@ -57,9 +57,9 @@
         if (GraalOptions.CreateDeoptInfo && deoptInfo != null) {
             masm.nop();
             keepAlive.add(deoptInfo.toString());
-            AMD64MoveOpcode.move(tasm, masm, scratch.asValue(), CiConstant.forObject(deoptInfo));
+            AMD64Move.move(tasm, masm, scratch.asValue(), CiConstant.forObject(deoptInfo));
             // TODO Why use scratch register here? Is it an implicit calling convention that the runtime function reads this register?
-            AMD64CallOpcode.directCall(tasm, masm, CiRuntimeCall.SetDeoptInfo, info);
+            AMD64Call.directCall(tasm, masm, CiRuntimeCall.SetDeoptInfo, info);
         }
         int code;
         switch(action) {
@@ -83,7 +83,7 @@
         }
         masm.movq(scratch, code);
         // TODO Why use scratch register here? Is it an implicit calling convention that the runtime function reads this register?
-        AMD64CallOpcode.directCall(tasm, masm, CiRuntimeCall.Deoptimize, info);
-        AMD64CallOpcode.shouldNotReachHere(tasm, masm);
+        AMD64Call.directCall(tasm, masm, CiRuntimeCall.Deoptimize, info);
+        AMD64Call.shouldNotReachHere(tasm, masm);
     }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64DivOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import com.oracle.max.asm.*;
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public enum AMD64DivOpcode implements LIROpcode {
-    IDIV, IREM, IUDIV, IUREM,
-    LDIV, LREM, LUDIV, LUREM;
-
-    public LIRInstruction create(CiValue result, LIRDebugInfo info, CiValue x, CiValue y) {
-        CiValue[] inputs = new CiValue[] {x};
-        CiValue[] alives = new CiValue[] {y};
-        CiValue[] temps = new CiValue[] {asRegister(result) == AMD64.rax ? AMD64.rdx.asValue(result.kind) : AMD64.rax.asValue(result.kind)};
-        CiValue[] outputs = new CiValue[] {result};
-
-        return new AMD64LIRInstruction(this, outputs, info, inputs, alives, temps) {
-            @Override
-            public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                emit(tasm, masm, output(0), info, input(0), alive(0));
-            }
-        };
-    }
-
-    protected void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, LIRDebugInfo info, CiValue x, CiValue y) {
-        // left input in rax, right input in any register but rax and rdx, result quotient in rax, result remainder in rdx
-        assert asRegister(x) == AMD64.rax;
-        assert differentRegisters(y, AMD64.rax.asValue(), AMD64.rdx.asValue());
-        assert (name().endsWith("DIV") && asRegister(result) == AMD64.rax) || (name().endsWith("REM") && asRegister(result) == AMD64.rdx);
-
-        int exceptionOffset;
-        switch (this) {
-            case IDIV:
-            case IREM:
-                masm.cdql();
-                exceptionOffset = masm.codeBuffer.position();
-                masm.idivl(asRegister(y));
-                break;
-
-            case LDIV:
-            case LREM:
-                Label continuation = new Label();
-                if (this == LDIV) {
-                    // check for special case of Long.MIN_VALUE / -1
-                    Label normalCase = new Label();
-                    masm.movq(AMD64.rdx, java.lang.Long.MIN_VALUE);
-                    masm.cmpq(AMD64.rax, AMD64.rdx);
-                    masm.jcc(ConditionFlag.notEqual, normalCase);
-                    masm.cmpl(asRegister(y), -1);
-                    masm.jcc(ConditionFlag.equal, continuation);
-                    masm.bind(normalCase);
-                }
-
-                masm.cdqq();
-                exceptionOffset = masm.codeBuffer.position();
-                masm.idivq(asRegister(y));
-                masm.bind(continuation);
-                break;
-
-            case IUDIV:
-            case IUREM:
-                // Must zero the high 64-bit word (in RDX) of the dividend
-                masm.xorq(AMD64.rdx, AMD64.rdx);
-                exceptionOffset = masm.codeBuffer.position();
-                masm.divl(asRegister(y));
-                break;
-
-            case LUDIV:
-            case LUREM:
-                // Must zero the high 64-bit word (in RDX) of the dividend
-                masm.xorq(AMD64.rdx, AMD64.rdx);
-                exceptionOffset = masm.codeBuffer.position();
-                masm.divq(asRegister(y));
-                break;
-
-            default:
-                throw Util.shouldNotReachHere();
-        }
-        tasm.recordImplicitException(exceptionOffset, info);
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,25 +24,47 @@
 package com.oracle.max.graal.compiler.target.amd64;
 
 import static com.oracle.max.cri.ci.CiValueUtil.*;
-import static com.oracle.max.graal.compiler.target.amd64.AMD64ArithmeticOpcode.*;
-import static com.oracle.max.graal.compiler.target.amd64.AMD64CompareOpcode.*;
+import static com.oracle.max.graal.compiler.target.amd64.AMD64Arithmetic.*;
+import static com.oracle.max.graal.compiler.target.amd64.AMD64Compare.*;
 import static com.oracle.max.graal.compiler.target.amd64.AMD64CompareToIntOpcode.*;
-import static com.oracle.max.graal.compiler.target.amd64.AMD64ConvertOpcode.*;
-import static com.oracle.max.graal.compiler.target.amd64.AMD64DivOpcode.*;
-import static com.oracle.max.graal.compiler.target.amd64.AMD64LogicFloatOpcode.*;
-import static com.oracle.max.graal.compiler.target.amd64.AMD64MulOpcode.*;
-import static com.oracle.max.graal.compiler.target.amd64.AMD64Op1Opcode.*;
-import static com.oracle.max.graal.compiler.target.amd64.AMD64ShiftOpcode.*;
-import static com.oracle.max.graal.compiler.target.amd64.AMD64StandardOpcode.*;
+
+import java.util.*;
 
 import com.oracle.max.asm.*;
 import com.oracle.max.asm.target.amd64.*;
 import com.oracle.max.cri.ci.*;
+import com.oracle.max.cri.ci.CiTargetMethod.Mark;
 import com.oracle.max.cri.ri.*;
+import com.oracle.max.cri.xir.CiXirAssembler.XirMark;
 import com.oracle.max.cri.xir.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.gen.*;
 import com.oracle.max.graal.compiler.lir.*;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Arithmetic.DivOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Arithmetic.Op1Reg;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Arithmetic.Op1Stack;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Arithmetic.Op2Reg;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Arithmetic.Op2Stack;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Arithmetic.ShiftOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Call.DirectCallOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Call.IndirectCallOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Compare.CompareOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64ControlFlow.BranchOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64ControlFlow.CondMoveOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64ControlFlow.FloatBranchOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64ControlFlow.FloatCondMoveOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64ControlFlow.JumpOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64ControlFlow.LabelOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64ControlFlow.ReturnOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64ControlFlow.TableSwitchOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Move.CompareAndSwapOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Move.LeaOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Move.LoadOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Move.MembarOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Move.MoveFromRegOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Move.MoveToRegOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Move.NullCheckOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Move.SpillMoveOp;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Move.StoreOp;
 import com.oracle.max.graal.compiler.util.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.DeoptimizeNode.DeoptAction;
@@ -62,20 +84,23 @@
     private static final CiRegisterValue RDX_L = AMD64.rdx.asValue(CiKind.Long);
     private static final CiRegisterValue RCX_I = AMD64.rcx.asValue(CiKind.Int);
 
-    static {
-        StandardOpcode.SPILL_MOVE = AMD64MoveOpcode.SpillMoveOpcode.SPILL_MOVE;
-        StandardOpcode.NULL_CHECK = AMD64StandardOpcode.NULL_CHECK;
-        StandardOpcode.DIRECT_CALL = AMD64CallOpcode.DIRECT_CALL;
-        StandardOpcode.INDIRECT_CALL = AMD64CallOpcode.INDIRECT_CALL;
-        StandardOpcode.LABEL = AMD64StandardOpcode.LABEL;
-        StandardOpcode.JUMP = AMD64StandardOpcode.JUMP;
-        StandardOpcode.RETURN = AMD64StandardOpcode.RETURN;
-        StandardOpcode.XIR = AMD64XirOpcode.XIR;
+    public static class AMD64SpillMoveFactory implements LIR.SpillMoveFactory {
+        @Override
+        public LIRInstruction createMove(CiValue result, CiValue input) {
+            return new SpillMoveOp(result, input);
+        }
+
+        @Override
+        public LIRInstruction createExchange(CiValue input1, CiValue input2) {
+            // TODO implement XCHG operation for LIR
+            return null;
+        }
     }
 
-    public AMD64LIRGenerator(GraalContext context, Graph graph, RiRuntime runtime, CiTarget target, FrameMap frameMap, RiResolvedMethod method, LIR lir, RiXirGenerator xir) {
-        super(context, graph, runtime, target, frameMap, method, lir, xir);
+    public AMD64LIRGenerator(Graph graph, RiRuntime runtime, CiTarget target, FrameMap frameMap, RiResolvedMethod method, LIR lir, RiXirGenerator xir) {
+        super(graph, runtime, target, frameMap, method, lir, xir);
         lir.methodEndMarker = new AMD64MethodEndStub();
+        lir.spillMoveFactory = new AMD64SpillMoveFactory();
     }
 
     @Override
@@ -144,43 +169,47 @@
     @Override
     public Variable emitMove(CiValue input) {
         Variable result = newVariable(input.kind);
-        append(MOVE.create(result, input));
+        emitMove(input, result);
         return result;
     }
 
     @Override
     public void emitMove(CiValue src, CiValue dst) {
-        append(MOVE.create(dst, src));
+        if (isRegister(src) || isStackSlot(dst)) {
+            append(new MoveFromRegOp(dst, src));
+        } else {
+            append(new MoveToRegOp(dst, src));
+        }
     }
 
     @Override
     public Variable emitLoad(CiValue loadAddress, boolean canTrap) {
         Variable result = newVariable(loadAddress.kind);
-        append(LOAD.create(result, loadAddress, canTrap ? state() : null));
+        append(new LoadOp(result, loadAddress, canTrap ? state() : null));
         return result;
     }
 
     @Override
     public void emitStore(CiValue storeAddress, CiValue inputVal, boolean canTrap) {
         CiValue input = loadForStore(inputVal, storeAddress.kind);
-        append(STORE.create(storeAddress, input, canTrap ? state() : null));
+        append(new StoreOp(storeAddress, input, canTrap ? state() : null));
     }
 
     @Override
     public Variable emitLea(CiValue address) {
         Variable result = newVariable(target().wordKind);
-        append(LEA.create(result, address));
+        append(new LeaOp(result, address));
         return result;
     }
 
     @Override
     public void emitLabel(Label label, boolean align) {
-        append(LABEL.create(label, align));
+        append(new LabelOp(label, align));
     }
 
     @Override
     public void emitJump(LabelRef label, LIRDebugInfo info) {
-        append(JUMP.create(label, info));
+        append(new JumpOp(label, info));
     }
 
     @Override
@@ -190,9 +219,9 @@
             case Boolean:
             case Int:
             case Long:
-            case Object: append(BRANCH.create(cond, label, info)); break;
+            case Object: append(new BranchOp(cond, label, info)); break;
             case Float:
-            case Double: append(FLOAT_BRANCH.create(cond, unorderedIsTrue, label, info)); break;
+            case Double: append(new FloatBranchOp(cond, unorderedIsTrue, label, info)); break;
             default: throw Util.shouldNotReachHere("" + left.kind);
         }
     }
@@ -206,9 +235,9 @@
             case Boolean:
             case Int:
             case Long:
-            case Object: append(CMOVE.create(result, cond, load(trueValue), loadNonConst(falseValue))); break;
+            case Object: append(new CondMoveOp(result, cond, load(trueValue), loadNonConst(falseValue))); break;
             case Float:
-            case Double: append(FLOAT_CMOVE.create(result, cond, unorderedIsTrue, load(trueValue), load(falseValue))); break;
+            case Double: append(new FloatCondMoveOp(result, cond, unorderedIsTrue, load(trueValue), load(falseValue))); break;
 
         }
         return result;
@@ -219,11 +248,11 @@
         CiValue right = loadNonConst(b);
         switch (left.kind) {
             case Jsr:
-            case Int: append(ICMP.create(left, right)); break;
-            case Long: append(LCMP.create(left, right)); break;
-            case Object: append(ACMP.create(left, right)); break;
-            case Float: append(FCMP.create(left, right)); break;
-            case Double: append(DCMP.create(left, right)); break;
+            case Int: append(new CompareOp(ICMP, left, right)); break;
+            case Long: append(new CompareOp(LCMP, left, right)); break;
+            case Object: append(new CompareOp(ACMP, left, right)); break;
+            case Float: append(new CompareOp(FCMP, left, right)); break;
+            case Double: append(new CompareOp(DCMP, left, right)); break;
             default: throw Util.shouldNotReachHere();
         }
     }
@@ -232,10 +261,10 @@
     public Variable emitNegate(CiValue input) {
         Variable result = newVariable(input.kind);
         switch (input.kind) {
-            case Int:    append(INEG.create(result, input)); break;
-            case Long:   append(LNEG.create(result, input)); break;
-            case Float:  append(FXOR.create(result, input, CiConstant.forFloat(Float.intBitsToFloat(0x80000000)))); break;
-            case Double: append(DXOR.create(result, input, CiConstant.forDouble(Double.longBitsToDouble(0x8000000000000000L)))); break;
+            case Int:    append(new Op1Stack(INEG, result, input)); break;
+            case Long:   append(new Op1Stack(LNEG, result, input)); break;
+            case Float:  append(new Op2Reg(FXOR, result, input, CiConstant.forFloat(Float.intBitsToFloat(0x80000000)))); break;
+            case Double: append(new Op2Reg(DXOR, result, input, CiConstant.forDouble(Double.longBitsToDouble(0x8000000000000000L)))); break;
             default: throw Util.shouldNotReachHere();
         }
         return result;
@@ -245,10 +274,10 @@
     public Variable emitAdd(CiValue a, CiValue b) {
         Variable result = newVariable(a.kind);
         switch(a.kind) {
-            case Int:    append(IADD.create(result, a, loadNonConst(b))); break;
-            case Long:   append(LADD.create(result, a, loadNonConst(b))); break;
-            case Float:  append(FADD.create(result, a, loadNonConst(b))); break;
-            case Double: append(DADD.create(result, a, loadNonConst(b))); break;
+            case Int:    append(new Op2Stack(IADD, result, a, loadNonConst(b))); break;
+            case Long:   append(new Op2Stack(LADD, result, a, loadNonConst(b))); break;
+            case Float:  append(new Op2Stack(FADD, result, a, loadNonConst(b))); break;
+            case Double: append(new Op2Stack(DADD, result, a, loadNonConst(b))); break;
             default:     throw Util.shouldNotReachHere();
         }
         return result;
@@ -258,10 +287,10 @@
     public Variable emitSub(CiValue a, CiValue b) {
         Variable result = newVariable(a.kind);
         switch(a.kind) {
-            case Int:    append(ISUB.create(result, a, loadNonConst(b))); break;
-            case Long:   append(LSUB.create(result, a, loadNonConst(b))); break;
-            case Float:  append(FSUB.create(result, a, loadNonConst(b))); break;
-            case Double: append(DSUB.create(result, a, loadNonConst(b))); break;
+            case Int:    append(new Op2Stack(ISUB, result, a, loadNonConst(b))); break;
+            case Long:   append(new Op2Stack(LSUB, result, a, loadNonConst(b))); break;
+            case Float:  append(new Op2Stack(FSUB, result, a, loadNonConst(b))); break;
+            case Double: append(new Op2Stack(DSUB, result, a, loadNonConst(b))); break;
             default:     throw Util.shouldNotReachHere();
         }
         return result;
@@ -271,10 +300,10 @@
     public Variable emitMul(CiValue a, CiValue b) {
         Variable result = newVariable(a.kind);
         switch(a.kind) {
-            case Int:    append(IMUL.create(result, a, loadNonConst(b))); break;
-            case Long:   append(LMUL.create(result, a, loadNonConst(b))); break;
-            case Float:  append(FMUL.create(result, a, loadNonConst(b))); break;
-            case Double: append(DMUL.create(result, a, loadNonConst(b))); break;
+            case Int:    append(new Op2Reg(IMUL, result, a, loadNonConst(b))); break;
+            case Long:   append(new Op2Reg(LMUL, result, a, loadNonConst(b))); break;
+            case Float:  append(new Op2Stack(FMUL, result, a, loadNonConst(b))); break;
+            case Double: append(new Op2Stack(DMUL, result, a, loadNonConst(b))); break;
             default:     throw Util.shouldNotReachHere();
         }
         return result;
@@ -284,21 +313,21 @@
     public Variable emitDiv(CiValue a, CiValue b) {
         switch(a.kind) {
             case Int:
-                append(MOVE.create(RAX_I, a));
-                append(IDIV.create(RAX_I, state(), RAX_I, load(b)));
+                emitMove(a, RAX_I);
+                append(new DivOp(IDIV, RAX_I, RAX_I, load(b), state()));
                 return emitMove(RAX_I);
             case Long:
-                append(MOVE.create(RAX_L, a));
-                append(LDIV.create(RAX_L, state(), RAX_L, load(b)));
+                emitMove(a, RAX_L);
+                append(new DivOp(LDIV, RAX_L, RAX_L, load(b), state()));
                 return emitMove(RAX_L);
             case Float: {
                 Variable result = newVariable(a.kind);
-                append(FDIV.create(result, a, loadNonConst(b)));
+                append(new Op2Stack(FDIV, result, a, loadNonConst(b)));
                 return result;
             }
             case Double: {
                 Variable result = newVariable(a.kind);
-                append(DDIV.create(result, a, loadNonConst(b)));
+                append(new Op2Stack(DDIV, result, a, loadNonConst(b)));
                 return result;
             }
             default:
@@ -310,12 +339,12 @@
     public Variable emitRem(CiValue a, CiValue b) {
         switch(a.kind) {
             case Int:
-                append(MOVE.create(RAX_I, a));
-                append(IREM.create(RDX_I, state(), RAX_I, load(b)));
+                emitMove(a, RAX_I);
+                append(new DivOp(IREM, RDX_I, RAX_I, load(b), state()));
                 return emitMove(RDX_I);
             case Long:
-                append(MOVE.create(RAX_L, a));
-                append(LREM.create(RDX_L, state(), RAX_L, load(b)));
+                emitMove(a, RAX_L);
+                append(new DivOp(LREM, RDX_L, RAX_L, load(b), state()));
                 return emitMove(RDX_L);
             case Float:
                 return emitCallToRuntime(CiRuntimeCall.ArithmeticFrem, false, a, b);
@@ -330,12 +359,12 @@
     public Variable emitUDiv(CiValue a, CiValue b) {
         switch(a.kind) {
             case Int:
-                append(MOVE.create(RAX_I, load(a)));
-                append(IUDIV.create(RAX_I, state(), RAX_I, load(b)));
+                emitMove(a, RAX_I);
+                append(new DivOp(IUDIV, RAX_I, RAX_I, load(b), state()));
                 return emitMove(RAX_I);
             case Long:
-                append(MOVE.create(RAX_L, load(a)));
-                append(LUDIV.create(RAX_L, state(), RAX_L, load(b)));
+                emitMove(a, RAX_L);
+                append(new DivOp(LUDIV, RAX_L, RAX_L, load(b), state()));
                 return emitMove(RAX_L);
             default:
                 throw Util.shouldNotReachHere();
@@ -346,12 +375,12 @@
     public Variable emitURem(CiValue a, CiValue b) {
         switch(a.kind) {
             case Int:
-                append(MOVE.create(RAX_I, load(a)));
-                append(IUREM.create(RDX_I, state(), RAX_I, load(b)));
+                emitMove(a, RAX_I);
+                append(new DivOp(IUREM, RDX_I, RAX_I, load(b), state()));
                 return emitMove(RDX_I);
             case Long:
-                append(MOVE.create(RAX_L, load(a)));
-                append(LUREM.create(RDX_L, state(), RAX_L, load(b)));
+                emitMove(a, RAX_L);
+                append(new DivOp(LUREM, RDX_L, RAX_L, load(b), state()));
                 return emitMove(RDX_L);
             default:
                 throw Util.shouldNotReachHere();
@@ -363,8 +392,8 @@
     public Variable emitAnd(CiValue a, CiValue b) {
         Variable result = newVariable(a.kind);
         switch(a.kind) {
-            case Int:    append(IAND.create(result, a, loadNonConst(b))); break;
-            case Long:   append(LAND.create(result, a, loadNonConst(b))); break;
+            case Int:    append(new Op2Stack(IAND, result, a, loadNonConst(b))); break;
+            case Long:   append(new Op2Stack(LAND, result, a, loadNonConst(b))); break;
             default:     throw Util.shouldNotReachHere();
         }
         return result;
@@ -374,8 +403,8 @@
     public Variable emitOr(CiValue a, CiValue b) {
         Variable result = newVariable(a.kind);
         switch(a.kind) {
-            case Int:    append(IOR.create(result, a, loadNonConst(b))); break;
-            case Long:   append(LOR.create(result, a, loadNonConst(b))); break;
+            case Int:    append(new Op2Stack(IOR, result, a, loadNonConst(b))); break;
+            case Long:   append(new Op2Stack(LOR, result, a, loadNonConst(b))); break;
             default:     throw Util.shouldNotReachHere();
         }
         return result;
@@ -385,8 +414,8 @@
     public Variable emitXor(CiValue a, CiValue b) {
         Variable result = newVariable(a.kind);
         switch(a.kind) {
-            case Int:    append(IXOR.create(result, a, loadNonConst(b))); break;
-            case Long:   append(LXOR.create(result, a, loadNonConst(b))); break;
+            case Int:    append(new Op2Stack(IXOR, result, a, loadNonConst(b))); break;
+            case Long:   append(new Op2Stack(LXOR, result, a, loadNonConst(b))); break;
             default:     throw Util.shouldNotReachHere();
         }
         return result;
@@ -397,8 +426,8 @@
     public Variable emitShl(CiValue a, CiValue b) {
         Variable result = newVariable(a.kind);
         switch (a.kind) {
-            case Int:    append(ISHL.create(result, a, loadShiftCount(b))); break;
-            case Long:   append(LSHL.create(result, a, loadShiftCount(b))); break;
+            case Int:    append(new ShiftOp(ISHL, result, a, loadShiftCount(b))); break;
+            case Long:   append(new ShiftOp(LSHL, result, a, loadShiftCount(b))); break;
             default: Util.shouldNotReachHere();
         }
         return result;
@@ -408,8 +437,8 @@
     public Variable emitShr(CiValue a, CiValue b) {
         Variable result = newVariable(a.kind);
         switch (a.kind) {
-            case Int:    append(ISHR.create(result, a, loadShiftCount(b))); break;
-            case Long:   append(LSHR.create(result, a, loadShiftCount(b))); break;
+            case Int:    append(new ShiftOp(ISHR, result, a, loadShiftCount(b))); break;
+            case Long:   append(new ShiftOp(LSHR, result, a, loadShiftCount(b))); break;
             default: Util.shouldNotReachHere();
         }
         return result;
@@ -419,8 +448,8 @@
     public Variable emitUShr(CiValue a, CiValue b) {
         Variable result = newVariable(a.kind);
         switch (a.kind) {
-            case Int:    append(IUSHR.create(result, a, loadShiftCount(b))); break;
-            case Long:   append(LUSHR.create(result, a, loadShiftCount(b))); break;
+            case Int:    append(new ShiftOp(IUSHR, result, a, loadShiftCount(b))); break;
+            case Long:   append(new ShiftOp(LUSHR, result, a, loadShiftCount(b))); break;
             default: Util.shouldNotReachHere();
         }
         return result;
@@ -431,7 +460,7 @@
             return value;
         }
         // Non-constant shift count must be in RCX
-        append(MOVE.create(RCX_I, value));
+        emitMove(value, RCX_I);
         return RCX_I;
     }
 
@@ -441,25 +470,25 @@
         Variable input = load(inputVal);
         Variable result = newVariable(opcode.to);
         switch (opcode) {
-            case I2L: append(I2L.create(result, input)); break;
-            case L2I: append(L2I.create(result, input)); break;
-            case I2B: append(I2B.create(result, input)); break;
-            case I2C: append(I2C.create(result, input)); break;
-            case I2S: append(I2S.create(result, input)); break;
-            case F2D: append(F2D.create(result, input)); break;
-            case D2F: append(D2F.create(result, input)); break;
-            case I2F: append(I2F.create(result, input)); break;
-            case I2D: append(I2D.create(result, input)); break;
-            case F2I: append(F2I.create(result, input)); break;
-            case D2I: append(D2I.create(result, input)); break;
-            case L2F: append(L2F.create(result, input)); break;
-            case L2D: append(L2D.create(result, input)); break;
-            case F2L: append(F2L.create(result, input)); break;
-            case D2L: append(D2L.create(result, input)); break;
-            case MOV_I2F: append(MOV_I2F.create(result, input)); break;
-            case MOV_L2D: append(MOV_L2D.create(result, input)); break;
-            case MOV_F2I: append(MOV_F2I.create(result, input)); break;
-            case MOV_D2L: append(MOV_D2L.create(result, input)); break;
+            case I2L: append(new Op1Reg(I2L, result, input)); break;
+            case L2I: append(new Op1Stack(L2I, result, input)); break;
+            case I2B: append(new Op1Stack(I2B, result, input)); break;
+            case I2C: append(new Op1Stack(I2C, result, input)); break;
+            case I2S: append(new Op1Stack(I2S, result, input)); break;
+            case F2D: append(new Op1Reg(F2D, result, input)); break;
+            case D2F: append(new Op1Reg(D2F, result, input)); break;
+            case I2F: append(new Op1Reg(I2F, result, input)); break;
+            case I2D: append(new Op1Reg(I2D, result, input)); break;
+            case F2I: append(new Op1Reg(F2I, result, input)); break;
+            case D2I: append(new Op1Reg(D2I, result, input)); break;
+            case L2F: append(new Op1Reg(L2F, result, input)); break;
+            case L2D: append(new Op1Reg(L2D, result, input)); break;
+            case F2L: append(new Op1Reg(F2L, result, input)); break;
+            case D2L: append(new Op1Reg(D2L, result, input)); break;
+            case MOV_I2F: append(new Op1Reg(MOV_I2F, result, input)); break;
+            case MOV_L2D: append(new Op1Reg(MOV_L2D, result, input)); break;
+            case MOV_F2I: append(new Op1Reg(MOV_F2I, result, input)); break;
+            case MOV_D2L: append(new Op1Reg(MOV_D2L, result, input)); break;
             default: throw Util.shouldNotReachHere();
         }
         return result;
@@ -471,9 +500,9 @@
         LIRDebugInfo info = state();
         LabelRef stubEntry = createDeoptStub(action, info, deoptInfo);
         if (cond != null) {
-            append(BRANCH.create(cond, stubEntry, info));
+            append(new BranchOp(cond, stubEntry, info));
         } else {
-            append(JUMP.create(stubEntry, info));
+            append(new JumpOp(stubEntry, info));
         }
     }
 
@@ -481,15 +510,36 @@
     public void emitMembar(int barriers) {
         int necessaryBarriers = target.arch.requiredBarriers(barriers);
         if (target.isMP && necessaryBarriers != 0) {
-            append(MEMBAR.create(necessaryBarriers));
+            append(new MembarOp(necessaryBarriers));
+        }
+    }
+
+    @Override
+    protected void emitCall(Object targetMethod, CiValue result, List<CiValue> arguments, CiValue targetAddress, LIRDebugInfo info, Map<XirMark, Mark> marks) {
+        if (isConstant(targetAddress)) {
+            assert asConstant(targetAddress).isDefaultValue() : "destination address should be zero";
+            append(new DirectCallOp(targetMethod, result, arguments.toArray(new CiValue[arguments.size()]), info, marks));
+        } else {
+            append(new IndirectCallOp(targetMethod, result, arguments.toArray(new CiValue[arguments.size()]), targetAddress, info, marks));
         }
     }
 
     @Override
+    protected void emitReturn(CiValue input) {
+        append(new ReturnOp(input));
+    }
+
+    @Override
+    protected void emitXir(XirSnippet snippet, CiValue[] operands, CiValue outputOperand, CiValue[] inputs, CiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex,
+                    LIRDebugInfo info, LIRDebugInfo infoAfter, LabelRef trueSuccessor, LabelRef falseSuccessor) {
+        append(new AMD64XirOp(snippet, operands, outputOperand, inputs, temps, inputOperandIndices, tempOperandIndices, outputOperandIndex, info, infoAfter, trueSuccessor, falseSuccessor));
+    }
+
+    @Override
     protected void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, CiValue index) {
         // Making a copy of the switch value is necessary because jump table destroys the input value
         Variable tmp = emitMove(index);
-        append(TABLE_SWITCH.create(lowKey, defaultTarget, targets, tmp, newVariable(target.wordKind)));
+        append(new TableSwitchOp(lowKey, defaultTarget, targets, tmp, newVariable(target.wordKind)));
     }
 
     @Override
@@ -500,6 +550,14 @@
         return LabelRef.forLabel(stub.label);
     }
 
+    @Override
+    protected void emitNullCheckGuard(NullCheckNode node) {
+        assert !node.expectedNull;
+        Variable value = load(operand(node.object()));
+        LIRDebugInfo info = state();
+        append(new NullCheckOp(value, info));
+    }
+
     // TODO The CompareAndSwapNode in its current form needs to be lowered to several Nodes before code generation to separate three parts:
     // * The write barriers (and possibly read barriers) when accessing an object field
     // * The distinction of returning a boolean value (semantic similar to a BooleanNode to be used as a condition?) or the old value being read
@@ -526,14 +584,14 @@
         }
 
         CiRegisterValue rax = AMD64.rax.asValue(kind);
-        append(MOVE.create(rax, expected));
-        append(CAS.create(rax, address, rax, newValue));
+        emitMove(expected, rax);
+        append(new CompareAndSwapOp(rax, address, rax, newValue));
 
         Variable result = newVariable(node.kind());
         if (node.directResult()) {
-            append(MOVE.create(result, rax));
+            emitMove(rax, result);
         } else {
-            append(CMOVE.create(result, Condition.EQ, load(CiConstant.TRUE), CiConstant.FALSE));
+            append(new CondMoveOp(result, Condition.EQ, load(CiConstant.TRUE), CiConstant.FALSE));
         }
         setResult(node, result);
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRInstruction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRInstruction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -32,7 +32,7 @@
  */
 public abstract class AMD64LIRInstruction extends LIRInstruction {
 
-    public AMD64LIRInstruction(LIROpcode opcode, CiValue[] outputs, LIRDebugInfo info, CiValue[] inputs, CiValue[] alives, CiValue[] temps) {
+    public AMD64LIRInstruction(Object opcode, CiValue[] outputs, LIRDebugInfo info, CiValue[] inputs, CiValue[] alives, CiValue[] temps) {
         super(opcode, outputs, info, inputs, alives, temps);
     }
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LogicFloatOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public enum AMD64LogicFloatOpcode implements LIROpcode {
-    FAND, FOR, FXOR,
-    DAND, DOR, DXOR;
-
-    public LIRInstruction create(CiValue result, CiValue x, CiValue y) {
-        assert (name().startsWith("F") && result.kind == CiKind.Float && x.kind == CiKind.Float && y.kind == CiKind.Float)
-            || (name().startsWith("D") && result.kind == CiKind.Double && x.kind == CiKind.Double && y.kind == CiKind.Double);
-
-        CiValue[] inputs = new CiValue[] {x};
-        CiValue[] alives = new CiValue[] {y};
-        CiValue[] outputs = new CiValue[] {result};
-
-        return new AMD64LIRInstruction(this, outputs, null, inputs, alives, LIRInstruction.NO_OPERANDS) {
-            @Override
-            public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                emit(tasm, masm, output(0), input(0), alive(0));
-            }
-
-            @Override
-            public EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                if (mode == OperandMode.Input && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
-                } else if (mode == OperandMode.Alive && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.Constant);
-                } else if (mode == OperandMode.Output && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
-                }
-                return super.flagsFor(mode, index);
-            }
-        };
-    }
-
-    protected void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue x, CiValue y) {
-        assert sameRegister(x, y) || differentRegisters(result, y);
-        AMD64MoveOpcode.move(tasm, masm, result, x);
-
-        CiRegister dst = asRegister(result);
-        if (isRegister(y)) {
-            CiRegister rreg = asRegister(y);
-            switch (this) {
-                case FAND: masm.andps(dst, rreg); break;
-                case FOR:  masm.orps(dst,  rreg); break;
-                case FXOR: masm.xorps(dst, rreg); break;
-                case DAND: masm.andpd(dst, rreg); break;
-                case DOR:  masm.orpd(dst,  rreg); break;
-                case DXOR: masm.xorpd(dst, rreg); break;
-                default:   throw Util.shouldNotReachHere();
-            }
-        } else {
-            switch (this) {
-                case FAND: masm.andps(dst, tasm.asFloatConstRef(y, 16)); break;
-                case FOR:  masm.orps(dst,  tasm.asFloatConstRef(y, 16)); break;
-                case FXOR: masm.xorps(dst, tasm.asFloatConstRef(y, 16)); break;
-                case DAND: masm.andpd(dst, tasm.asDoubleConstRef(y, 16)); break;
-                case DOR:  masm.orpd(dst,  tasm.asDoubleConstRef(y, 16)); break;
-                case DXOR: masm.xorpd(dst, tasm.asDoubleConstRef(y, 16)); break;
-                default:   throw Util.shouldNotReachHere();
-            }
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Move.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,485 @@
+/*
+ * Copyright (c) 2011, 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.compiler.target.amd64;
+
+import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static java.lang.Double.*;
+import static java.lang.Float.*;
+
+import java.util.*;
+
+import com.oracle.max.asm.target.amd64.*;
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.graal.compiler.asm.*;
+import com.oracle.max.graal.compiler.lir.*;
+import com.oracle.max.graal.compiler.lir.StandardOp.MoveOp;
+import com.oracle.max.graal.compiler.util.*;
+
+public class AMD64Move {
+
+    public static class SpillMoveOp extends AMD64LIRInstruction implements MoveOp {
+        public SpillMoveOp(CiValue result, CiValue input) {
+            super("MOVE", new CiValue[] {result}, null, new CiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            move(tasm, masm, getResult(), getInput());
+        }
+
+        @Override
+        public CiValue getInput() {
+            return input(0);
+        }
+        @Override
+        public CiValue getResult() {
+            return output(0);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class MoveToRegOp extends AMD64LIRInstruction implements MoveOp {
+        public MoveToRegOp(CiValue result, CiValue input) {
+            super("MOVE", new CiValue[] {result}, null, new CiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            move(tasm, masm, getResult(), getInput());
+        }
+
+        @Override
+        public CiValue getInput() {
+            return input(0);
+        }
+        @Override
+        public CiValue getResult() {
+            return output(0);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class MoveFromRegOp extends AMD64LIRInstruction implements MoveOp {
+        public MoveFromRegOp(CiValue result, CiValue input) {
+            super("MOVE", new CiValue[] {result}, null, new CiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            move(tasm, masm, getResult(), getInput());
+        }
+
+        @Override
+        public CiValue getInput() {
+            return input(0);
+        }
+        @Override
+        public CiValue getResult() {
+            return output(0);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Constant, OperandFlag.RegisterHint);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class LoadOp extends AMD64LIRInstruction {
+        public LoadOp(CiValue result, CiValue address, LIRDebugInfo info) {
+            super("LOAD", new CiValue[] {result}, info, new CiValue[] {address}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            load(tasm, masm, output(0), (CiAddress) input(0), info);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Address);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class StoreOp extends AMD64LIRInstruction {
+        public StoreOp(CiValue address, CiValue input, LIRDebugInfo info) {
+            super("STORE", LIRInstruction.NO_OPERANDS, info, new CiValue[] {address, input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            store(tasm, masm, (CiAddress) input(0), input(1), info);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Address);
+            } else if (mode == OperandMode.Input && index == 1) {
+                return EnumSet.of(OperandFlag.Register, OperandFlag.Constant);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class LeaOp extends AMD64LIRInstruction {
+        public LeaOp(CiValue result, CiValue address) {
+            super("LEA", new CiValue[] {result}, null, new CiValue[] {address}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            masm.leaq(asLongReg(output(0)), tasm.asAddress(input(0)));
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Address, OperandFlag.Stack, OperandFlag.Uninitialized);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class MembarOp extends AMD64LIRInstruction {
+        private final int barriers;
+
+        public MembarOp(final int barriers) {
+            super("MEMBAR", LIRInstruction.NO_OPERANDS, null, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+            this.barriers = barriers;
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            masm.membar(barriers);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class NullCheckOp extends AMD64LIRInstruction {
+        public NullCheckOp(Variable input, LIRDebugInfo info) {
+            super("NULL_CHECK", LIRInstruction.NO_OPERANDS, info, new CiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            tasm.recordImplicitException(masm.codeBuffer.position(), info);
+            masm.nullCheck(asRegister(input(0)));
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    public static class CompareAndSwapOp extends AMD64LIRInstruction {
+        public CompareAndSwapOp(CiValue result, CiAddress address, CiValue cmpValue, CiValue newValue) {
+            super("CAS", new CiValue[] {result}, null, new CiValue[] {address, cmpValue, newValue}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            compareAndSwap(tasm, masm, output(0), asAddress(input(0)), input(1), input(2));
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+            if (mode == OperandMode.Input && index == 0) {
+                return EnumSet.of(OperandFlag.Address);
+            } else if (mode == OperandMode.Input && index == 1) {
+                return EnumSet.of(OperandFlag.Register);
+            } else if (mode == OperandMode.Input && index == 2) {
+                return EnumSet.of(OperandFlag.Register);
+            } else if (mode == OperandMode.Output && index == 0) {
+                return EnumSet.of(OperandFlag.Register);
+            }
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    protected static void move(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue input) {
+        if (isRegister(input)) {
+            if (isRegister(result)) {
+                reg2reg(masm, result, input);
+            } else if (isStackSlot(result)) {
+                reg2stack(tasm, masm, result, input);
+            } else {
+                throw Util.shouldNotReachHere();
+            }
+        } else if (isStackSlot(input)) {
+            if (isRegister(result)) {
+                stack2reg(tasm, masm, result, input);
+            } else {
+                throw Util.shouldNotReachHere();
+            }
+        } else if (isConstant(input)) {
+            if (isRegister(result)) {
+                const2reg(tasm, masm, result, (CiConstant) input);
+            } else if (isStackSlot(result)) {
+                const2stack(tasm, masm, result, (CiConstant) input);
+            } else {
+                throw Util.shouldNotReachHere();
+            }
+        } else {
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+    private static void reg2reg(AMD64MacroAssembler masm, CiValue result, CiValue input) {
+        if (input.equals(result)) {
+            return;
+        }
+        switch (result.kind) {
+            case Jsr:
+            case Int:    masm.movl(asRegister(result),    asRegister(input)); break;
+            case Long:   masm.movq(asRegister(result),    asRegister(input)); break;
+            case Float:  masm.movflt(asFloatReg(result),  asFloatReg(input)); break;
+            case Double: masm.movdbl(asDoubleReg(result), asDoubleReg(input)); break;
+            case Object: masm.movq(asRegister(result),    asRegister(input)); break;
+            default:     throw Util.shouldNotReachHere("kind=" + result.kind);
+        }
+    }
+
+    private static void reg2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue input) {
+        switch (result.kind) {
+            case Jsr:
+            case Int:    masm.movl(tasm.asAddress(result),   asRegister(input)); break;
+            case Long:   masm.movq(tasm.asAddress(result),   asRegister(input)); break;
+            case Float:  masm.movflt(tasm.asAddress(result), asFloatReg(input)); break;
+            case Double: masm.movsd(tasm.asAddress(result),  asDoubleReg(input)); break;
+            case Object: masm.movq(tasm.asAddress(result),   asRegister(input)); break;
+            default:     throw Util.shouldNotReachHere();
+        }
+    }
+
+    private static void stack2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue input) {
+        switch (result.kind) {
+            case Jsr:
+            case Int:    masm.movl(asRegister(result),    tasm.asAddress(input)); break;
+            case Long:   masm.movq(asRegister(result),    tasm.asAddress(input)); break;
+            case Float:  masm.movflt(asFloatReg(result),  tasm.asAddress(input)); break;
+            case Double: masm.movdbl(asDoubleReg(result), tasm.asAddress(input)); break;
+            case Object: masm.movq(asRegister(result),    tasm.asAddress(input)); break;
+            default:     throw Util.shouldNotReachHere();
+        }
+    }
+
+    private static void const2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiConstant c) {
+        switch (result.kind) {
+            case Jsr:
+            case Int:
+                // Do not optimize with an XOR as this instruction may be between
+                // a CMP and a Jcc in which case the XOR will modify the condition
+                // flags and interfere with the Jcc.
+                masm.movl(asRegister(result), tasm.asIntConst(c));
+                break;
+            case Long:
+                // Do not optimize with an XOR as this instruction may be between
+                // a CMP and a Jcc in which case the XOR will modify the condition
+                // flags and interfere with the Jcc.
+                masm.movq(asRegister(result), c.asLong());
+                break;
+            case Float:
+                // This is *not* the same as 'constant == 0.0f' in the case where constant is -0.0f
+                if (Float.floatToRawIntBits(c.asFloat()) == Float.floatToRawIntBits(0.0f)) {
+                    masm.xorps(asFloatReg(result), asFloatReg(result));
+                } else {
+                    masm.movflt(asFloatReg(result), tasm.asFloatConstRef(c));
+                }
+                break;
+            case Double:
+                // This is *not* the same as 'constant == 0.0d' in the case where constant is -0.0d
+                if (Double.doubleToRawLongBits(c.asDouble()) == Double.doubleToRawLongBits(0.0d)) {
+                    masm.xorpd(asDoubleReg(result), asDoubleReg(result));
+                } else {
+                    masm.movdbl(asDoubleReg(result), tasm.asDoubleConstRef(c));
+                }
+                break;
+            case Object:
+                // Do not optimize with an XOR as this instruction may be between
+                // a CMP and a Jcc in which case the XOR will modify the condition
+                // flags and interfere with the Jcc.
+                if (c.isNull()) {
+                    masm.movq(asRegister(result), 0x0L);
+                } else if (tasm.target.inlineObjects) {
+                    tasm.recordDataReferenceInCode(c, 0);
+                    masm.movq(asRegister(result), 0xDEADDEADDEADDEADL);
+                } else {
+                    masm.movq(asRegister(result), tasm.recordDataReferenceInCode(c, 0));
+                }
+                break;
+            default:
+                throw Util.shouldNotReachHere();
+        }
+    }
+
+    private static void const2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiConstant c) {
+        switch (result.kind) {
+            case Jsr:
+            case Int:    masm.movl(tasm.asAddress(result), c.asInt()); break;
+            case Long:   masm.movlong(tasm.asAddress(result), c.asLong()); break;
+            case Float:  masm.movl(tasm.asAddress(result), floatToRawIntBits(c.asFloat())); break;
+            case Double: masm.movlong(tasm.asAddress(result), doubleToRawLongBits(c.asDouble())); break;
+            case Object:
+                if (c.isNull()) {
+                    masm.movlong(tasm.asAddress(result), 0L);
+                } else {
+                    throw Util.shouldNotReachHere("Non-null object constants must be in register");
+                }
+                break;
+            default:
+                throw Util.shouldNotReachHere();
+        }
+    }
+
+
+    protected static void load(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiAddress loadAddr, LIRDebugInfo info) {
+        if (info != null) {
+            tasm.recordImplicitException(masm.codeBuffer.position(), info);
+        }
+        switch (loadAddr.kind) {
+            case Boolean:
+            case Byte:   masm.movsxb(asRegister(result),  loadAddr); break;
+            case Char:   masm.movzxl(asRegister(result),  loadAddr); break;
+            case Short:  masm.movswl(asRegister(result),  loadAddr); break;
+            case Int:    masm.movslq(asRegister(result),  loadAddr); break;
+            case Long:   masm.movq(asRegister(result),    loadAddr); break;
+            case Float:  masm.movflt(asFloatReg(result),  loadAddr); break;
+            case Double: masm.movdbl(asDoubleReg(result), loadAddr); break;
+            case Object: masm.movq(asRegister(result),    loadAddr); break;
+            default:     throw Util.shouldNotReachHere();
+        }
+    }
+
+    protected static void store(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiAddress storeAddr, CiValue input, LIRDebugInfo info) {
+        if (info != null) {
+            tasm.recordImplicitException(masm.codeBuffer.position(), info);
+        }
+
+        if (isRegister(input)) {
+            switch (storeAddr.kind) {
+                case Boolean:
+                case Byte:   masm.movb(storeAddr,   asRegister(input)); break;
+                case Char:
+                case Short:  masm.movw(storeAddr,   asRegister(input)); break;
+                case Int:    masm.movl(storeAddr,   asRegister(input)); break;
+                case Long:   masm.movq(storeAddr,   asRegister(input)); break;
+                case Float:  masm.movflt(storeAddr, asFloatReg(input)); break;
+                case Double: masm.movsd(storeAddr,  asDoubleReg(input)); break;
+                case Object: masm.movq(storeAddr,   asRegister(input)); break;
+                default:     throw Util.shouldNotReachHere();
+            }
+        } else if (isConstant(input)) {
+            CiConstant c = (CiConstant) input;
+            switch (storeAddr.kind) {
+                case Boolean:
+                case Byte:   masm.movb(storeAddr, c.asInt() & 0xFF); break;
+                case Char:
+                case Short:  masm.movw(storeAddr, c.asInt() & 0xFFFF); break;
+                case Jsr:
+                case Int:    masm.movl(storeAddr, c.asInt()); break;
+                case Long:
+                    if (Util.isInt(c.asLong())) {
+                        masm.movslq(storeAddr, (int) c.asLong());
+                    } else {
+                        throw Util.shouldNotReachHere("Cannot store 64-bit constants to memory");
+                    }
+                    break;
+                case Float:  masm.movl(storeAddr, floatToRawIntBits(c.asFloat())); break;
+                case Double: throw Util.shouldNotReachHere("Cannot store 64-bit constants to memory");
+                case Object:
+                    if (c.isNull()) {
+                        masm.movptr(storeAddr, 0);
+                    } else {
+                        throw Util.shouldNotReachHere("Cannot store 64-bit constants to memory");
+                    }
+                    break;
+                default:
+                    throw Util.shouldNotReachHere();
+            }
+
+        } else {
+            throw Util.shouldNotReachHere();
+        }
+    }
+
+    protected static void compareAndSwap(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiAddress address, CiValue cmpValue, CiValue newValue) {
+        assert asRegister(cmpValue) == AMD64.rax && asRegister(result) == AMD64.rax;
+
+        if (tasm.target.isMP) {
+            masm.lock();
+        }
+        switch (cmpValue.kind) {
+            case Int:    masm.cmpxchgl(asRegister(newValue), address); break;
+            case Long:
+            case Object: masm.cmpxchgq(asRegister(newValue), address); break;
+            default:     throw Util.shouldNotReachHere();
+        }
+    }
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64MoveOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,511 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
-import static java.lang.Double.*;
-import static java.lang.Float.*;
-
-import java.util.*;
-
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public class AMD64MoveOpcode {
-
-    public enum MoveOpcode implements LIROpcode {
-        MOVE;
-
-        public LIRInstruction create(CiValue result, CiValue input) {
-            assert result.kind == result.kind.stackKind() && result.kind != CiKind.Illegal;
-            CiValue[] inputs = new CiValue[] {input};
-            CiValue[] outputs = new CiValue[] {result};
-
-            if (isRegister(input) || isStackSlot(result)) {
-                return new AMD64MoveFromRegInstruction(this, outputs, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
-            } else {
-                return new AMD64MoveToRegInstruction(this, outputs, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
-            }
-        }
-    }
-
-    public enum SpillMoveOpcode implements StandardOpcode.MoveOpcode {
-        SPILL_MOVE;
-
-        @Override
-        public MoveInstruction create(CiValue result, CiValue input) {
-            assert result.kind == result.kind.stackKind() && result.kind != CiKind.Illegal;
-            CiValue[] inputs = new CiValue[] {input};
-            CiValue[] outputs = new CiValue[] {result};
-
-            return new AMD64SpillMoveInstruction(this, outputs, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
-        }
-    }
-
-    protected static class AMD64SpillMoveInstruction extends MoveInstruction {
-        public AMD64SpillMoveInstruction(LIROpcode opcode, CiValue[] outputs, LIRDebugInfo info, CiValue[] inputs, CiValue[] alives, CiValue[] temps) {
-            super(opcode, outputs, info, inputs, alives, temps);
-        }
-
-        @Override
-        public void emitCode(TargetMethodAssembler tasm) {
-            move(tasm, (AMD64MacroAssembler) tasm.asm, getDest(), getSource());
-        }
-
-        @Override
-        public CiValue getSource() {
-            return input(0);
-        }
-        @Override
-        public CiValue getDest() {
-            return output(0);
-        }
-
-        @Override
-        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-            if (mode == OperandMode.Input && index == 0) {
-                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
-            } else if (mode == OperandMode.Output && index == 0) {
-                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
-            }
-            throw Util.shouldNotReachHere();
-        }
-
-    }
-
-    protected static class AMD64MoveToRegInstruction extends MoveInstruction {
-        public AMD64MoveToRegInstruction(LIROpcode opcode, CiValue[] outputs, LIRDebugInfo info, CiValue[] inputs, CiValue[] alives, CiValue[] temps) {
-            super(opcode, outputs, info, inputs, alives, temps);
-        }
-
-        @Override
-        public void emitCode(TargetMethodAssembler tasm) {
-            move(tasm, (AMD64MacroAssembler) tasm.asm, getDest(), getSource());
-        }
-
-        @Override
-        public CiValue getSource() {
-            return input(0);
-        }
-        @Override
-        public CiValue getDest() {
-            return output(0);
-        }
-
-        @Override
-        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-            if (mode == OperandMode.Input && index == 0) {
-                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
-            } else if (mode == OperandMode.Output && index == 0) {
-                return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
-            }
-            throw Util.shouldNotReachHere();
-        }
-    }
-
-    protected static class AMD64MoveFromRegInstruction extends MoveInstruction {
-        public AMD64MoveFromRegInstruction(LIROpcode opcode, CiValue[] outputs, LIRDebugInfo info, CiValue[] inputs, CiValue[] alives, CiValue[] temps) {
-            super(opcode, outputs, info, inputs, alives, temps);
-        }
-
-        @Override
-        public void emitCode(TargetMethodAssembler tasm) {
-            move(tasm, (AMD64MacroAssembler) tasm.asm, getDest(), getSource());
-        }
-
-        @Override
-        public CiValue getSource() {
-            return input(0);
-        }
-        @Override
-        public CiValue getDest() {
-            return output(0);
-        }
-
-
-        @Override
-        protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-            if (mode == OperandMode.Input && index == 0) {
-                return EnumSet.of(OperandFlag.Register, OperandFlag.Constant, OperandFlag.RegisterHint);
-            } else if (mode == OperandMode.Output && index == 0) {
-                return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
-            }
-            throw Util.shouldNotReachHere();
-        }
-    }
-
-    public enum LoadOpcode implements LIROpcode {
-        LOAD;
-
-        public LIRInstruction create(CiValue result, CiValue address, LIRDebugInfo info) {
-            CiValue[] inputs = new CiValue[] {address};
-            CiValue[] outputs = new CiValue[] {result};
-
-            return new AMD64LIRInstruction(this, outputs, info, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                    load(tasm, masm, output(0), (CiAddress) input(0), info);
-                }
-
-                @Override
-                protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                    if (mode == OperandMode.Input && index == 0) {
-                        return EnumSet.of(OperandFlag.Address);
-                    }
-                    return super.flagsFor(mode, index);
-                }
-            };
-        }
-    }
-
-
-    public enum StoreOpcode implements LIROpcode {
-        STORE;
-
-        public LIRInstruction create(CiValue address, CiValue input, LIRDebugInfo info) {
-            CiValue[] inputs = new CiValue[] {address, input};
-
-            return new AMD64LIRInstruction(this, LIRInstruction.NO_OPERANDS, info, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                    store(tasm, masm, (CiAddress) input(0), input(1), info);
-                }
-
-                @Override
-                protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                    if (mode == OperandMode.Input && index == 0) {
-                        return EnumSet.of(OperandFlag.Address);
-                    } else if (mode == OperandMode.Input && index == 1) {
-                        return EnumSet.of(OperandFlag.Register, OperandFlag.Constant);
-                    }
-                    return super.flagsFor(mode, index);
-                }
-            };
-        }
-    }
-
-
-    public enum LeaOpcode implements LIROpcode {
-        LEA;
-
-        public LIRInstruction create(CiValue result, CiValue address) {
-            CiValue[] inputs = new CiValue[] {address};
-            CiValue[] outputs = new CiValue[] {result};
-
-            return new AMD64LIRInstruction(this, outputs, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                    masm.leaq(asLongReg(output(0)), tasm.asAddress(input(0)));
-                }
-
-                @Override
-                protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                    if (mode == OperandMode.Input && index == 0) {
-                        return EnumSet.of(OperandFlag.Address, OperandFlag.Stack, OperandFlag.Uninitialized);
-                    }
-                    return super.flagsFor(mode, index);
-                }
-            };
-        }
-    }
-
-
-    public enum MembarOpcode implements LIROpcode {
-        MEMBAR;
-
-        public LIRInstruction create(final int barriers) {
-            return new AMD64LIRInstruction(this, LIRInstruction.NO_OPERANDS, null, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                    masm.membar(barriers);
-                }
-            };
-        }
-    }
-
-
-    public enum NullCheckOpcode implements StandardOpcode.NullCheckOpcode {
-        NULL_CHECK;
-
-        @Override
-        public LIRInstruction create(Variable input, LIRDebugInfo info) {
-            CiValue[] inputs = new CiValue[] {input};
-
-            return new AMD64LIRInstruction(this, LIRInstruction.NO_OPERANDS, info, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                    tasm.recordImplicitException(masm.codeBuffer.position(), info);
-                    masm.nullCheck(asRegister(input(0)));
-                }
-            };
-        }
-    }
-
-
-    public enum CompareAndSwapOpcode implements LIROpcode {
-        CAS;
-
-        public LIRInstruction create(CiValue result, CiAddress address, CiValue cmpValue, CiValue newValue) {
-            CiValue[] inputs = new CiValue[] {address, cmpValue, newValue};
-            CiValue[] outputs = new CiValue[] {result};
-
-            return new AMD64LIRInstruction(this, outputs, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-                @Override
-                public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                    compareAndSwap(tasm, masm, output(0), asAddress(input(0)), input(1), input(2));
-                }
-
-                @Override
-                protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                    if (mode == OperandMode.Input && index == 0) {
-                        return EnumSet.of(OperandFlag.Address);
-                    }
-                    return super.flagsFor(mode, index);
-                }
-            };
-        }
-    }
-
-    protected static void move(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue input) {
-        if (isRegister(input)) {
-            if (isRegister(result)) {
-                reg2reg(masm, result, input);
-            } else if (isStackSlot(result)) {
-                reg2stack(tasm, masm, result, input);
-            } else {
-                throw Util.shouldNotReachHere();
-            }
-        } else if (isStackSlot(input)) {
-            if (isRegister(result)) {
-                stack2reg(tasm, masm, result, input);
-            } else {
-                throw Util.shouldNotReachHere();
-            }
-        } else if (isConstant(input)) {
-            if (isRegister(result)) {
-                const2reg(tasm, masm, result, (CiConstant) input);
-            } else if (isStackSlot(result)) {
-                const2stack(tasm, masm, result, (CiConstant) input);
-            } else {
-                throw Util.shouldNotReachHere();
-            }
-        } else {
-            throw Util.shouldNotReachHere();
-        }
-    }
-
-    private static void reg2reg(AMD64MacroAssembler masm, CiValue result, CiValue input) {
-        if (input.equals(result)) {
-            return;
-        }
-        switch (result.kind) {
-            case Jsr:
-            case Int:    masm.movl(asRegister(result),    asRegister(input)); break;
-            case Long:   masm.movq(asRegister(result),    asRegister(input)); break;
-            case Float:  masm.movflt(asFloatReg(result),  asFloatReg(input)); break;
-            case Double: masm.movdbl(asDoubleReg(result), asDoubleReg(input)); break;
-            case Object: masm.movq(asRegister(result),    asRegister(input)); break;
-            default:     throw Util.shouldNotReachHere("kind=" + result.kind);
-        }
-    }
-
-    private static void reg2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue input) {
-        switch (result.kind) {
-            case Jsr:
-            case Int:    masm.movl(tasm.asAddress(result),   asRegister(input)); break;
-            case Long:   masm.movq(tasm.asAddress(result),   asRegister(input)); break;
-            case Float:  masm.movflt(tasm.asAddress(result), asFloatReg(input)); break;
-            case Double: masm.movsd(tasm.asAddress(result),  asDoubleReg(input)); break;
-            case Object: masm.movq(tasm.asAddress(result),   asRegister(input)); break;
-            default:     throw Util.shouldNotReachHere();
-        }
-    }
-
-    private static void stack2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue input) {
-        switch (result.kind) {
-            case Jsr:
-            case Int:    masm.movl(asRegister(result),    tasm.asAddress(input)); break;
-            case Long:   masm.movq(asRegister(result),    tasm.asAddress(input)); break;
-            case Float:  masm.movflt(asFloatReg(result),  tasm.asAddress(input)); break;
-            case Double: masm.movdbl(asDoubleReg(result), tasm.asAddress(input)); break;
-            case Object: masm.movq(asRegister(result),    tasm.asAddress(input)); break;
-            default:     throw Util.shouldNotReachHere();
-        }
-    }
-
-    private static void const2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiConstant c) {
-        switch (result.kind) {
-            case Jsr:
-            case Int:
-                // Do not optimize with an XOR as this instruction may be between
-                // a CMP and a Jcc in which case the XOR will modify the condition
-                // flags and interfere with the Jcc.
-                masm.movl(asRegister(result), tasm.asIntConst(c));
-                break;
-            case Long:
-                // Do not optimize with an XOR as this instruction may be between
-                // a CMP and a Jcc in which case the XOR will modify the condition
-                // flags and interfere with the Jcc.
-                masm.movq(asRegister(result), c.asLong());
-                break;
-            case Float:
-                // This is *not* the same as 'constant == 0.0f' in the case where constant is -0.0f
-                if (Float.floatToRawIntBits(c.asFloat()) == Float.floatToRawIntBits(0.0f)) {
-                    masm.xorps(asFloatReg(result), asFloatReg(result));
-                } else {
-                    masm.movflt(asFloatReg(result), tasm.asFloatConstRef(c));
-                }
-                break;
-            case Double:
-                // This is *not* the same as 'constant == 0.0d' in the case where constant is -0.0d
-                if (Double.doubleToRawLongBits(c.asDouble()) == Double.doubleToRawLongBits(0.0d)) {
-                    masm.xorpd(asDoubleReg(result), asDoubleReg(result));
-                } else {
-                    masm.movdbl(asDoubleReg(result), tasm.asDoubleConstRef(c));
-                }
-                break;
-            case Object:
-                // Do not optimize with an XOR as this instruction may be between
-                // a CMP and a Jcc in which case the XOR will modify the condition
-                // flags and interfere with the Jcc.
-                if (c.isNull()) {
-                    masm.movq(asRegister(result), 0x0L);
-                } else if (tasm.target.inlineObjects) {
-                    tasm.recordDataReferenceInCode(c, 0);
-                    masm.movq(asRegister(result), 0xDEADDEADDEADDEADL);
-                } else {
-                    masm.movq(asRegister(result), tasm.recordDataReferenceInCode(c, 0));
-                }
-                break;
-            default:
-                throw Util.shouldNotReachHere();
-        }
-    }
-
-    private static void const2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiConstant c) {
-        switch (result.kind) {
-            case Jsr:
-            case Int:    masm.movl(tasm.asAddress(result), c.asInt()); break;
-            case Long:   masm.movlong(tasm.asAddress(result), c.asLong()); break;
-            case Float:  masm.movl(tasm.asAddress(result), floatToRawIntBits(c.asFloat())); break;
-            case Double: masm.movlong(tasm.asAddress(result), doubleToRawLongBits(c.asDouble())); break;
-            case Object:
-                if (c.isNull()) {
-                    masm.movlong(tasm.asAddress(result), 0L);
-                } else {
-                    throw Util.shouldNotReachHere("Non-null object constants must be in register");
-                }
-                break;
-            default:
-                throw Util.shouldNotReachHere();
-        }
-    }
-
-
-    protected static void load(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiAddress loadAddr, LIRDebugInfo info) {
-        if (info != null) {
-            tasm.recordImplicitException(masm.codeBuffer.position(), info);
-        }
-        switch (loadAddr.kind) {
-            case Boolean:
-            case Byte:   masm.movsxb(asRegister(result),  loadAddr); break;
-            case Char:   masm.movzxl(asRegister(result),  loadAddr); break;
-            case Short:  masm.movswl(asRegister(result),  loadAddr); break;
-            case Int:    masm.movslq(asRegister(result),  loadAddr); break;
-            case Long:   masm.movq(asRegister(result),    loadAddr); break;
-            case Float:  masm.movflt(asFloatReg(result),  loadAddr); break;
-            case Double: masm.movdbl(asDoubleReg(result), loadAddr); break;
-            case Object: masm.movq(asRegister(result),    loadAddr); break;
-            default:     throw Util.shouldNotReachHere();
-        }
-    }
-
-    protected static void store(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiAddress storeAddr, CiValue input, LIRDebugInfo info) {
-        if (info != null) {
-            tasm.recordImplicitException(masm.codeBuffer.position(), info);
-        }
-
-        if (isRegister(input)) {
-            switch (storeAddr.kind) {
-                case Boolean:
-                case Byte:   masm.movb(storeAddr,   asRegister(input)); break;
-                case Char:
-                case Short:  masm.movw(storeAddr,   asRegister(input)); break;
-                case Int:    masm.movl(storeAddr,   asRegister(input)); break;
-                case Long:   masm.movq(storeAddr,   asRegister(input)); break;
-                case Float:  masm.movflt(storeAddr, asFloatReg(input)); break;
-                case Double: masm.movsd(storeAddr,  asDoubleReg(input)); break;
-                case Object: masm.movq(storeAddr,   asRegister(input)); break;
-                default:     throw Util.shouldNotReachHere();
-            }
-        } else if (isConstant(input)) {
-            CiConstant c = (CiConstant) input;
-            switch (storeAddr.kind) {
-                case Boolean:
-                case Byte:   masm.movb(storeAddr, c.asInt() & 0xFF); break;
-                case Char:
-                case Short:  masm.movw(storeAddr, c.asInt() & 0xFFFF); break;
-                case Jsr:
-                case Int:    masm.movl(storeAddr, c.asInt()); break;
-                case Long:
-                    if (Util.isInt(c.asLong())) {
-                        masm.movslq(storeAddr, (int) c.asLong());
-                    } else {
-                        throw Util.shouldNotReachHere("Cannot store 64-bit constants to memory");
-                    }
-                    break;
-                case Float:  masm.movl(storeAddr, floatToRawIntBits(c.asFloat())); break;
-                case Double: throw Util.shouldNotReachHere("Cannot store 64-bit constants to memory");
-                case Object:
-                    if (c.isNull()) {
-                        masm.movptr(storeAddr, 0);
-                    } else {
-                        throw Util.shouldNotReachHere("Cannot store 64-bit constants to memory");
-                    }
-                    break;
-                default:
-                    throw Util.shouldNotReachHere();
-            }
-
-        } else {
-            throw Util.shouldNotReachHere();
-        }
-    }
-
-    protected static void compareAndSwap(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiAddress address, CiValue cmpValue, CiValue newValue) {
-        assert asRegister(cmpValue) == AMD64.rax && asRegister(result) == AMD64.rax;
-
-        if (tasm.target.isMP) {
-            masm.lock();
-        }
-        switch (cmpValue.kind) {
-            case Int:    masm.cmpxchgl(asRegister(newValue), address); break;
-            case Long:
-            case Object: masm.cmpxchgq(asRegister(newValue), address); break;
-            default:     throw Util.shouldNotReachHere();
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64MulOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public enum AMD64MulOpcode implements LIROpcode {
-    IMUL, LMUL;
-
-    public LIRInstruction create(CiValue result, CiValue x, CiValue y) {
-        CiValue[] inputs = new CiValue[] {x};
-        CiValue[] alives = new CiValue[] {y};
-        CiValue[] outputs = new CiValue[] {result};
-
-        return new AMD64LIRInstruction(this, outputs, null, inputs, alives, LIRInstruction.NO_OPERANDS) {
-            @Override
-            public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                emit(tasm, masm, output(0), input(0), alive(0));
-            }
-
-            @Override
-            public EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                if (mode == OperandMode.Input && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
-                } else if (mode == OperandMode.Alive && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.Constant);
-                } else if (mode == OperandMode.Output && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
-                }
-                return super.flagsFor(mode, index);
-            }
-        };
-    }
-
-    protected void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue x, CiValue y) {
-        assert sameRegister(x, y) || differentRegisters(result, y);
-        AMD64MoveOpcode.move(tasm, masm, result, x);
-
-        CiRegister dst = asRegister(result);
-        if (isRegister(y)) {
-            switch (this) {
-                case IMUL: masm.imull(dst, asRegister(y)); break;
-                case LMUL: masm.imulq(dst, asRegister(y)); break;
-                default:   throw Util.shouldNotReachHere();
-            }
-        } else {
-            switch (this) {
-                case IMUL: masm.imull(dst, dst, tasm.asIntConst(y)); break;
-                case LMUL: masm.imulq(dst, dst, tasm.asIntConst(y)); break;
-                default:   throw Util.shouldNotReachHere();
-            }
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Op1Opcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public enum AMD64Op1Opcode implements LIROpcode {
-    INEG, LNEG;
-
-    public LIRInstruction create(CiValue result, CiValue x) {
-        CiValue[] inputs = new CiValue[] {x};
-        CiValue[] outputs = new CiValue[] {result};
-
-        return new AMD64LIRInstruction(this, outputs, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-            @Override
-            public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                emit(tasm, masm, output(0), input(0));
-            }
-
-            @Override
-            public EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                if (mode == OperandMode.Input && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
-                } else if (mode == OperandMode.Output && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
-                }
-                return super.flagsFor(mode, index);
-            }
-        };
-    }
-
-    private void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue x) {
-        AMD64MoveOpcode.move(tasm, masm, result, x);
-        switch (this) {
-            case INEG: masm.negl(asIntReg(result)); break;
-            case LNEG: masm.negq(asLongReg(result)); break;
-            default:   throw Util.shouldNotReachHere();
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ShiftOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public enum AMD64ShiftOpcode implements LIROpcode {
-    ISHL, ISHR, IUSHR,
-    LSHL, LSHR, LUSHR;
-
-    public LIRInstruction create(CiValue result, CiValue x, CiValue y) {
-        CiValue[] inputs = new CiValue[] {x};
-        CiValue[] alives = new CiValue[] {y};
-        CiValue[] outputs = new CiValue[] {result};
-
-        return new AMD64LIRInstruction(this, outputs, null, inputs, alives, LIRInstruction.NO_OPERANDS) {
-            @Override
-            public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                emit(tasm, masm, output(0), input(0), alive(0));
-            }
-
-            @Override
-            public EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-                if (mode == OperandMode.Input && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
-                } else if (mode == OperandMode.Alive && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.Constant);
-                } else if (mode == OperandMode.Output && index == 0) {
-                    return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
-                }
-                return super.flagsFor(mode, index);
-            }
-        };
-    }
-
-    protected void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue x, CiValue y) {
-        assert sameRegister(x, y) || differentRegisters(result, y);
-        AMD64MoveOpcode.move(tasm, masm, result, x);
-
-        CiRegister dst = asRegister(result);
-        if (isRegister(y)) {
-            assert asRegister(y) == AMD64.rcx;
-            switch (this) {
-                case ISHL:  masm.shll(dst); break;
-                case ISHR:  masm.sarl(dst); break;
-                case IUSHR: masm.shrl(dst); break;
-                case LSHL:  masm.shlq(dst); break;
-                case LSHR:  masm.sarq(dst); break;
-                case LUSHR: masm.shrq(dst); break;
-                default:    throw Util.shouldNotReachHere();
-            }
-        } else if (isConstant(y)) {
-            switch (this) {
-                case ISHL:  masm.shll(dst, tasm.asIntConst(y) & 31); break;
-                case ISHR:  masm.sarl(dst, tasm.asIntConst(y) & 31); break;
-                case IUSHR: masm.shrl(dst, tasm.asIntConst(y) & 31); break;
-                case LSHL:  masm.shlq(dst, tasm.asIntConst(y) & 63); break;
-                case LSHR:  masm.sarq(dst, tasm.asIntConst(y) & 63); break;
-                case LUSHR: masm.shrq(dst, tasm.asIntConst(y) & 63); break;
-                default:   throw Util.shouldNotReachHere();
-            }
-        } else {
-            throw Util.shouldNotReachHere();
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64StandardOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-
-/**
- * A collection of AMD64 specific opcodes that is convenient for a static import.
- * Since every defined opcode is in its own enum, accessing them without this class is
- * more verbose.
- */
-public class AMD64StandardOpcode {
-    public static final AMD64MoveOpcode.MoveOpcode MOVE = AMD64MoveOpcode.MoveOpcode.MOVE;
-    public static final AMD64MoveOpcode.LoadOpcode LOAD = AMD64MoveOpcode.LoadOpcode.LOAD;
-    public static final AMD64MoveOpcode.StoreOpcode STORE = AMD64MoveOpcode.StoreOpcode.STORE;
-    public static final AMD64MoveOpcode.LeaOpcode LEA = AMD64MoveOpcode.LeaOpcode.LEA;
-    public static final AMD64MoveOpcode.MembarOpcode MEMBAR = AMD64MoveOpcode.MembarOpcode.MEMBAR;
-    public static final AMD64MoveOpcode.NullCheckOpcode NULL_CHECK = AMD64MoveOpcode.NullCheckOpcode.NULL_CHECK;
-    public static final AMD64MoveOpcode.CompareAndSwapOpcode CAS = AMD64MoveOpcode.CompareAndSwapOpcode.CAS;
-
-    public static final AMD64ControlFlowOpcode.LabelOpcode LABEL = AMD64ControlFlowOpcode.LabelOpcode.LABEL;
-    public static final AMD64ControlFlowOpcode.ReturnOpcode RETURN = AMD64ControlFlowOpcode.ReturnOpcode.RETURN;
-    public static final AMD64ControlFlowOpcode.JumpOpcode JUMP = AMD64ControlFlowOpcode.JumpOpcode.JUMP;
-    public static final AMD64ControlFlowOpcode.BranchOpcode BRANCH = AMD64ControlFlowOpcode.BranchOpcode.BRANCH;
-    public static final AMD64ControlFlowOpcode.FloatBranchOpcode FLOAT_BRANCH = AMD64ControlFlowOpcode.FloatBranchOpcode.FLOAT_BRANCH;
-    public static final AMD64ControlFlowOpcode.TableSwitchOpcode TABLE_SWITCH = AMD64ControlFlowOpcode.TableSwitchOpcode.TABLE_SWITCH;
-    public static final AMD64ControlFlowOpcode.CondMoveOpcode CMOVE = AMD64ControlFlowOpcode.CondMoveOpcode.CMOVE;
-    public static final AMD64ControlFlowOpcode.FloatCondMoveOpcode FLOAT_CMOVE = AMD64ControlFlowOpcode.FloatCondMoveOpcode.FLOAT_CMOVE;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64XirOp.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,552 @@
+/*
+ * Copyright (c) 2011, 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.compiler.target.amd64;
+
+import static com.oracle.max.cri.ci.CiCallingConvention.Type.*;
+import static com.oracle.max.cri.ci.CiValue.*;
+import static com.oracle.max.cri.ci.CiValueUtil.*;
+
+import java.util.*;
+
+import com.oracle.max.asm.*;
+import com.oracle.max.asm.target.amd64.*;
+import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag;
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.cri.ci.CiTargetMethod.Mark;
+import com.oracle.max.cri.xir.*;
+import com.oracle.max.cri.xir.CiXirAssembler.RuntimeCallInformation;
+import com.oracle.max.cri.xir.CiXirAssembler.XirInstruction;
+import com.oracle.max.cri.xir.CiXirAssembler.XirLabel;
+import com.oracle.max.cri.xir.CiXirAssembler.XirMark;
+import com.oracle.max.graal.compiler.*;
+import com.oracle.max.graal.compiler.asm.*;
+import com.oracle.max.graal.compiler.lir.*;
+import com.oracle.max.graal.compiler.util.*;
+
+public class AMD64XirOp extends LIRXirInstruction {
+    public AMD64XirOp(XirSnippet snippet, CiValue[] operands, CiValue outputOperand, CiValue[] inputs, CiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex,
+                        LIRDebugInfo info, LIRDebugInfo infoAfter, LabelRef trueSuccessor, LabelRef falseSuccessor) {
+        super("XIR", snippet, operands, outputOperand, inputs, temps, inputOperandIndices, tempOperandIndices, outputOperandIndex, info, infoAfter, trueSuccessor, falseSuccessor);
+    }
+
+    @Override
+    public void emitCode(TargetMethodAssembler tasm) {
+        AMD64MacroAssembler masm = (AMD64MacroAssembler) tasm.asm;
+
+        Label endLabel = null;
+        Label[] labels = new Label[snippet.template.labels.length];
+        for (int i = 0; i < labels.length; i++) {
+            labels[i] = new Label();
+            if (snippet.template.labels[i].name == XirLabel.TrueSuccessor) {
+                if (trueSuccessor == null) {
+                    assert endLabel == null;
+                    endLabel = new Label();
+                    labels[i] = endLabel;
+                } else {
+                    labels[i] = trueSuccessor.label();
+                }
+            } else if (snippet.template.labels[i].name == XirLabel.FalseSuccessor) {
+                if (falseSuccessor == null) {
+                    assert endLabel == null;
+                    endLabel = new Label();
+                    labels[i] = endLabel;
+                } else {
+                    labels[i] = falseSuccessor.label();
+                }
+            }
+        }
+        emitXirInstructions(tasm, masm, snippet.template.fastPath, labels, getOperands(), snippet.marks);
+        if (endLabel != null) {
+            masm.bind(endLabel);
+        }
+
+        if (snippet.template.slowPath != null) {
+            tasm.slowPaths.add(new SlowPath(labels));
+        }
+    }
+
+    private class SlowPath extends AMD64SlowPath {
+        public final Label[] labels;
+
+        public SlowPath(Label[] labels) {
+            this.labels = labels;
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            emitXirInstructions(tasm, masm, snippet.template.slowPath, labels, getOperands(), snippet.marks);
+            masm.nop();
+        }
+    }
+
+
+    protected void emitXirInstructions(TargetMethodAssembler tasm, AMD64MacroAssembler masm, XirInstruction[] instructions, Label[] labels, CiValue[] operands, Map<XirMark, Mark> marks) {
+        for (XirInstruction inst : instructions) {
+            switch (inst.op) {
+                case Add:
+                    emitXirViaLir(tasm, masm, AMD64Arithmetic.IADD, AMD64Arithmetic.LADD, AMD64Arithmetic.FADD, AMD64Arithmetic.DADD, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
+                    break;
+
+                case Sub:
+                    emitXirViaLir(tasm, masm, AMD64Arithmetic.ISUB, AMD64Arithmetic.LSUB, AMD64Arithmetic.FSUB, AMD64Arithmetic.DSUB, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
+                    break;
+
+                case Div:
+                    emitXirViaLir(tasm, masm, AMD64Arithmetic.IDIV, AMD64Arithmetic.LDIV, AMD64Arithmetic.FDIV, AMD64Arithmetic.DDIV, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
+                    break;
+
+                case Mul:
+                    emitXirViaLir(tasm, masm, AMD64Arithmetic.IMUL, AMD64Arithmetic.LMUL, AMD64Arithmetic.FMUL, AMD64Arithmetic.DMUL, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
+                    break;
+
+                case Mod:
+                    emitXirViaLir(tasm, masm, AMD64Arithmetic.IREM, AMD64Arithmetic.LREM, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
+                    break;
+
+                case Shl:
+                    emitXirViaLir(tasm, masm, AMD64Arithmetic.ISHL, AMD64Arithmetic.LSHL, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
+                    break;
+
+                case Sar:
+                    emitXirViaLir(tasm, masm, AMD64Arithmetic.ISHR, AMD64Arithmetic.LSHR, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
+                    break;
+
+                case Shr:
+                    emitXirViaLir(tasm, masm, AMD64Arithmetic.IUSHR, AMD64Arithmetic.LUSHR, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
+                    break;
+
+                case And:
+                    emitXirViaLir(tasm, masm, AMD64Arithmetic.IAND, AMD64Arithmetic.LAND, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
+                    break;
+
+                case Or:
+                    emitXirViaLir(tasm, masm, AMD64Arithmetic.IOR, AMD64Arithmetic.LOR, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
+                    break;
+
+                case Xor:
+                    emitXirViaLir(tasm, masm, AMD64Arithmetic.IXOR, AMD64Arithmetic.LXOR, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
+                    break;
+
+                case Mov: {
+                    CiValue result = operands[inst.result.index];
+                    CiValue source = operands[inst.x().index];
+                    AMD64Move.move(tasm, masm, result, source);
+                    break;
+                }
+
+                case PointerLoad: {
+                    CiValue result = operands[inst.result.index];
+                    CiValue pointer = operands[inst.x().index];
+                    CiRegisterValue register = assureInRegister(tasm, masm, pointer);
+
+                    AMD64Move.load(tasm, masm, result, new CiAddress(inst.kind, register), (Boolean) inst.extra ? info : null);
+                    break;
+                }
+
+                case PointerStore: {
+                    CiValue value = assureNot64BitConstant(tasm, masm, operands[inst.y().index]);
+                    CiValue pointer = operands[inst.x().index];
+                    assert isRegister(pointer);
+
+                    AMD64Move.store(tasm, masm, new CiAddress(inst.kind, pointer), value, (Boolean) inst.extra ? info : null);
+                    break;
+                }
+
+                case PointerLoadDisp: {
+                    CiXirAssembler.AddressAccessInformation addressInformation = (CiXirAssembler.AddressAccessInformation) inst.extra;
+                    boolean canTrap = addressInformation.canTrap;
+
+                    CiAddress.Scale scale = addressInformation.scale;
+                    int displacement = addressInformation.disp;
+
+                    CiValue result = operands[inst.result.index];
+                    CiValue pointer = operands[inst.x().index];
+                    CiValue index = operands[inst.y().index];
+
+                    pointer = assureInRegister(tasm, masm, pointer);
+                    assert isRegister(pointer);
+
+                    CiAddress src;
+                    if (isConstant(index)) {
+                        assert index.kind == CiKind.Int;
+                        CiConstant constantIndex = (CiConstant) index;
+                        src = new CiAddress(inst.kind, pointer, constantIndex.asInt() * scale.value + displacement);
+                    } else {
+                        src = new CiAddress(inst.kind, pointer, index, scale, displacement);
+                    }
+
+                    AMD64Move.load(tasm, masm, result, src, canTrap ? info : null);
+                    break;
+                }
+
+                case LoadEffectiveAddress: {
+                    CiXirAssembler.AddressAccessInformation addressInformation = (CiXirAssembler.AddressAccessInformation) inst.extra;
+
+                    CiAddress.Scale scale = addressInformation.scale;
+                    int displacement = addressInformation.disp;
+
+                    CiValue result = operands[inst.result.index];
+                    CiValue pointer = operands[inst.x().index];
+                    CiValue index = operands[inst.y().index];
+
+                    pointer = assureInRegister(tasm, masm, pointer);
+                    assert isRegister(pointer);
+                    CiAddress src = new CiAddress(CiKind.Illegal, pointer, index, scale, displacement);
+                    masm.leaq(asRegister(result), src);
+                    break;
+                }
+
+                case PointerStoreDisp: {
+                    CiXirAssembler.AddressAccessInformation addressInformation = (CiXirAssembler.AddressAccessInformation) inst.extra;
+                    boolean canTrap = addressInformation.canTrap;
+
+                    CiAddress.Scale scale = addressInformation.scale;
+                    int displacement = addressInformation.disp;
+
+                    CiValue value = assureNot64BitConstant(tasm, masm, operands[inst.z().index]);
+                    CiValue pointer = operands[inst.x().index];
+                    CiValue index = operands[inst.y().index];
+
+                    pointer = assureInRegister(tasm, masm, pointer);
+                    assert isRegister(pointer);
+
+                    CiAddress dst;
+                    if (isConstant(index)) {
+                        assert index.kind == CiKind.Int;
+                        CiConstant constantIndex = (CiConstant) index;
+                        dst = new CiAddress(inst.kind, pointer, IllegalValue, scale, constantIndex.asInt() * scale.value + displacement);
+                    } else {
+                        dst = new CiAddress(inst.kind, pointer, index, scale, displacement);
+                    }
+
+                    AMD64Move.store(tasm, masm, dst, value, canTrap ? info : null);
+                    break;
+                }
+
+                case RepeatMoveBytes:
+                    assert asRegister(operands[inst.x().index]).equals(AMD64.rsi) : "wrong input x: " + operands[inst.x().index];
+                    assert asRegister(operands[inst.y().index]).equals(AMD64.rdi) : "wrong input y: " + operands[inst.y().index];
+                    assert asRegister(operands[inst.z().index]).equals(AMD64.rcx) : "wrong input z: " + operands[inst.z().index];
+                    masm.repeatMoveBytes();
+                    break;
+
+                case RepeatMoveWords:
+                    assert asRegister(operands[inst.x().index]).equals(AMD64.rsi) : "wrong input x: " + operands[inst.x().index];
+                    assert asRegister(operands[inst.y().index]).equals(AMD64.rdi) : "wrong input y: " + operands[inst.y().index];
+                    assert asRegister(operands[inst.z().index]).equals(AMD64.rcx) : "wrong input z: " + operands[inst.z().index];
+                    masm.repeatMoveWords();
+                    break;
+
+                case PointerCAS:
+                    assert asRegister(operands[inst.x().index]).equals(AMD64.rax) : "wrong input x: " + operands[inst.x().index];
+
+                    CiValue exchangedVal = operands[inst.y().index];
+                    CiValue exchangedAddress = operands[inst.x().index];
+                    CiRegisterValue pointerRegister = assureInRegister(tasm, masm, exchangedAddress);
+                    CiAddress addr = new CiAddress(tasm.target.wordKind, pointerRegister);
+
+                    if ((Boolean) inst.extra && info != null) {
+                        tasm.recordImplicitException(masm.codeBuffer.position(), info);
+                    }
+                    masm.cmpxchgq(asRegister(exchangedVal), addr);
+
+                    break;
+
+                case CallRuntime: {
+                    CiKind[] signature = new CiKind[inst.arguments.length];
+                    for (int i = 0; i < signature.length; i++) {
+                        signature[i] = inst.arguments[i].kind;
+                    }
+
+                    CiCallingConvention cc = tasm.frameMap.registerConfig.getCallingConvention(RuntimeCall, signature, tasm.target, false);
+                    for (int i = 0; i < inst.arguments.length; i++) {
+                        CiValue argumentLocation = cc.locations[i];
+                        CiValue argumentSourceLocation = operands[inst.arguments[i].index];
+                        if (argumentLocation != argumentSourceLocation) {
+                            AMD64Move.move(tasm, masm, argumentLocation, argumentSourceLocation);
+                        }
+                    }
+
+                    RuntimeCallInformation runtimeCallInformation = (RuntimeCallInformation) inst.extra;
+                    AMD64Call.directCall(tasm, masm, runtimeCallInformation.target, (runtimeCallInformation.useInfoAfter) ? infoAfter : info);
+
+                    if (inst.result != null && inst.result.kind != CiKind.Illegal && inst.result.kind != CiKind.Void) {
+                        CiRegister returnRegister = tasm.frameMap.registerConfig.getReturnRegister(inst.result.kind);
+                        CiValue resultLocation = returnRegister.asValue(inst.result.kind.stackKind());
+                        AMD64Move.move(tasm, masm, operands[inst.result.index], resultLocation);
+                    }
+                    break;
+                }
+                case Jmp: {
+                    if (inst.extra instanceof XirLabel) {
+                        Label label = labels[((XirLabel) inst.extra).index];
+                        masm.jmp(label);
+                    } else {
+                        AMD64Call.directJmp(tasm, masm, inst.extra);
+                    }
+                    break;
+                }
+                case DecAndJumpNotZero: {
+                    Label label = labels[((XirLabel) inst.extra).index];
+                    CiValue value = operands[inst.x().index];
+                    if (value.kind == CiKind.Long) {
+                        masm.decq(asRegister(value));
+                    } else {
+                        assert value.kind == CiKind.Int;
+                        masm.decl(asRegister(value));
+                    }
+                    masm.jcc(ConditionFlag.notZero, label);
+                    break;
+                }
+                case Jeq: {
+                    Label label = labels[((XirLabel) inst.extra).index];
+                    emitXirCompare(tasm, masm, inst, ConditionFlag.equal, operands, label);
+                    break;
+                }
+                case Jneq: {
+                    Label label = labels[((XirLabel) inst.extra).index];
+                    emitXirCompare(tasm, masm, inst, ConditionFlag.notEqual, operands, label);
+                    break;
+                }
+
+                case Jgt: {
+                    Label label = labels[((XirLabel) inst.extra).index];
+                    emitXirCompare(tasm, masm, inst, ConditionFlag.greater, operands, label);
+                    break;
+                }
+
+                case Jgteq: {
+                    Label label = labels[((XirLabel) inst.extra).index];
+                    emitXirCompare(tasm, masm, inst, ConditionFlag.greaterEqual, operands, label);
+                    break;
+                }
+
+                case Jugteq: {
+                    Label label = labels[((XirLabel) inst.extra).index];
+                    emitXirCompare(tasm, masm, inst, ConditionFlag.aboveEqual, operands, label);
+                    break;
+                }
+
+                case Jlt: {
+                    Label label = labels[((XirLabel) inst.extra).index];
+                    emitXirCompare(tasm, masm, inst, ConditionFlag.less, operands, label);
+                    break;
+                }
+
+                case Jlteq: {
+                    Label label = labels[((XirLabel) inst.extra).index];
+                    emitXirCompare(tasm, masm, inst, ConditionFlag.lessEqual, operands, label);
+                    break;
+                }
+
+                case Jbset: {
+                    Label label = labels[((XirLabel) inst.extra).index];
+                    CiValue pointer = operands[inst.x().index];
+                    CiValue offset = operands[inst.y().index];
+                    CiValue bit = operands[inst.z().index];
+                    assert isConstant(offset) && isConstant(bit);
+                    CiConstant constantOffset = (CiConstant) offset;
+                    CiConstant constantBit = (CiConstant) bit;
+                    CiAddress src = new CiAddress(inst.kind, pointer, constantOffset.asInt());
+                    masm.btli(src, constantBit.asInt());
+                    masm.jcc(ConditionFlag.aboveEqual, label);
+                    break;
+                }
+
+                case Bind: {
+                    XirLabel l = (XirLabel) inst.extra;
+                    Label label = labels[l.index];
+                    masm.bind(label);
+                    break;
+                }
+                case Safepoint: {
+                    assert info != null : "Must have debug info in order to create a safepoint.";
+                    tasm.recordSafepoint(masm.codeBuffer.position(), info);
+                    break;
+                }
+                case NullCheck: {
+                    tasm.recordImplicitException(masm.codeBuffer.position(), info);
+                    CiValue pointer = operands[inst.x().index];
+                    masm.nullCheck(asRegister(pointer));
+                    break;
+                }
+                case Align: {
+                    masm.align((Integer) inst.extra);
+                    break;
+                }
+                case StackOverflowCheck: {
+                    int frameSize = tasm.frameMap.frameSize();
+                    int lastFramePage = frameSize / tasm.target.pageSize;
+                    // emit multiple stack bangs for methods with frames larger than a page
+                    for (int i = 0; i <= lastFramePage; i++) {
+                        int offset = (i + GraalOptions.StackShadowPages) * tasm.target.pageSize;
+                        // Deduct 'frameSize' to handle frames larger than the shadow
+                        bangStackWithOffset(tasm, masm, offset - frameSize);
+                    }
+                    break;
+                }
+                case PushFrame: {
+                    int frameSize = tasm.frameMap.frameSize();
+                    masm.decrementq(AMD64.rsp, frameSize); // does not emit code for frameSize == 0
+                    if (GraalOptions.ZapStackOnMethodEntry) {
+                        final int intSize = 4;
+                        for (int i = 0; i < frameSize / intSize; ++i) {
+                            masm.movl(new CiAddress(CiKind.Int, AMD64.rsp.asValue(), i * intSize), 0xC1C1C1C1);
+                        }
+                    }
+                    CiCalleeSaveLayout csl = tasm.frameMap.registerConfig.getCalleeSaveLayout();
+                    if (csl != null && csl.size != 0) {
+                        int frameToCSA = tasm.frameMap.offsetToCalleeSaveArea();
+                        assert frameToCSA >= 0;
+                        masm.save(csl, frameToCSA);
+                    }
+                    break;
+                }
+                case PopFrame: {
+                    int frameSize = tasm.frameMap.frameSize();
+
+                    CiCalleeSaveLayout csl = tasm.frameMap.registerConfig.getCalleeSaveLayout();
+                    if (csl != null && csl.size != 0) {
+                        tasm.targetMethod.setRegisterRestoreEpilogueOffset(masm.codeBuffer.position());
+                        // saved all registers, restore all registers
+                        int frameToCSA = tasm.frameMap.offsetToCalleeSaveArea();
+                        masm.restore(csl, frameToCSA);
+                    }
+
+                    masm.incrementq(AMD64.rsp, frameSize);
+                    break;
+                }
+                case Push: {
+                    CiRegisterValue value = assureInRegister(tasm, masm, operands[inst.x().index]);
+                    masm.push(asRegister(value));
+                    break;
+                }
+                case Pop: {
+                    CiValue result = operands[inst.result.index];
+                    if (isRegister(result)) {
+                        masm.pop(asRegister(result));
+                    } else {
+                        CiRegister rscratch = tasm.frameMap.registerConfig.getScratchRegister();
+                        masm.pop(rscratch);
+                        AMD64Move.move(tasm, masm, result, rscratch.asValue());
+                    }
+                    break;
+                }
+                case Mark: {
+                    XirMark xmark = (XirMark) inst.extra;
+                    Mark[] references = new Mark[xmark.references.length];
+                    for (int i = 0; i < references.length; i++) {
+                        references[i] = marks.get(xmark.references[i]);
+                        assert references[i] != null;
+                    }
+                    Mark mark = tasm.recordMark(xmark.id, references);
+                    marks.put(xmark, mark);
+                    break;
+                }
+                case Nop: {
+                    for (int i = 0; i < (Integer) inst.extra; i++) {
+                        masm.nop();
+                    }
+                    break;
+                }
+                case RawBytes: {
+                    for (byte b : (byte[]) inst.extra) {
+                        masm.codeBuffer.emitByte(b & 0xff);
+                    }
+                    break;
+                }
+                case ShouldNotReachHere: {
+                    AMD64Call.shouldNotReachHere(tasm, masm);
+                    break;
+                }
+                default:
+                    throw Util.shouldNotReachHere("Unknown XIR operation " + inst.op);
+            }
+        }
+    }
+
+    private static void emitXirViaLir(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Arithmetic intOp, AMD64Arithmetic longOp, AMD64Arithmetic floatOp,
+                    AMD64Arithmetic doubleOp, CiValue left, CiValue right, CiValue result) {
+        AMD64Arithmetic code;
+        switch (result.kind) {
+            case Int: code = intOp; break;
+            case Long: code = longOp; break;
+            case Float: code = floatOp; break;
+            case Double: code = doubleOp; break;
+            default: throw Util.shouldNotReachHere();
+        }
+        assert left == result;
+        if (isRegister(right) && right.kind != result.kind) {
+            // XIR is not strongly typed, so we can have a type mismatch that we have to fix here.
+            AMD64Arithmetic.emit(tasm, masm, code, result, asRegister(right).asValue(result.kind), null);
+        } else {
+            AMD64Arithmetic.emit(tasm, masm, code, result, right, null);
+        }
+    }
+
+    private static void emitXirCompare(TargetMethodAssembler tasm, AMD64MacroAssembler masm, XirInstruction inst, ConditionFlag cflag, CiValue[] ops, Label label) {
+        CiValue x = ops[inst.x().index];
+        CiValue y = ops[inst.y().index];
+        AMD64Compare code;
+        switch (x.kind) {
+            case Int: code = AMD64Compare.ICMP; break;
+            case Long: code = AMD64Compare.LCMP; break;
+            case Object: code = AMD64Compare.ACMP; break;
+            case Float: code = AMD64Compare.FCMP; break;
+            case Double: code = AMD64Compare.DCMP; break;
+            default: throw Util.shouldNotReachHere();
+        }
+        AMD64Compare.emit(tasm, masm, code, x, y);
+        masm.jcc(cflag, label);
+    }
+
+    /**
+     * @param offset the offset RSP at which to bang. Note that this offset is relative to RSP after RSP has been
+     *            adjusted to allocated the frame for the method. It denotes an offset "down" the stack.
+     *            For very large frames, this means that the offset may actually be negative (i.e. denoting
+     *            a slot "up" the stack above RSP).
+     */
+    private static void bangStackWithOffset(TargetMethodAssembler tasm, AMD64MacroAssembler masm, int offset) {
+        masm.movq(new CiAddress(tasm.target.wordKind, AMD64.RSP, -offset), AMD64.rax);
+    }
+
+    private static CiValue assureNot64BitConstant(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue value) {
+        if (isConstant(value) && (value.kind == CiKind.Long || value.kind == CiKind.Object)) {
+            CiRegisterValue register = tasm.frameMap.registerConfig.getScratchRegister().asValue(value.kind);
+            AMD64Move.move(tasm, masm, register, value);
+            return register;
+        }
+        return value;
+    }
+
+    private static CiRegisterValue assureInRegister(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue pointer) {
+        if (isConstant(pointer)) {
+            CiRegisterValue register = tasm.frameMap.registerConfig.getScratchRegister().asValue(pointer.kind);
+            AMD64Move.move(tasm, masm, register, pointer);
+            return register;
+        }
+
+        assert isRegister(pointer) : "should be register, but is: " + pointer;
+        return (CiRegisterValue) pointer;
+    }
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64XirOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,577 +0,0 @@
-/*
- * Copyright (c) 2011, 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.compiler.target.amd64;
-
-import static com.oracle.max.cri.ci.CiCallingConvention.Type.*;
-import static com.oracle.max.cri.ci.CiValue.*;
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.max.asm.*;
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiTargetMethod.*;
-import com.oracle.max.cri.ri.*;
-import com.oracle.max.cri.xir.*;
-import com.oracle.max.cri.xir.CiXirAssembler.*;
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public enum AMD64XirOpcode implements StandardOpcode.XirOpcode {
-    XIR;
-
-    public LIRInstruction create(XirSnippet snippet, CiValue[] operands, CiValue outputOperand, CiValue[] inputs, CiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex,
-                        LIRDebugInfo info, LIRDebugInfo infoAfter, RiMethod method) {
-        return new LIRXirInstruction(this, snippet, operands, outputOperand, inputs, temps, inputOperandIndices, tempOperandIndices, outputOperandIndex, info, infoAfter, method) {
-            @Override
-            public void emitCode(TargetMethodAssembler tasm) {
-                emit(tasm, (AMD64MacroAssembler) tasm.asm, this);
-            }
-        };
-    }
-
-    private static void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, LIRXirInstruction op) {
-        XirSnippet snippet = op.snippet;
-        Label endLabel = null;
-        Label[] labels = new Label[snippet.template.labels.length];
-        for (int i = 0; i < labels.length; i++) {
-            labels[i] = new Label();
-            if (snippet.template.labels[i].name == XirLabel.TrueSuccessor) {
-                if (op.trueSuccessor() == null) {
-                    assert endLabel == null;
-                    endLabel = new Label();
-                    labels[i] = endLabel;
-                } else {
-                    labels[i] = op.trueSuccessor().label();
-                }
-            } else if (snippet.template.labels[i].name == XirLabel.FalseSuccessor) {
-                if (op.falseSuccessor() == null) {
-                    assert endLabel == null;
-                    endLabel = new Label();
-                    labels[i] = endLabel;
-                } else {
-                    labels[i] = op.falseSuccessor().label();
-                }
-            }
-        }
-        emitXirInstructions(tasm, masm, op, snippet.template.fastPath, labels, op.getOperands(), snippet.marks);
-        if (endLabel != null) {
-            masm.bind(endLabel);
-        }
-
-        if (snippet.template.slowPath != null) {
-            tasm.slowPaths.add(new SlowPath(op, labels, snippet.marks));
-        }
-    }
-
-    private static class SlowPath extends AMD64SlowPath {
-        public final LIRXirInstruction instruction;
-        public final Label[] labels;
-        public final Map<XirMark, Mark> marks;
-
-        public SlowPath(LIRXirInstruction instruction, Label[] labels, Map<XirMark, Mark> marks) {
-            this.instruction = instruction;
-            this.labels = labels;
-            this.marks = marks;
-        }
-
-        @Override
-        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-            emitSlowPath(tasm, masm, this);
-        }
-    }
-
-
-    private static void emitSlowPath(TargetMethodAssembler tasm, AMD64MacroAssembler masm, SlowPath sp) {
-        int start = -1;
-        if (GraalOptions.TraceAssembler) {
-            TTY.println("Emitting slow path for XIR instruction " + sp.instruction.snippet.template.name);
-            start = masm.codeBuffer.position();
-        }
-        emitXirInstructions(tasm, masm, sp.instruction, sp.instruction.snippet.template.slowPath, sp.labels, sp.instruction.getOperands(), sp.marks);
-        masm.nop();
-        if (GraalOptions.TraceAssembler) {
-            TTY.println("From " + start + " to " + masm.codeBuffer.position());
-        }
-    }
-
-    protected static void emitXirInstructions(TargetMethodAssembler tasm, AMD64MacroAssembler masm, LIRXirInstruction xir, XirInstruction[] instructions, Label[] labels, CiValue[] operands, Map<XirMark, Mark> marks) {
-        LIRDebugInfo info = xir == null ? null : xir.info;
-        LIRDebugInfo infoAfter = xir == null ? null : xir.infoAfter;
-
-        for (XirInstruction inst : instructions) {
-            switch (inst.op) {
-                case Add:
-                    emitXirViaLir(tasm, masm, AMD64ArithmeticOpcode.IADD, AMD64ArithmeticOpcode.LADD, AMD64ArithmeticOpcode.FADD, AMD64ArithmeticOpcode.DADD, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
-                    break;
-
-                case Sub:
-                    emitXirViaLir(tasm, masm, AMD64ArithmeticOpcode.ISUB, AMD64ArithmeticOpcode.LSUB, AMD64ArithmeticOpcode.FSUB, AMD64ArithmeticOpcode.DSUB, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
-                    break;
-
-                case Div:
-                    emitXirViaLir(tasm, masm, AMD64DivOpcode.IDIV, AMD64DivOpcode.LDIV, AMD64ArithmeticOpcode.FDIV, AMD64ArithmeticOpcode.DDIV, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
-                    break;
-
-                case Mul:
-                    emitXirViaLir(tasm, masm, AMD64MulOpcode.IMUL, AMD64MulOpcode.LMUL, AMD64ArithmeticOpcode.FMUL, AMD64ArithmeticOpcode.DMUL, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
-                    break;
-
-                case Mod:
-                    emitXirViaLir(tasm, masm, AMD64DivOpcode.IREM, AMD64DivOpcode.LREM, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
-                    break;
-
-                case Shl:
-                    emitXirViaLir(tasm, masm, AMD64ShiftOpcode.ISHL, AMD64ShiftOpcode.LSHL, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
-                    break;
-
-                case Sar:
-                    emitXirViaLir(tasm, masm, AMD64ShiftOpcode.ISHR, AMD64ShiftOpcode.LSHR, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
-                    break;
-
-                case Shr:
-                    emitXirViaLir(tasm, masm, AMD64ShiftOpcode.IUSHR, AMD64ShiftOpcode.LUSHR, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
-                    break;
-
-                case And:
-                    emitXirViaLir(tasm, masm, AMD64ArithmeticOpcode.IAND, AMD64ArithmeticOpcode.LAND, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
-                    break;
-
-                case Or:
-                    emitXirViaLir(tasm, masm, AMD64ArithmeticOpcode.IOR, AMD64ArithmeticOpcode.LOR, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
-                    break;
-
-                case Xor:
-                    emitXirViaLir(tasm, masm, AMD64ArithmeticOpcode.IXOR, AMD64ArithmeticOpcode.LXOR, null, null, operands[inst.x().index], operands[inst.y().index], operands[inst.result.index]);
-                    break;
-
-                case Mov: {
-                    CiValue result = operands[inst.result.index];
-                    CiValue source = operands[inst.x().index];
-                    AMD64MoveOpcode.move(tasm, masm, result, source);
-                    break;
-                }
-
-                case PointerLoad: {
-                    CiValue result = operands[inst.result.index];
-                    CiValue pointer = operands[inst.x().index];
-                    CiRegisterValue register = assureInRegister(tasm, masm, pointer);
-
-                    AMD64MoveOpcode.load(tasm, masm, result, new CiAddress(inst.kind, register), (Boolean) inst.extra ? info : null);
-                    break;
-                }
-
-                case PointerStore: {
-                    CiValue value = assureNot64BitConstant(tasm, masm, operands[inst.y().index]);
-                    CiValue pointer = operands[inst.x().index];
-                    assert isRegister(pointer);
-
-                    AMD64MoveOpcode.store(tasm, masm, new CiAddress(inst.kind, pointer), value, (Boolean) inst.extra ? info : null);
-                    break;
-                }
-
-                case PointerLoadDisp: {
-                    CiXirAssembler.AddressAccessInformation addressInformation = (CiXirAssembler.AddressAccessInformation) inst.extra;
-                    boolean canTrap = addressInformation.canTrap;
-
-                    CiAddress.Scale scale = addressInformation.scale;
-                    int displacement = addressInformation.disp;
-
-                    CiValue result = operands[inst.result.index];
-                    CiValue pointer = operands[inst.x().index];
-                    CiValue index = operands[inst.y().index];
-
-                    pointer = assureInRegister(tasm, masm, pointer);
-                    assert isRegister(pointer);
-
-                    CiAddress src;
-                    if (isConstant(index)) {
-                        assert index.kind == CiKind.Int;
-                        CiConstant constantIndex = (CiConstant) index;
-                        src = new CiAddress(inst.kind, pointer, constantIndex.asInt() * scale.value + displacement);
-                    } else {
-                        src = new CiAddress(inst.kind, pointer, index, scale, displacement);
-                    }
-
-                    AMD64MoveOpcode.load(tasm, masm, result, src, canTrap ? info : null);
-                    break;
-                }
-
-                case LoadEffectiveAddress: {
-                    CiXirAssembler.AddressAccessInformation addressInformation = (CiXirAssembler.AddressAccessInformation) inst.extra;
-
-                    CiAddress.Scale scale = addressInformation.scale;
-                    int displacement = addressInformation.disp;
-
-                    CiValue result = operands[inst.result.index];
-                    CiValue pointer = operands[inst.x().index];
-                    CiValue index = operands[inst.y().index];
-
-                    pointer = assureInRegister(tasm, masm, pointer);
-                    assert isRegister(pointer);
-                    CiAddress src = new CiAddress(CiKind.Illegal, pointer, index, scale, displacement);
-                    masm.leaq(asRegister(result), src);
-                    break;
-                }
-
-                case PointerStoreDisp: {
-                    CiXirAssembler.AddressAccessInformation addressInformation = (CiXirAssembler.AddressAccessInformation) inst.extra;
-                    boolean canTrap = addressInformation.canTrap;
-
-                    CiAddress.Scale scale = addressInformation.scale;
-                    int displacement = addressInformation.disp;
-
-                    CiValue value = assureNot64BitConstant(tasm, masm, operands[inst.z().index]);
-                    CiValue pointer = operands[inst.x().index];
-                    CiValue index = operands[inst.y().index];
-
-                    pointer = assureInRegister(tasm, masm, pointer);
-                    assert isRegister(pointer);
-
-                    CiAddress dst;
-                    if (isConstant(index)) {
-                        assert index.kind == CiKind.Int;
-                        CiConstant constantIndex = (CiConstant) index;
-                        dst = new CiAddress(inst.kind, pointer, IllegalValue, scale, constantIndex.asInt() * scale.value + displacement);
-                    } else {
-                        dst = new CiAddress(inst.kind, pointer, index, scale, displacement);
-                    }
-
-                    AMD64MoveOpcode.store(tasm, masm, dst, value, canTrap ? info : null);
-                    break;
-                }
-
-                case RepeatMoveBytes:
-                    assert asRegister(operands[inst.x().index]).equals(AMD64.rsi) : "wrong input x: " + operands[inst.x().index];
-                    assert asRegister(operands[inst.y().index]).equals(AMD64.rdi) : "wrong input y: " + operands[inst.y().index];
-                    assert asRegister(operands[inst.z().index]).equals(AMD64.rcx) : "wrong input z: " + operands[inst.z().index];
-                    masm.repeatMoveBytes();
-                    break;
-
-                case RepeatMoveWords:
-                    assert asRegister(operands[inst.x().index]).equals(AMD64.rsi) : "wrong input x: " + operands[inst.x().index];
-                    assert asRegister(operands[inst.y().index]).equals(AMD64.rdi) : "wrong input y: " + operands[inst.y().index];
-                    assert asRegister(operands[inst.z().index]).equals(AMD64.rcx) : "wrong input z: " + operands[inst.z().index];
-                    masm.repeatMoveWords();
-                    break;
-
-                case PointerCAS:
-                    assert asRegister(operands[inst.x().index]).equals(AMD64.rax) : "wrong input x: " + operands[inst.x().index];
-
-                    CiValue exchangedVal = operands[inst.y().index];
-                    CiValue exchangedAddress = operands[inst.x().index];
-                    CiRegisterValue pointerRegister = assureInRegister(tasm, masm, exchangedAddress);
-                    CiAddress addr = new CiAddress(tasm.target.wordKind, pointerRegister);
-
-                    if ((Boolean) inst.extra && info != null) {
-                        tasm.recordImplicitException(masm.codeBuffer.position(), info);
-                    }
-                    masm.cmpxchgq(asRegister(exchangedVal), addr);
-
-                    break;
-
-                case CallRuntime: {
-                    CiKind[] signature = new CiKind[inst.arguments.length];
-                    for (int i = 0; i < signature.length; i++) {
-                        signature[i] = inst.arguments[i].kind;
-                    }
-
-                    CiCallingConvention cc = tasm.frameMap.registerConfig.getCallingConvention(RuntimeCall, signature, tasm.target, false);
-                    for (int i = 0; i < inst.arguments.length; i++) {
-                        CiValue argumentLocation = cc.locations[i];
-                        CiValue argumentSourceLocation = operands[inst.arguments[i].index];
-                        if (argumentLocation != argumentSourceLocation) {
-                            AMD64MoveOpcode.move(tasm, masm, argumentLocation, argumentSourceLocation);
-                        }
-                    }
-
-                    RuntimeCallInformation runtimeCallInformation = (RuntimeCallInformation) inst.extra;
-                    AMD64CallOpcode.directCall(tasm, masm, runtimeCallInformation.target, (runtimeCallInformation.useInfoAfter) ? infoAfter : info);
-
-                    if (inst.result != null && inst.result.kind != CiKind.Illegal && inst.result.kind != CiKind.Void) {
-                        CiRegister returnRegister = tasm.frameMap.registerConfig.getReturnRegister(inst.result.kind);
-                        CiValue resultLocation = returnRegister.asValue(inst.result.kind.stackKind());
-                        AMD64MoveOpcode.move(tasm, masm, operands[inst.result.index], resultLocation);
-                    }
-                    break;
-                }
-                case Jmp: {
-                    if (inst.extra instanceof XirLabel) {
-                        Label label = labels[((XirLabel) inst.extra).index];
-                        masm.jmp(label);
-                    } else {
-                        AMD64CallOpcode.directJmp(tasm, masm, inst.extra);
-                    }
-                    break;
-                }
-                case DecAndJumpNotZero: {
-                    Label label = labels[((XirLabel) inst.extra).index];
-                    CiValue value = operands[inst.x().index];
-                    if (value.kind == CiKind.Long) {
-                        masm.decq(asRegister(value));
-                    } else {
-                        assert value.kind == CiKind.Int;
-                        masm.decl(asRegister(value));
-                    }
-                    masm.jcc(ConditionFlag.notZero, label);
-                    break;
-                }
-                case Jeq: {
-                    Label label = labels[((XirLabel) inst.extra).index];
-                    emitXirCompare(tasm, masm, inst, ConditionFlag.equal, operands, label);
-                    break;
-                }
-                case Jneq: {
-                    Label label = labels[((XirLabel) inst.extra).index];
-                    emitXirCompare(tasm, masm, inst, ConditionFlag.notEqual, operands, label);
-                    break;
-                }
-
-                case Jgt: {
-                    Label label = labels[((XirLabel) inst.extra).index];
-                    emitXirCompare(tasm, masm, inst, ConditionFlag.greater, operands, label);
-                    break;
-                }
-
-                case Jgteq: {
-                    Label label = labels[((XirLabel) inst.extra).index];
-                    emitXirCompare(tasm, masm, inst, ConditionFlag.greaterEqual, operands, label);
-                    break;
-                }
-
-                case Jugteq: {
-                    Label label = labels[((XirLabel) inst.extra).index];
-                    emitXirCompare(tasm, masm, inst, ConditionFlag.aboveEqual, operands, label);
-                    break;
-                }
-
-                case Jlt: {
-                    Label label = labels[((XirLabel) inst.extra).index];
-                    emitXirCompare(tasm, masm, inst, ConditionFlag.less, operands, label);
-                    break;
-                }
-
-                case Jlteq: {
-                    Label label = labels[((XirLabel) inst.extra).index];
-                    emitXirCompare(tasm, masm, inst, ConditionFlag.lessEqual, operands, label);
-                    break;
-                }
-
-                case Jbset: {
-                    Label label = labels[((XirLabel) inst.extra).index];
-                    CiValue pointer = operands[inst.x().index];
-                    CiValue offset = operands[inst.y().index];
-                    CiValue bit = operands[inst.z().index];
-                    assert isConstant(offset) && isConstant(bit);
-                    CiConstant constantOffset = (CiConstant) offset;
-                    CiConstant constantBit = (CiConstant) bit;
-                    CiAddress src = new CiAddress(inst.kind, pointer, constantOffset.asInt());
-                    masm.btli(src, constantBit.asInt());
-                    masm.jcc(ConditionFlag.aboveEqual, label);
-                    break;
-                }
-
-                case Bind: {
-                    XirLabel l = (XirLabel) inst.extra;
-                    Label label = labels[l.index];
-                    masm.bind(label);
-                    break;
-                }
-                case Safepoint: {
-                    assert info != null : "Must have debug info in order to create a safepoint.";
-                    tasm.recordSafepoint(masm.codeBuffer.position(), info);
-                    break;
-                }
-                case NullCheck: {
-                    tasm.recordImplicitException(masm.codeBuffer.position(), info);
-                    CiValue pointer = operands[inst.x().index];
-                    masm.nullCheck(asRegister(pointer));
-                    break;
-                }
-                case Align: {
-                    masm.align((Integer) inst.extra);
-                    break;
-                }
-                case StackOverflowCheck: {
-                    int frameSize = tasm.frameMap.frameSize();
-                    int lastFramePage = frameSize / tasm.target.pageSize;
-                    // emit multiple stack bangs for methods with frames larger than a page
-                    for (int i = 0; i <= lastFramePage; i++) {
-                        int offset = (i + GraalOptions.StackShadowPages) * tasm.target.pageSize;
-                        // Deduct 'frameSize' to handle frames larger than the shadow
-                        bangStackWithOffset(tasm, masm, offset - frameSize);
-                    }
-                    break;
-                }
-                case PushFrame: {
-                    int frameSize = tasm.frameMap.frameSize();
-                    masm.decrementq(AMD64.rsp, frameSize); // does not emit code for frameSize == 0
-                    if (GraalOptions.ZapStackOnMethodEntry) {
-                        final int intSize = 4;
-                        for (int i = 0; i < frameSize / intSize; ++i) {
-                            masm.movl(new CiAddress(CiKind.Int, AMD64.rsp.asValue(), i * intSize), 0xC1C1C1C1);
-                        }
-                    }
-                    CiCalleeSaveLayout csl = tasm.frameMap.registerConfig.getCalleeSaveLayout();
-                    if (csl != null && csl.size != 0) {
-                        int frameToCSA = tasm.frameMap.offsetToCalleeSaveArea();
-                        assert frameToCSA >= 0;
-                        masm.save(csl, frameToCSA);
-                    }
-                    break;
-                }
-                case PopFrame: {
-                    int frameSize = tasm.frameMap.frameSize();
-
-                    CiCalleeSaveLayout csl = tasm.frameMap.registerConfig.getCalleeSaveLayout();
-                    if (csl != null && csl.size != 0) {
-                        tasm.targetMethod.setRegisterRestoreEpilogueOffset(masm.codeBuffer.position());
-                        // saved all registers, restore all registers
-                        int frameToCSA = tasm.frameMap.offsetToCalleeSaveArea();
-                        masm.restore(csl, frameToCSA);
-                    }
-
-                    masm.incrementq(AMD64.rsp, frameSize);
-                    break;
-                }
-                case Push: {
-                    CiRegisterValue value = assureInRegister(tasm, masm, operands[inst.x().index]);
-                    masm.push(asRegister(value));
-                    break;
-                }
-                case Pop: {
-                    CiValue result = operands[inst.result.index];
-                    if (isRegister(result)) {
-                        masm.pop(asRegister(result));
-                    } else {
-                        CiRegister rscratch = tasm.frameMap.registerConfig.getScratchRegister();
-                        masm.pop(rscratch);
-                        AMD64MoveOpcode.move(tasm, masm, result, rscratch.asValue());
-                    }
-                    break;
-                }
-                case Mark: {
-                    XirMark xmark = (XirMark) inst.extra;
-                    Mark[] references = new Mark[xmark.references.length];
-                    for (int i = 0; i < references.length; i++) {
-                        references[i] = marks.get(xmark.references[i]);
-                        assert references[i] != null;
-                    }
-                    Mark mark = tasm.recordMark(xmark.id, references);
-                    marks.put(xmark, mark);
-                    break;
-                }
-                case Nop: {
-                    for (int i = 0; i < (Integer) inst.extra; i++) {
-                        masm.nop();
-                    }
-                    break;
-                }
-                case RawBytes: {
-                    for (byte b : (byte[]) inst.extra) {
-                        masm.codeBuffer.emitByte(b & 0xff);
-                    }
-                    break;
-                }
-                case ShouldNotReachHere: {
-                    AMD64CallOpcode.shouldNotReachHere(tasm, masm);
-                    break;
-                }
-                default:
-                    throw Util.shouldNotReachHere("Unknown XIR operation " + inst.op);
-            }
-        }
-    }
-
-    private static void emitXirViaLir(TargetMethodAssembler tasm, AMD64MacroAssembler masm, LIROpcode intOp, LIROpcode longOp, LIROpcode floatOp, LIROpcode doubleOp, CiValue left, CiValue right, CiValue result) {
-        LIROpcode code;
-        switch (result.kind) {
-            case Int: code = intOp; break;
-            case Long: code = longOp; break;
-            case Float: code = floatOp; break;
-            case Double: code = doubleOp; break;
-            default: throw Util.shouldNotReachHere();
-        }
-
-        if (code instanceof AMD64ArithmeticOpcode) {
-            ((AMD64ArithmeticOpcode) code).emit(tasm, masm, result, left, right);
-        } else if (code instanceof AMD64MulOpcode) {
-            ((AMD64MulOpcode) code).emit(tasm, masm, result, left, right);
-        } else if (code instanceof AMD64DivOpcode) {
-            ((AMD64DivOpcode) code).emit(tasm, masm, result, null, left, right);
-        } else if (code instanceof AMD64ShiftOpcode) {
-            ((AMD64ShiftOpcode) code).emit(tasm, masm, result, left, right);
-        }
-    }
-
-    private static void emitXirCompare(TargetMethodAssembler tasm, AMD64MacroAssembler masm, XirInstruction inst, ConditionFlag cflag, CiValue[] ops, Label label) {
-        CiValue x = ops[inst.x().index];
-        CiValue y = ops[inst.y().index];
-        AMD64CompareOpcode code;
-        switch (x.kind) {
-            case Int: code = AMD64CompareOpcode.ICMP; break;
-            case Long: code = AMD64CompareOpcode.LCMP; break;
-            case Object: code = AMD64CompareOpcode.ACMP; break;
-            case Float: code = AMD64CompareOpcode.FCMP; break;
-            case Double: code = AMD64CompareOpcode.DCMP; break;
-            default: throw Util.shouldNotReachHere();
-        }
-        code.emit(tasm, masm, x, y);
-        masm.jcc(cflag, label);
-    }
-
-    /**
-     * @param offset the offset RSP at which to bang. Note that this offset is relative to RSP after RSP has been
-     *            adjusted to allocated the frame for the method. It denotes an offset "down" the stack.
-     *            For very large frames, this means that the offset may actually be negative (i.e. denoting
-     *            a slot "up" the stack above RSP).
-     */
-    private static void bangStackWithOffset(TargetMethodAssembler tasm, AMD64MacroAssembler masm, int offset) {
-        masm.movq(new CiAddress(tasm.target.wordKind, AMD64.RSP, -offset), AMD64.rax);
-    }
-
-    private static CiValue assureNot64BitConstant(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue value) {
-        if (isConstant(value) && (value.kind == CiKind.Long || value.kind == CiKind.Object)) {
-            CiRegisterValue register = tasm.frameMap.registerConfig.getScratchRegister().asValue(value.kind);
-            AMD64MoveOpcode.move(tasm, masm, register, value);
-            return register;
-        }
-        return value;
-    }
-
-    private static CiRegisterValue assureInRegister(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue pointer) {
-        if (isConstant(pointer)) {
-            CiRegisterValue register = tasm.frameMap.registerConfig.getScratchRegister().asValue(pointer.kind);
-            AMD64MoveOpcode.move(tasm, masm, register, pointer);
-            return register;
-        }
-
-        assert isRegister(pointer) : "should be register, but is: " + pointer;
-        return (CiRegisterValue) pointer;
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,12 +24,13 @@
 
 import java.lang.reflect.*;
 import java.util.*;
+import java.util.concurrent.*;
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
-import com.oracle.max.criutils.*;
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.cri.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.DeoptimizeNode.DeoptAction;
@@ -53,11 +54,15 @@
     }
 
     private static String methodName(RiResolvedMethod method, Invoke invoke) {
-        if (invoke != null && invoke.stateAfter() != null) {
-            RiMethod parent = invoke.stateAfter().method();
-            return parent.name() + "@" + invoke.bci() + ": " + CiUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)";
+        if (Debug.isLogEnabled()) {
+            if (invoke != null && invoke.stateAfter() != null) {
+                RiMethod parent = invoke.stateAfter().method();
+                return parent.name() + "@" + invoke.bci() + ": " + CiUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)";
+            } else {
+                return CiUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)";
+            }
         } else {
-            return CiUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)";
+            return null;
         }
     }
 
@@ -122,9 +127,13 @@
         }
 
         @Override
-        public void inline(StructuredGraph graph, GraalRuntime runtime, InliningCallback callback) {
-            StructuredGraph calleeGraph = getGraph(invoke, concrete, callback);
-            InliningUtil.inline(invoke, calleeGraph, true);
+        public void inline(StructuredGraph compilerGraph, GraalRuntime runtime, final InliningCallback callback) {
+            StructuredGraph graph = Debug.scope("Inlining", concrete, new Callable<StructuredGraph>() {
+                @Override
+                public StructuredGraph call() throws Exception {
+                    return callback.buildGraph(concrete);
+            });
+            InliningUtil.inline(invoke, graph, true);
         }
 
         @Override
@@ -164,9 +173,7 @@
             graph.addBeforeFixed(invoke.node(), objectClass);
             graph.addBeforeFixed(invoke.node(), guard);
 
-            if (GraalOptions.TraceInlining) {
-                TTY.println("inlining 1 method using 1 type check");
-            }
+            Debug.log("inlining 1 method using 1 type check);
 
             StructuredGraph calleeGraph = getGraph(invoke, concrete, callback);
             InliningUtil.inline(invoke, calleeGraph, false);
@@ -416,10 +423,10 @@
 
         @Override
         public void inline(StructuredGraph graph, GraalRuntime runtime, InliningCallback callback) {
-            if (GraalOptions.TraceInlining) {
+            if (Debug.isLogEnabled()) {
                 String targetName = CiUtil.format("%H.%n(%p):%r", invoke.callTarget().targetMethod());
                 String concreteName = CiUtil.format("%H.%n(%p):%r", concrete);
-                TTY.println("recording concrete method assumption: %s on receiver type %s -> %s", targetName, context, concreteName);
+                Debug.log("recording concrete method assumption: %s on receiver type %s -> %s", targetName, context, concreteName);
             }
             callback.recordConcreteMethodAssumption(invoke.callTarget().targetMethod(), context, concrete);
 
@@ -515,9 +522,7 @@
                         }
                         return null;
                     } else {
-                        if (GraalOptions.TraceInlining) {
-                            TTY.println("not inlining %s because GraalOptions.InlinePolymorphicCalls == false", methodName(callTarget.targetMethod(), invoke));
-                        }
+                        Debug.log("not inlining %s because GraalOptions.InlinePolymorphicCalls == false", methodName(callTarget.targetMethod(), invoke));
                         return null;
                     }
                 } else {
@@ -555,14 +560,12 @@
                             return new MultiTypeGuardInlineInfo(invoke, totalWeight, level, concreteMethods, types, typesToConcretes, probabilities);
                         } else {
                             if (GraalOptions.TraceInlining) {
-                                TTY.println("not inlining %s because it is a polymorphic method call and at least one invoked method cannot be inlined", methodName(callTarget.targetMethod(), invoke));
+                                Debug.log("not inlining %s because it is a polymorphic method call and at least one invoked method cannot be inlined", methodName(callTarget.targetMethod(), invoke));
                             }
                             return null;
                         }
                     } else {
-                        if (GraalOptions.TraceInlining) {
-                            TTY.println("not inlining %s because GraalOptions.InlineMonomorphicCalls == false", methodName(callTarget.targetMethod(), invoke));
-                        }
+                        Debug.log("not inlining %s because GraalOptions.InlineMonomorphicCalls == false", methodName(callTarget.targetMethod(), invoke));
                         return null;
                     }
                 }
@@ -593,15 +596,11 @@
 
     private static boolean checkInvokeConditions(Invoke invoke) {
         if (invoke.stateAfter() == null) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because the invoke has no after state", methodName(invoke.callTarget().targetMethod(), invoke));
-            }
+            Debug.log("not inlining %s because the invoke has no after state", methodName(invoke.callTarget().targetMethod(), invoke));
             return false;
         }
         if (invoke.predecessor() == null) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because the invoke is dead code", methodName(invoke.callTarget().targetMethod(), invoke));
-            }
+            Debug.log("not inlining %s because the invoke is dead code", methodName(invoke.callTarget().targetMethod(), invoke));
             return false;
         }
         return true;
@@ -609,34 +608,24 @@
 
     private static boolean checkTargetConditions(RiMethod method) {
         if (!(method instanceof RiResolvedMethod)) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because it is unresolved", method.toString());
-            }
+            Debug.log("not inlining %s because it is unresolved", method.toString());
             return false;
         }
         RiResolvedMethod resolvedMethod = (RiResolvedMethod) method;
         if (Modifier.isNative(resolvedMethod.accessFlags())) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because it is a native method", methodName(resolvedMethod));
-            }
+            Debug.log("not inlining %s because it is a native method", methodName(resolvedMethod));
             return false;
         }
         if (Modifier.isAbstract(resolvedMethod.accessFlags())) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because it is an abstract method", methodName(resolvedMethod));
-            }
+            Debug.log("not inlining %s because it is an abstract method", methodName(resolvedMethod));
             return false;
         }
         if (!resolvedMethod.holder().isInitialized()) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because of non-initialized class", methodName(resolvedMethod));
-            }
+            Debug.log("not inlining %s because of non-initialized class", methodName(resolvedMethod));
             return false;
         }
         if (!resolvedMethod.canBeInlined()) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because it is marked non-inlinable", methodName(resolvedMethod));
-            }
+            Debug.log("not inlining %s because it is marked non-inlinable", methodName(resolvedMethod));
             return false;
         }
         return true;
@@ -692,7 +681,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);
@@ -707,7 +696,18 @@
         } else {
             if (unwindNode != null) {
                 UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode);
-                unwindDuplicate.replaceAndDelete(graph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile)));
+                DeoptimizeNode deoptimizeNode = new DeoptimizeNode(DeoptAction.InvalidateRecompile);
+                unwindDuplicate.replaceAndDelete(graph.add(deoptimizeNode));
+                // move the deopt upwards if there is a monitor exit that tries to use the "after exception" frame state
+                // (because there is no "after exception" frame state!)
+                if (deoptimizeNode.predecessor() instanceof MonitorExitNode) {
+                    MonitorExitNode monitorExit = (MonitorExitNode) deoptimizeNode.predecessor();
+                    if (monitorExit.stateAfter() != null && monitorExit.stateAfter().bci == FrameState.AFTER_EXCEPTION_BCI) {
+                        FrameState monitorFrameState = monitorExit.stateAfter();
+                        graph.removeFixed(monitorExit);
+                        monitorFrameState.safeDelete();
+                    }
+                }
             }
         }
 
@@ -731,8 +731,12 @@
                 } else if (frameState.bci == FrameState.AFTER_BCI) {
                     frameState.replaceAndDelete(stateAfter);
                 } else if (frameState.bci == FrameState.AFTER_EXCEPTION_BCI) {
-                    assert stateAtExceptionEdge != null;
-                    frameState.replaceAndDelete(stateAtExceptionEdge);
+                    if (frameState.isAlive()) {
+                        assert stateAtExceptionEdge != null;
+                        frameState.replaceAndDelete(stateAtExceptionEdge);
+                    } else {
+                        assert stateAtExceptionEdge == null;
+                    }
                 } else {
                     if (outerFrameState == null) {
                         outerFrameState = stateAfter.duplicateModified(invoke.bci(), stateAfter.rethrowException(), invoke.node().kind());
@@ -754,7 +758,15 @@
             returnDuplicate.clearInputs();
             Node n = invoke.next();
             invoke.setNext(null);
-            returnDuplicate.replaceAndDelete(n);
+            if (n instanceof BeginNode) {
+                BeginNode begin = (BeginNode) n;
+                FixedNode next = begin.next();
+                begin.setNext(null);
+                returnDuplicate.replaceAndDelete(next);
+                begin.safeDelete();
+            } else {
+                returnDuplicate.replaceAndDelete(n);
+            }
         }
 
         invoke.node().clearInputs();
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/LoopUtil.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,304 +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.compiler.schedule.*;
-import com.oracle.max.graal.graph.*;
-import com.oracle.max.graal.graph.Node.Verbosity;
-import com.oracle.max.graal.nodes.*;
-import com.oracle.max.graal.nodes.PhiNode.PhiType;
-
-public class LoopUtil {
-
-    public static class Loop {
-        private final LoopBeginNode loopBegin;
-        private NodeBitMap cfgNodes;
-        private Loop parent;
-        private NodeBitMap exits;
-        private NodeBitMap inOrBefore;
-        private NodeBitMap inOrAfter;
-        private NodeBitMap nodes;
-        public Loop(LoopBeginNode loopBegin, NodeBitMap nodes, NodeBitMap exits) {
-            this.loopBegin = loopBegin;
-            this.cfgNodes = nodes;
-            this.exits = exits;
-        }
-
-        public LoopBeginNode loopBegin() {
-            return loopBegin;
-        }
-
-        public NodeBitMap cfgNodes() {
-            return cfgNodes;
-        }
-
-        public NodeBitMap nodes() {
-            if (nodes == null) {
-                nodes = loopBegin().graph().createNodeBitMap();
-                nodes.setUnion(inOrAfter());
-                nodes.setIntersect(inOrBefore());
-            }
-            return nodes;
-        }
-
-        public Loop parent() {
-            return parent;
-        }
-
-        public NodeBitMap exits() {
-            return exits;
-        }
-
-        public void setParent(Loop parent) {
-            this.parent = parent;
-        }
-
-        public boolean isChild(Loop loop) {
-            return loop.parent != null && (loop.parent == this || loop.parent.isChild(this));
-        }
-
-        public NodeBitMap inOrAfter() {
-            if (inOrAfter == null) {
-                inOrAfter = LoopUtil.inOrAfter(this);
-            }
-            return inOrAfter;
-        }
-
-        public NodeBitMap inOrBefore() {
-            if (inOrBefore == null) {
-                inOrBefore = LoopUtil.inOrBefore(this, inOrAfter());
-            }
-            return inOrBefore;
-        }
-
-        public void invalidateCached() {
-            inOrAfter = null;
-            inOrBefore = null;
-            nodes = null;
-        }
-
-        @Override
-        public String toString() {
-            return "Loop #" + loopBegin().toString(Verbosity.Id);
-        }
-    }
-
-    public static List<Loop> computeLoops(StructuredGraph graph) {
-        List<Loop> loops = new LinkedList<>();
-        for (LoopBeginNode loopBegin : graph.getNodes(LoopBeginNode.class)) {
-            NodeBitMap cfgNodes = markUpCFG(loopBegin, loopBegin.loopEnd()); // computeLoopNodes(loopBegin);
-            cfgNodes.mark(loopBegin);
-            NodeBitMap exits = computeLoopExits(loopBegin, cfgNodes);
-            loops.add(new Loop(loopBegin, cfgNodes, exits));
-        }
-        for (Loop loop : loops) {
-            for (Loop other : loops) {
-                if (other != loop && other.cfgNodes().isMarked(loop.loopBegin())) {
-                    if (loop.parent() == null || loop.parent().cfgNodes().isMarked(other.loopBegin())) {
-                        loop.setParent(other);
-                    }
-                }
-            }
-        }
-        return loops;
-    }
-
-    public static NodeBitMap computeLoopExits(LoopBeginNode loopBegin, NodeBitMap cfgNodes) {
-        Graph graph = loopBegin.graph();
-        NodeBitMap exits = graph.createNodeBitMap();
-        for (Node n : cfgNodes) {
-            if (IdentifyBlocksPhase.trueSuccessorCount(n) > 1) {
-                for (Node sux : n.cfgSuccessors()) {
-                    if (sux != null && !cfgNodes.isMarked(sux) && sux instanceof FixedNode) {
-                        exits.mark(sux);
-                    }
-                }
-            }
-        }
-        return exits;
-    }
-
-    public static NodeBitMap markUpCFG(LoopBeginNode loopBegin) {
-        return markUpCFG(loopBegin, loopBegin.loopEnd());
-    }
-
-    public static NodeBitMap markUpCFG(LoopBeginNode loopBegin, FixedNode from) {
-        NodeFlood workCFG = loopBegin.graph().createNodeFlood();
-        workCFG.add(from);
-        NodeBitMap loopNodes = loopBegin.graph().createNodeBitMap();
-        for (Node n : workCFG) {
-            if (n == loopBegin) {
-                continue;
-            }
-            loopNodes.mark(n);
-            if (n instanceof LoopBeginNode) {
-                workCFG.add(((LoopBeginNode) n).loopEnd());
-            }
-            for (Node pred : n.cfgPredecessors()) {
-                workCFG.add(pred);
-            }
-        }
-        return loopNodes;
-    }
-
-    private static NodeBitMap inOrAfter(Loop loop) {
-        return inOrAfter(loop, loop.cfgNodes());
-    }
-
-    private static NodeBitMap inOrAfter(Loop loop, NodeBitMap cfgNodes) {
-        return inOrAfter(loop, cfgNodes, true);
-    }
-
-    private static NodeBitMap inOrAfter(Loop loop, NodeBitMap cfgNodes, boolean full) {
-        Graph graph = loop.loopBegin().graph();
-        NodeBitMap inOrAfter = graph.createNodeBitMap();
-        NodeFlood work = graph.createNodeFlood();
-        work.addAll(cfgNodes);
-        for (Node n : work) {
-            markWithState(n, inOrAfter);
-            if (full) {
-                for (Node sux : n.successors()) {
-                    if (sux != null) {
-                        work.add(sux);
-                    }
-                }
-            }
-            for (Node usage : n.usages()) {
-                if (usage instanceof PhiNode) { // filter out data graph cycles
-                    PhiNode phi = (PhiNode) usage;
-                    MergeNode merge = phi.merge();
-                    if (merge instanceof LoopBeginNode) {
-                        LoopBeginNode phiLoop = (LoopBeginNode) merge;
-                        if (phi.valueAt(phiLoop.loopEnd()) == n) {
-                            continue;
-                        }
-                    }
-                }
-                work.add(usage);
-            }
-        }
-        return inOrAfter;
-    }
-
-    private static NodeBitMap inOrBefore(Loop loop, NodeBitMap inOrAfter) {
-        return inOrBefore(loop, inOrAfter, loop.cfgNodes());
-    }
-
-    private static NodeBitMap inOrBefore(Loop loop, NodeBitMap inOrAfter, NodeBitMap cfgNodes) {
-        return inOrBefore(loop, inOrAfter, cfgNodes, true);
-    }
-
-    private static NodeBitMap inOrBefore(Loop loop, NodeBitMap inOrAfter, NodeBitMap cfgNodes, boolean full) {
-        Graph graph = loop.loopBegin().graph();
-        NodeBitMap inOrBefore = graph.createNodeBitMap();
-        NodeFlood work = graph.createNodeFlood();
-        work.addAll(cfgNodes);
-        for (Node n : work) {
-            inOrBefore.mark(n);
-            if (full) {
-                if (n.predecessor() != null) {
-                    work.add(n.predecessor());
-                }
-            }
-            if (n instanceof PhiNode) { // filter out data graph cycles
-                PhiNode phi = (PhiNode) n;
-                if (phi.type() == PhiType.Value) {
-                    int backIndex = -1;
-                    MergeNode merge = phi.merge();
-                    if (merge instanceof LoopBeginNode && cfgNodes.isNotNewNotMarked(((LoopBeginNode) merge).loopEnd())) {
-                        LoopBeginNode phiLoop = (LoopBeginNode) merge;
-                        backIndex = phiLoop.phiPredecessorIndex(phiLoop.loopEnd());
-                    }
-                    for (int i = 0; i < phi.valueCount(); i++) {
-                        if (i != backIndex) {
-                            work.add(phi.valueAt(i));
-                        }
-                    }
-                }
-            } else {
-                for (Node in : n.inputs()) {
-                    if (in != null) {
-                        work.add(in);
-                    }
-                }
-                if (full) {
-                    for (Node sux : n.cfgSuccessors()) { // go down into branches that are not 'inOfAfter'
-                        if (sux != null && !inOrAfter.isMarked(sux)) {
-                            work.add(sux);
-                        }
-                    }
-                    if (n instanceof LoopBeginNode && n != loop.loopBegin()) {
-                        Loop p = loop.parent;
-                        boolean isParent = false;
-                        while (p != null) {
-                            if (p.loopBegin() == n) {
-                                isParent = true;
-                                break;
-                            }
-                            p = p.parent;
-                        }
-                        if (!isParent) {
-                            work.add(((LoopBeginNode) n).loopEnd());
-                        }
-                    }
-                }
-                if (cfgNodes.isNotNewMarked(n)) { //add all values from the exits framestates
-                    for (Node sux : n.cfgSuccessors()) {
-                        if (loop.exits().isNotNewMarked(sux) && sux instanceof StateSplit) {
-                            FrameState stateAfter = ((StateSplit) sux).stateAfter();
-                            while (stateAfter != null) {
-                                for (Node in : stateAfter.inputs()) {
-                                    if (!(in instanceof FrameState)) {
-                                        work.add(in);
-                                    }
-                                }
-                                stateAfter = stateAfter.outerFrameState();
-                            }
-                        }
-                    }
-                }
-                if (n instanceof MergeNode) { //add phis & counters
-                    for (Node usage : n.usages()) {
-                        if (!(usage instanceof LoopEndNode)) {
-                            work.add(usage);
-                        }
-                    }
-                }
-            }
-        }
-        return inOrBefore;
-    }
-
-    private static void markWithState(Node n, NodeBitMap map) {
-        map.mark(n);
-        if (n instanceof StateSplit) {
-            FrameState stateAfter = ((StateSplit) n).stateAfter();
-            while (stateAfter != null) {
-                map.mark(stateAfter);
-                stateAfter = stateAfter.outerFrameState();
-            }
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/NodeIterators.java	Thu Feb 02 15:40:30 2012 -0800
+++ /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;
-                        }
-                    }
-                };
-            }
-        };
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/Debug.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,198 @@
+/*
+ * 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.debug;
+
+import com.oracle.max.graal.debug.internal.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+
+public class Debug {
+    private static boolean ENABLED = false;
+
+    public static void enable() {
+        ENABLED = true;
+        DebugScope.initialize();
+    }
+
+    public static boolean isEnabled() {
+        return ENABLED;
+    }
+
+    public static boolean isDumpEnabled() {
+        return ENABLED && DebugScope.getInstance().isDumpEnabled();
+    }
+
+    public static boolean isMeterEnabled() {
+        return ENABLED && DebugScope.getInstance().isMeterEnabled();
+    }
+
+    public static boolean isTimeEnabled() {
+        return ENABLED && DebugScope.getInstance().isTimeEnabled();
+    }
+
+    public static boolean isLogEnabled() {
+        return ENABLED && DebugScope.getInstance().isLogEnabled();
+    }
+
+    public static void sandbox(String name, Runnable runnable) {
+        if (ENABLED) {
+            DebugScope.getInstance().scope(name, runnable, null, true, new Object[0]);
+        } else {
+            runnable.run();
+        }
+    }
+
+    public static void scope(String name, Runnable runnable) {
+        scope(name, null, runnable);
+    }
+
+    public static <T> T scope(String name, Callable<T> callable) {
+        return scope(name, null, callable);
+    }
+
+    public static void scope(String name, Object context, Runnable runnable) {
+        if (ENABLED) {
+            DebugScope.getInstance().scope(name, runnable, null, false, new Object[]{context});
+        } else {
+            runnable.run();
+        }
+    }
+
+    public static String currentScope() {
+        if (ENABLED) {
+            return DebugScope.getInstance().getQualifiedName();
+        } else {
+            return "";
+        }
+    }
+
+    public static <T> T scope(String name, Object context, Callable<T> callable) {
+        if (ENABLED) {
+            return DebugScope.getInstance().scope(name, null, callable, false, new Object[]{context});
+        } else {
+            return DebugScope.call(callable);
+        }
+    }
+
+    public static void log(String msg, Object... args) {
+        if (ENABLED && DebugScope.getInstance().isLogEnabled()) {
+            DebugScope.getInstance().log(msg, args);
+        }
+    }
+
+    public static void dump(Object object, String msg, Object... args) {
+        if (ENABLED && DebugScope.getInstance().isDumpEnabled()) {
+            DebugScope.getInstance().dump(object, msg, args);
+        }
+    }
+
+    public static Iterable<Object> context() {
+        if (ENABLED) {
+            return DebugScope.getInstance().getCurrentContext();
+        } else {
+            return Collections.emptyList();
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    public static <T> List<T> contextSnapshot(Class<T> clazz) {
+        if (ENABLED) {
+            List<T> result = new ArrayList<>();
+            for (Object o : context()) {
+                if (clazz.isInstance(o)) {
+                    result.add((T) o);
+                }
+            }
+            return result;
+        } else {
+            return Collections.emptyList();
+        }
+    }
+
+    public static DebugMetric metric(String name) {
+        if (ENABLED) {
+            return new MetricImpl(name);
+        } else {
+            return VOID_METRIC;
+        }
+    }
+
+    public static void setConfig(DebugConfig config) {
+        if (ENABLED) {
+            DebugScope.getInstance().setConfig(config);
+        }
+    }
+
+    public static DebugConfig fixedConfig(final boolean isLogEnabled, final boolean isDumpEnabled, final boolean isMeterEnabled, final boolean isTimerEnabled) {
+        return new DebugConfig() {
+
+            @Override
+            public boolean isLogEnabled() {
+                return isLogEnabled;
+            }
+
+            @Override
+            public boolean isMeterEnabled() {
+                return isMeterEnabled;
+            }
+
+            @Override
+            public boolean isDumpEnabled() {
+                return isDumpEnabled;
+            }
+
+            @Override
+            public boolean isTimeEnabled() {
+                return isTimerEnabled;
+            }
+
+            @Override
+            public RuntimeException interceptException(RuntimeException e) {
+                return e;
+            }
+
+            @Override
+            public Collection< ? extends DebugDumpHandler> dumpHandlers() {
+                return Collections.emptyList();
+            }
+        };
+    }
+
+    private static final DebugMetric VOID_METRIC = new DebugMetric() {
+        public void increment() { }
+        public void add(int value) { }
+    };
+
+    public static DebugTimer timer(String name) {
+        if (ENABLED) {
+            return new TimerImpl(name);
+        } else {
+            return VOID_TIMER;
+        }
+    }
+
+    private static final DebugTimer VOID_TIMER = new DebugTimer() {
+        public TimerCloseable start() { return TimerImpl.VOID_CLOSEABLE; }
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/DebugConfig.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,35 @@
+/*
+ * 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.debug;
+
+import java.util.*;
+
+
+public interface DebugConfig {
+    boolean isLogEnabled();
+    boolean isMeterEnabled();
+    boolean isDumpEnabled();
+    boolean isTimeEnabled();
+    RuntimeException interceptException(RuntimeException e);
+    Collection<? extends DebugDumpHandler> dumpHandlers();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/DebugDumpHandler.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.debug;
+
+public interface DebugDumpHandler {
+    void dump(Object object, String message);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/DebugMetric.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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.debug;
+
+public interface DebugMetric {
+    void increment();
+    void add(int value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/DebugTimer.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,29 @@
+/*
+ * 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.debug;
+
+import com.oracle.max.graal.debug.internal.*;
+
+public interface DebugTimer {
+    TimerCloseable start();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/internal/DebugScope.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,294 @@
+/*
+ * 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.debug.internal;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+import com.oracle.max.graal.debug.*;
+
+public final class DebugScope {
+
+    private static ThreadLocal<DebugScope> instanceTL = new ThreadLocal<>();
+    private static ThreadLocal<DebugConfig> configTL = new ThreadLocal<>();
+    private static ThreadLocal<RuntimeException> lastExceptionThrownTL = new ThreadLocal<>();
+    private static DebugTimer scopeTime = Debug.timer("ScopeTime");
+    private static DebugMetric scopeCount = Debug.metric("ScopeCount");
+
+    private final DebugScope parent;
+
+    private Object[] context;
+
+    private List<DebugScope> children;
+    private DebugValueMap valueMap;
+    private String qualifiedName;
+    private String name;
+
+    private static final char SCOPE_SEP = '.';
+
+    private boolean logEnabled;
+    private boolean meterEnabled;
+    private boolean timeEnabled;
+    private boolean dumpEnabled;
+
+    public static DebugScope getInstance() {
+        DebugScope result = instanceTL.get();
+        if (result == null) {
+            DebugScope topLevelDebugScope = new DebugScope(Thread.currentThread().getName(), "", null);
+            instanceTL.set(topLevelDebugScope);
+            DebugValueMap.registerTopLevel(topLevelDebugScope.getValueMap());
+            return topLevelDebugScope;
+        } else {
+            return result;
+        }
+    }
+
+    public static DebugConfig getConfig() {
+        return configTL.get();
+    }
+
+    private DebugScope(String name, String qualifiedName, DebugScope parent, Object... context) {
+        this.name = name;
+        this.parent = parent;
+        this.context = context;
+        this.qualifiedName = qualifiedName;
+    }
+
+    public boolean isDumpEnabled() {
+        return dumpEnabled;
+    }
+
+    public boolean isLogEnabled() {
+        return logEnabled;
+    }
+
+    public boolean isMeterEnabled() {
+        return meterEnabled;
+    }
+
+    public boolean isTimeEnabled() {
+        return timeEnabled;
+    }
+
+    public void log(String msg, Object... args) {
+        if (isLogEnabled()) {
+            cachedOut.println(String.format(msg, args));
+        }
+    }
+
+    public void dump(Object object, String formatString, Object[] args) {
+        if (isDumpEnabled()) {
+            DebugConfig config = getConfig();
+            if (config != null) {
+                String message = String.format(formatString, args);
+                for (DebugDumpHandler dumpHandler : config.dumpHandlers()) {
+                    dumpHandler.dump(object, message);
+                }
+            }
+        }
+    }
+
+    public <T> T scope(String newName, Runnable runnable, Callable<T> callable, boolean sandbox, Object[] newContext) {
+        DebugScope oldContext = getInstance();
+        DebugConfig oldConfig = getConfig();
+        DebugScope newChild = null;
+        if (sandbox) {
+            newChild = new DebugScope(newName, newName, null, newContext);
+            setConfig(null);
+        } else {
+            newChild = oldContext.createChild(newName, newContext);
+        }
+        instanceTL.set(newChild);
+        newChild.updateFlags();
+        scopeCount.increment();
+        try (TimerCloseable a = scopeTime.start()) {
+            return executeScope(runnable, callable);
+        } finally {
+            if (!sandbox && newChild.hasValueMap()) {
+                getValueMap().addChild(newChild.getValueMap());
+            }
+            newChild.deactivate();
+            instanceTL.set(oldContext);
+            setConfig(oldConfig);
+        }
+    }
+
+    private <T> T executeScope(Runnable runnable, Callable<T> callable) {
+        try {
+            instanceTL.get().log("Starting scope %s", instanceTL.get().getQualifiedName());
+            if (runnable != null) {
+                runnable.run();
+            }
+            if (callable != null) {
+                return call(callable);
+            }
+        } catch (RuntimeException e) {
+            if (e == lastExceptionThrownTL.get()) {
+                throw e;
+            } else {
+                RuntimeException newException = interceptException(e);
+                lastExceptionThrownTL.set(newException);
+                throw newException;
+            }
+        }
+        return null;
+    }
+
+    private void updateFlags() {
+        DebugConfig config = getConfig();
+        if (config == null) {
+            logEnabled = false;
+            meterEnabled = false;
+            timeEnabled = false;
+            dumpEnabled = false;
+        } else {
+            logEnabled = config.isLogEnabled();
+            meterEnabled = config.isMeterEnabled();
+            timeEnabled = config.isTimeEnabled();
+            dumpEnabled = config.isDumpEnabled();
+        }
+    }
+
+    private void deactivate() {
+        context = null;
+    }
+
+    private RuntimeException interceptException(final RuntimeException e) {
+        final DebugConfig config = getConfig();
+        if (config != null) {
+            return scope("InterceptException", null, new Callable<RuntimeException>() {
+
+                @Override
+                public RuntimeException call() throws Exception {
+                    try {
+                        return config.interceptException(e);
+                    } catch (Throwable t) {
+                        return e;
+                    }
+                }
+            }, false, new Object[] {e});
+        }
+        return e;
+    }
+
+    private DebugValueMap getValueMap() {
+        if (valueMap == null) {
+            valueMap = new DebugValueMap(name);
+        }
+        return valueMap;
+    }
+
+    private boolean hasValueMap() {
+        return valueMap != null;
+    }
+
+    long getCurrentValue(int index) {
+        return getValueMap().getCurrentValue(index);
+    }
+
+    void setCurrentValue(int index, long l) {
+        getValueMap().setCurrentValue(index, l);
+    }
+
+    private DebugScope createChild(String newName, Object[] newContext) {
+        String newQualifiedName = newName;
+        if (this.qualifiedName.length() > 0) {
+            newQualifiedName = this.qualifiedName + SCOPE_SEP + newName;
+        }
+        DebugScope result = new DebugScope(newName, newQualifiedName, this, newContext);
+        if (children == null) {
+            children = new ArrayList<>(4);
+        }
+        children.add(result);
+        return result;
+    }
+
+    public Iterable<Object> getCurrentContext() {
+        return new Iterable<Object>() {
+
+            @Override
+            public Iterator<Object> iterator() {
+                return new Iterator<Object>() {
+
+                    DebugScope currentScope = DebugScope.this;
+                    int objectIndex;
+
+                    @Override
+                    public boolean hasNext() {
+                        selectScope();
+                        return currentScope != null;
+                    }
+
+                    private void selectScope() {
+                        while (currentScope != null && currentScope.context.length <= objectIndex) {
+                            currentScope = currentScope.parent;
+                            objectIndex = 0;
+                        }
+                    }
+
+                    @Override
+                    public Object next() {
+                        selectScope();
+                        if (currentScope != null) {
+                            return currentScope.context[objectIndex++];
+                        }
+                        throw new IllegalStateException("May only be called if there is a next element.");
+                    }
+
+                    @Override
+                    public void remove() {
+                        throw new UnsupportedOperationException("This iterator is read only.");
+                    }
+                };
+            }
+        };
+    }
+
+    public static <T> T call(Callable<T> callable) {
+        try {
+            return callable.call();
+        } catch (Exception e) {
+            if (e instanceof RuntimeException) {
+                throw (RuntimeException) e;
+            } else {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    public void setConfig(DebugConfig newConfig) {
+        configTL.set(newConfig);
+        updateFlags();
+    }
+
+    public String getQualifiedName() {
+        return qualifiedName;
+    }
+
+    public static PrintStream cachedOut;
+
+    public static void initialize() {
+        cachedOut = System.out;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/internal/DebugValue.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,62 @@
+/*
+ * 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.debug.internal;
+
+public class DebugValue {
+
+    private String name;
+    private int index;
+
+    protected DebugValue(String name) {
+        this.name = name;
+        this.index = -1;
+    }
+
+    protected long getCurrentValue() {
+        ensureInitialized();
+        return DebugScope.getInstance().getCurrentValue(index);
+    }
+
+    protected void setCurrentValue(long l) {
+        ensureInitialized();
+        DebugScope.getInstance().setCurrentValue(index, l);
+    }
+
+    private void ensureInitialized() {
+        if (index == -1) {
+            index = KeyRegistry.register(name, this);
+        }
+    }
+
+    protected void addToCurrentValue(long timeSpan) {
+        setCurrentValue(getCurrentValue() + timeSpan);
+    }
+
+    public int getIndex() {
+        return index;
+    }
+
+    public String getName() {
+        return name;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/internal/DebugValueMap.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,149 @@
+/*
+ * 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.debug.internal;
+
+import java.util.*;
+
+public class DebugValueMap {
+
+    private static List<DebugValueMap> topLevelMaps = new ArrayList<>();
+
+    private long[] values;
+    private List<DebugValueMap> children;
+    private String name;
+
+    public DebugValueMap(String name) {
+        this.name = name;
+    }
+
+    public void setCurrentValue(int index, long l) {
+        ensureSize(index);
+        values[index] = l;
+    }
+
+    public long getCurrentValue(int index) {
+        ensureSize(index);
+        return values[index];
+    }
+
+    private void ensureSize(int index) {
+        if (values == null) {
+            values = new long[index + 1];
+        }
+        if (values.length <= index) {
+            values = Arrays.copyOf(values, index + 1);
+        }
+    }
+
+    private int capacity() {
+        return (values == null) ? 0 : values.length;
+    }
+
+    public void addChild(DebugValueMap map) {
+        if (children == null) {
+            children = new ArrayList<>(4);
+        }
+        children.add(map);
+    }
+
+    public List<DebugValueMap> getChildren() {
+        if (children == null) {
+            return Collections.emptyList();
+        } else {
+            return Collections.unmodifiableList(children);
+        }
+    }
+
+    public boolean hasChildren() {
+        return children != null && !children.isEmpty();
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    @Override
+    public String toString() {
+        return "DebugValueMap<" + getName() + ">";
+    }
+
+    public static synchronized void registerTopLevel(DebugValueMap map) {
+        topLevelMaps.add(map);
+    }
+
+    public static synchronized List<DebugValueMap> getTopLevelMaps() {
+        return topLevelMaps;
+    }
+
+    public void normalize() {
+        if (this.hasChildren()) {
+            Map<String, DebugValueMap> occurred = new HashMap<>();
+            for (DebugValueMap map : this.children) {
+                String mapName = map.getName();
+                if (!occurred.containsKey(mapName)) {
+                    occurred.put(mapName, map);
+                    map.normalize();
+                } else {
+                    occurred.get(mapName).mergeWith(map);
+                    occurred.get(mapName).normalize();
+                }
+            }
+
+            if (occurred.values().size() < children.size()) {
+                // At least one duplicate was found.
+                children.clear();
+                for (DebugValueMap map : occurred.values()) {
+                    children.add(map);
+                    map.normalize();
+                }
+            }
+        }
+    }
+
+    private void mergeWith(DebugValueMap map) {
+        if (map.hasChildren()) {
+            if (hasChildren()) {
+                children.addAll(map.children);
+            } else {
+                children = map.children;
+            }
+            map.children = null;
+        }
+
+        int size = Math.max(this.capacity(), map.capacity());
+        ensureSize(size);
+        for (int i = 0; i < size; ++i) {
+            long curValue = getCurrentValue(i);
+            long otherValue = map.getCurrentValue(i);
+            setCurrentValue(i, curValue + otherValue);
+        }
+    }
+
+    public void group() {
+        List<DebugValueMap> oldChildren = new ArrayList<>(this.children);
+        this.children.clear();
+        for (DebugValueMap map : oldChildren) {
+            mergeWith(map);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/internal/KeyRegistry.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,43 @@
+/*
+ * 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.debug.internal;
+
+import java.util.*;
+
+public class KeyRegistry {
+    private static int keyCount;
+    private static Map<String, Integer> keyMap = new HashMap<>();
+    private static List<DebugValue> debugValues = new ArrayList<>();
+
+    public static synchronized int register(String name, DebugValue value) {
+        if (!keyMap.containsKey(name)) {
+            keyMap.put(name, keyCount++);
+            debugValues.add(value);
+        }
+        return keyMap.get(name);
+    }
+
+    public static synchronized List<DebugValue> getDebugValues() {
+        return Collections.unmodifiableList(debugValues);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/internal/MetricImpl.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,42 @@
+/*
+ * 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.debug.internal;
+
+import com.oracle.max.graal.debug.*;
+
+public final class MetricImpl extends DebugValue implements DebugMetric {
+
+    public MetricImpl(String name) {
+        super(name);
+    }
+
+    public void increment() {
+        add(1);
+    }
+
+    public void add(int value) {
+        if (Debug.isMeterEnabled()) {
+            super.addToCurrentValue(value);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/internal/TimerCloseable.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.debug.internal;
+
+public interface TimerCloseable extends AutoCloseable {
+    void close();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/internal/TimerImpl.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,54 @@
+/*
+ * 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.debug.internal;
+
+import com.oracle.max.graal.debug.*;
+
+public final class TimerImpl extends DebugValue implements DebugTimer {
+
+    public static final TimerCloseable VOID_CLOSEABLE = new TimerCloseable() {
+        @Override
+        public void close() {
+        }
+    };
+
+    public TimerImpl(String name) {
+        super(name);
+    }
+
+    @Override
+    public TimerCloseable start() {
+        if (Debug.isTimeEnabled()) {
+            final long startTime = System.currentTimeMillis();
+            return new TimerCloseable() {
+                @Override
+                public void close() {
+                    long timeSpan = System.currentTimeMillis() - startTime;
+                    TimerImpl.this.addToCurrentValue(timeSpan);
+                }
+            };
+        } else {
+            return VOID_CLOSEABLE;
+        }
+    }
+}
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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/Node.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,6 +25,8 @@
 import java.lang.annotation.*;
 import java.util.*;
 
+import com.oracle.max.graal.graph.NodeClass.*;
+
 
 /**
  * This class is the base class for all nodes, it represent a node which can be inserted in a {@link Graph}.<br>
@@ -45,7 +47,7 @@
  *
  *
  */
-public abstract class Node implements Cloneable {
+public abstract class Node implements Cloneable, Formattable {
 
     static final int DELETED_ID_START = -1000000000;
     static final int INITIAL_ID = -1;
@@ -490,4 +492,66 @@
                 throw new RuntimeException("unknown verbosity: " + verbosity);
         }
     }
+
+    @Override
+    public void formatTo(Formatter formatter, int flags, int width, int precision) {
+        if ((flags & FormattableFlags.ALTERNATE) == FormattableFlags.ALTERNATE) {
+            formatter.format("%s", toString(Verbosity.Id));
+        } else if ((flags & FormattableFlags.UPPERCASE) == FormattableFlags.UPPERCASE) {
+            formatter.format("%s", toString(Verbosity.Long));
+        } else {
+            formatter.format("%s", toString(Verbosity.Short));
+        }
+
+        boolean neighborsAlternate = ((flags & FormattableFlags.LEFT_JUSTIFY) == FormattableFlags.LEFT_JUSTIFY);
+        int neighborsFlags = (neighborsAlternate ? FormattableFlags.ALTERNATE | FormattableFlags.LEFT_JUSTIFY : 0);
+        if (width > 0) {
+            if (this.predecessor != null) {
+                formatter.format(" pred={");
+                this.predecessor.formatTo(formatter, neighborsFlags, width - 1, 0);
+                formatter.format("}");
+            }
+
+            NodeClassIterator inputIter = inputs().iterator();
+            while (inputIter.hasNext()) {
+                Position position = inputIter.nextPosition();
+                Node input = getNodeClass().get(this, position);
+                if (input != null) {
+                    formatter.format(" ");
+                    formatter.format(getNodeClass().getName(position));
+                    formatter.format("={");
+                    input.formatTo(formatter, neighborsFlags, width - 1, 0);
+                    formatter.format("}");
+                }
+            }
+        }
+
+        if (precision > 0) {
+            if (this.usages.size() > 0) {
+                formatter.format(" usages={");
+                int z = 0;
+                for (Node usage : this.usages) {
+                    if (z != 0) {
+                        formatter.format(", ");
+                    }
+                    usage.formatTo(formatter, neighborsFlags, 0, precision - 1);
+                    ++z;
+                }
+                formatter.format("}");
+            }
+
+            NodeClassIterator succIter = successors().iterator();
+            while (succIter.hasNext()) {
+                Position position = succIter.nextPosition();
+                Node successor = getNodeClass().get(this, position);
+                if (successor != null) {
+                    formatter.format(" ");
+                    formatter.format(getNodeClass().getName(position));
+                    formatter.format("={");
+                    successor.formatTo(formatter, neighborsFlags, 0, precision - 1);
+                    formatter.format("}");
+                }
+            }
+        }
+    }
 }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeBitMap.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeBitMap.java	Thu Feb 02 16:07:52 2012 -0800
@@ -160,4 +160,8 @@
     public Iterator<Node> iterator() {
         return new MarkedNodeIterator(NodeBitMap.this, graph().getNodes().iterator());
     }
+
+    public int cardinality() {
+        return bitMap.cardinality();
+    }
 }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeInputsIterable.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeInputsIterable.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeList.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeSuccessorsIterable.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeUsagesList.java	Thu Feb 02 16:07:52 2012 -0800
@@ -48,10 +48,21 @@
         return size;
     }
 
+    @Override
     public boolean isEmpty() {
         return size == 0;
     }
 
+    @Override
+    public boolean isNotEmpty() {
+        return size > 0;
+    }
+
+    @Override
+    public int count() {
+        return size;
+    }
+
     protected void incModCount() {
         modCount++;
     }
@@ -134,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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/FilteredNodeIterable.java	Thu Feb 02 16:07:52 2012 -0800
@@ -28,24 +28,48 @@
 
 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;
+    }
+    public FilteredNodeIterable<T> and(NodePredicate nodePredicate) {
+        this.predicate = this.predicate.and(nodePredicate);
+        return this;
+    }
+    public FilteredNodeIterable<T> or(NodePredicate nodePredicate) {
+        this.predicate = this.predicate.or(nodePredicate);
+        return this;
     }
-    @SuppressWarnings("unchecked")
-    public <F extends T> FilteredNodeIterable<F> and(Class<F> clazz) {
-        this.predicate = predicate.and(new TypePredicate(clazz));
-        return (FilteredNodeIterable<F>) this;
+    @Override
+    public NodeIterable<T> until(final T u) {
+        until = until.or(NodePredicates.equals(u));
+        return this;
     }
-    @SuppressWarnings("unchecked")
-    public FilteredNodeIterable<Node> or(Class<? extends Node> clazz) {
-        this.predicate = predicate.or(new TypePredicate(clazz));
-        return (FilteredNodeIterable<Node>) 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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodeIterable.java	Thu Feb 02 16:07:52 2012 -0800
@@ -27,17 +27,21 @@
 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 (FilteredNodeIterable<F>) new FilteredNodeIterable<>(this).and(NodePredicates.isA(clazz));
     }
-    public <F extends T> FilteredNodeIterable<F> filter(Class<F> clazz) {
-        return new FilteredNodeIterable<>(this).and(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);
     }
     public List<T> snapshot() {
         ArrayList<T> list = new ArrayList<>();
@@ -53,4 +57,22 @@
         }
         return null;
     }
+    public int count() {
+        int count = 0;
+        Iterator<T> iterator = iterator();
+        while (iterator.hasNext()) {
+            iterator.next();
+            count++;
+        }
+        return count;
+    }
+    public boolean isEmpty() {
+        return count() == 0;
+    }
+    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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodeIterator.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodePredicate.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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	Thu Feb 02 16:07:52 2012 -0800
@@ -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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/PredicatedProxyNodeIterator.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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	Thu Feb 02 15:40:30 2012 -0800
+++ /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.hotspot/src/com/oracle/max/graal/hotspot/CompilerImpl.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/CompilerImpl.java	Thu Feb 02 16:07:52 2012 -0800
@@ -30,14 +30,12 @@
 import com.oracle.max.cri.ri.*;
 import com.oracle.max.cri.xir.*;
 import com.oracle.max.graal.compiler.*;
-import com.oracle.max.graal.compiler.observer.*;
 import com.oracle.max.graal.compiler.target.*;
 import com.oracle.max.graal.cri.*;
 import com.oracle.max.graal.hotspot.bridge.*;
 import com.oracle.max.graal.hotspot.logging.*;
 import com.oracle.max.graal.hotspot.ri.*;
 import com.oracle.max.graal.hotspot.server.*;
-import com.oracle.max.graal.printer.*;
 
 /**
  * Singleton class holding the instance of the GraalCompiler.
@@ -90,7 +88,6 @@
     private final CompilerToVM vmEntries;
     private final VMToCompiler vmExits;
 
-    private GraalContext context;
     private HotSpotRuntime runtime;
     private GraalCompiler compiler;
     private CiTarget target;
@@ -163,7 +160,7 @@
             Backend backend = Backend.create(target.arch, runtime, target);
             generator.initialize(backend.newXirAssembler());
 
-            compiler = new GraalCompiler(context, getRuntime(), getTarget(), backend, generator);
+            compiler = new GraalCompiler(getRuntime(), getTarget(), backend, generator);
         }
         return compiler;
     }
@@ -216,20 +213,20 @@
     @Override
     public HotSpotRuntime getRuntime() {
         if (runtime == null) {
-            context = new GraalContext("Virtual Machine Compiler");
             if (GraalOptions.PrintCFGToFile) {
-                context.addCompilationObserver(new CFGPrinterObserver());
+//                context.addCompilationObserver(new CFGPrinterObserver());
             }
-            if (GraalOptions.PrintIdealGraphLevel != 0 || GraalOptions.Plot || GraalOptions.PlotOnError) {
-                CompilationObserver observer;
-                if (GraalOptions.PrintIdealGraphFile) {
-                    observer = new IdealGraphPrinterObserver();
-                } else {
-                    observer = new IdealGraphPrinterObserver(GraalOptions.PrintIdealGraphAddress, GraalOptions.PrintIdealGraphPort);
-                }
-                context.addCompilationObserver(observer);
-            }
-            runtime = new HotSpotRuntime(context, config, this);
+           // if (GraalOptions.PrintIdealGraphLevel != 0 || GraalOptions.Plot || GraalOptions.PlotOnError) {
+             //   CompilationObserver observer;
+               // if (GraalOptions.PrintIdealGraphFile) {
+              //      observer = new IdealGraphPrinterObserver();
+              //  } else {
+              //      observer = new IdealGraphPrinterObserver(GraalOptions.PrintIdealGraphAddress, GraalOptions.PrintIdealGraphPort);
+              //  }
+//                context.addCompilationObserver(observer);
+                // TODO(tw): Install observer.
+           // }
+            runtime = new HotSpotRuntime(config, this);
         }
         return runtime;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotDebugConfig.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,146 @@
+/*
+ * 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.hotspot;
+
+import java.util.*;
+import java.util.regex.*;
+
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.cri.ri.*;
+import com.oracle.max.graal.compiler.*;
+import com.oracle.max.graal.debug.*;
+import com.oracle.max.graal.graph.*;
+import com.oracle.max.graal.printer.*;
+
+
+public class HotSpotDebugConfig implements DebugConfig {
+
+    private final String logFilter;
+    private final String meterFilter;
+    private final String timerFilter;
+    private final String dumpFilter;
+    private final String methodFilter;
+    private final List<DebugDumpHandler> dumpHandlers = new ArrayList<>();
+
+    public HotSpotDebugConfig(String logFilter, String meterFilter, String timerFilter, String dumpFilter, String methodFilter) {
+        this.logFilter = logFilter;
+        this.meterFilter = meterFilter;
+        this.timerFilter = timerFilter;
+        this.dumpFilter = dumpFilter;
+        this.methodFilter = methodFilter;
+        dumpHandlers.add(new IdealGraphPrinterDumpHandler(GraalOptions.PrintIdealGraphAddress, GraalOptions.PrintIdealGraphPort));
+    }
+
+    public boolean isLogEnabled() {
+        return isEnabled(logFilter);
+    }
+
+    public boolean isMeterEnabled() {
+        return isEnabled(meterFilter);
+    }
+
+    public boolean isDumpEnabled() {
+        return isEnabled(dumpFilter);
+    }
+
+    public boolean isTimeEnabled() {
+        return isEnabled(timerFilter);
+    }
+
+    private boolean isEnabled(String filter) {
+        return filter != null && checkContains(Debug.currentScope(), filter) && checkMethodFilter();
+    }
+
+    private static boolean checkContains(String currentScope, String filter) {
+        if (filter.contains("*")) {
+            /*filter = filter.replace("*", ".*");
+            filter = filter.replace("[", "\\[");
+            filter = filter.replace("]", "\\]");
+            filter = filter.replace(":", "\\:");*/
+            System.out.println("regexp: " + filter + " string=" + currentScope + ", " + Pattern.matches(filter, currentScope));
+            return Pattern.matches(filter, currentScope);
+        }
+        return currentScope.contains(filter);
+    }
+
+    private boolean checkMethodFilter() {
+        if (methodFilter == null) {
+            return true;
+        } else {
+            for (Object o : Debug.context()) {
+                if (o instanceof RiMethod) {
+                    RiMethod riMethod = (RiMethod) o;
+                    if (riMethod.toString().contains(methodFilter)) {
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("Debug config:");
+        add(sb, "Log", logFilter);
+        add(sb, "Meter", meterFilter);
+        add(sb, "Time", timerFilter);
+        add(sb, "Dump", dumpFilter);
+        add(sb, "MethodFilter", methodFilter);
+        return sb.toString();
+    }
+
+    private static void add(StringBuilder sb, String name, String filter) {
+        if (filter != null) {
+            sb.append(' ');
+            sb.append(name);
+            sb.append('=');
+            sb.append(filter);
+        }
+    }
+
+    @Override
+    public RuntimeException interceptException(RuntimeException e) {
+        if (e instanceof CiBailout) {
+            return e;
+        }
+        Debug.setConfig(Debug.fixedConfig(true, true, false, false));
+        // sync "Exception occured in scope: " with mx/sanitycheck.py::Test.__init__
+        Debug.log(String.format("Exception occured in scope: %s", Debug.currentScope()));
+        for (Object o : Debug.context()) {
+            Debug.log("Context obj %s", o);
+            if (o instanceof Graph) {
+                Graph graph = (Graph) o;
+                Debug.log("Found graph in context: ", graph);
+                Debug.dump(o, "Exception graph");
+            }
+        }
+        return e;
+    }
+
+    @Override
+    public Collection<? extends DebugDumpHandler> dumpHandlers() {
+        return dumpHandlers;
+    }
+}
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotOptions.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotOptions.java	Thu Feb 02 16:07:52 2012 -0800
@@ -77,7 +77,11 @@
                         value = Boolean.parseBoolean(valueString);
                     }
                 } else if (f.getType() == String.class) {
-                    value = valueString;
+                    if (valueString == null) {
+                        value = "";
+                    } else {
+                        value = valueString;
+                    }
                 }
             }
             if (value != null) {
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotTargetMethod.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotTargetMethod.java	Thu Feb 02 16:07:52 2012 -0800
@@ -35,7 +35,7 @@
 public final class HotSpotTargetMethod extends CompilerObject {
 
     /**
-     * 
+     *
      */
     private static final long serialVersionUID = 7807321392203253218L;
     public final CiTargetMethod targetMethod;
@@ -45,7 +45,7 @@
     public final Site[] sites;
     public final ExceptionHandler[] exceptionHandlers;
 
-    private HotSpotTargetMethod(Compiler compiler, HotSpotMethodResolved method, CiTargetMethod targetMethod) {
+    public HotSpotTargetMethod(Compiler compiler, HotSpotMethodResolved method, CiTargetMethod targetMethod) {
         super(compiler);
         this.method = method;
         this.targetMethod = targetMethod;
@@ -100,10 +100,6 @@
         return result;
     }
 
-    public static HotSpotCompiledMethod installMethod(Compiler compiler, HotSpotMethodResolved method, CiTargetMethod targetMethod, boolean installCode) {
-        return compiler.getVMEntries().installMethod(new HotSpotTargetMethod(compiler, method, targetMethod), installCode);
-    }
-
     public static Object installStub(Compiler compiler, CiTargetMethod targetMethod, String name) {
         return compiler.getVMEntries().installStub(new HotSpotTargetMethod(compiler, targetMethod, name));
     }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/CompilerToVM.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/CompilerToVM.java	Thu Feb 02 16:07:52 2012 -0800
@@ -31,7 +31,7 @@
 import com.oracle.max.graal.hotspot.ri.*;
 
 /**
- * Entries into the HotSpot VM from Java code.
+ * Calls from Java into HotSpot.
  */
 public interface CompilerToVM {
 
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompiler.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompiler.java	Thu Feb 02 16:07:52 2012 -0800
@@ -28,7 +28,7 @@
 import com.oracle.max.graal.hotspot.ri.*;
 
 /**
- * Exits from the HotSpot VM into Java code.
+ * Calls from HotSpot into Java.
  */
 public interface VMToCompiler {
 
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,6 +24,7 @@
 package com.oracle.max.graal.hotspot.bridge;
 
 import java.lang.reflect.*;
+import java.util.*;
 import java.util.concurrent.*;
 
 import com.oracle.max.cri.ci.*;
@@ -32,10 +33,13 @@
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.phases.*;
 import com.oracle.max.graal.compiler.phases.PhasePlan.PhasePosition;
+import com.oracle.max.graal.debug.*;
+import com.oracle.max.graal.debug.internal.*;
 import com.oracle.max.graal.hotspot.*;
 import com.oracle.max.graal.hotspot.Compiler;
 import com.oracle.max.graal.hotspot.ri.*;
 import com.oracle.max.graal.hotspot.server.*;
+import com.oracle.max.graal.hotspot.snippets.*;
 import com.oracle.max.graal.java.*;
 import com.oracle.max.graal.snippets.*;
 
@@ -45,6 +49,8 @@
 public class VMToCompilerImpl implements VMToCompiler, Remote {
 
     private final Compiler compiler;
+    private int compiledMethodCount;
+    private IntrinsifyArrayCopyPhase intrinsifyArrayCopy;
 
     public final HotSpotTypePrimitive typeBoolean;
     public final HotSpotTypePrimitive typeChar;
@@ -56,20 +62,33 @@
     public final HotSpotTypePrimitive typeLong;
     public final HotSpotTypePrimitive typeVoid;
 
-    ThreadFactory daemonThreadFactory = new ThreadFactory() {
+    ThreadFactory compilerThreadFactory = new ThreadFactory() {
+
         @Override
         public Thread newThread(Runnable r) {
-            Thread t = new CompilerThread(r);
-            t.setDaemon(true);
-            return t;
+            return new CompilerThread(r);
         }
     };
-    private static final class CompilerThread extends Thread {
+
+    private final class CompilerThread extends Thread {
+
         public CompilerThread(Runnable r) {
             super(r);
-            this.setName("CompilerThread-" + this.getId());
+            this.setName("GraalCompilerThread-" + this.getId());
+            this.setDaemon(true);
+        }
+
+        @Override
+        public void run() {
+            if (GraalOptions.Debug) {
+                Debug.enable();
+                HotSpotDebugConfig hotspotDebugConfig = new HotSpotDebugConfig(GraalOptions.Log, GraalOptions.Meter, GraalOptions.Time, GraalOptions.Dump, GraalOptions.MethodFilter);
+                Debug.setConfig(hotspotDebugConfig);
+            }
+            super.run();
         }
     }
+
     private ThreadPoolExecutor compileQueue;
 
     public VMToCompilerImpl(Compiler compiler) {
@@ -93,17 +112,20 @@
         // Install intrinsics.
         HotSpotRuntime runtime = (HotSpotRuntime) compiler.getCompiler().runtime;
         if (GraalOptions.Intrinsify) {
+            this.intrinsifyArrayCopy = new IntrinsifyArrayCopyPhase(runtime);
             GraalIntrinsics.installIntrinsics(runtime, runtime.getCompiler().getTarget(), PhasePlan.DEFAULT);
-            Snippets.install(runtime, runtime.getCompiler().getTarget(), new SystemSnippets(), GraalOptions.PlotSnippets, PhasePlan.DEFAULT);
-            Snippets.install(runtime, runtime.getCompiler().getTarget(), new UnsafeSnippets(), GraalOptions.PlotSnippets, PhasePlan.DEFAULT);
+            Snippets.install(runtime, runtime.getCompiler().getTarget(), new SystemSnippets(), PhasePlan.DEFAULT);
+            Snippets.install(runtime, runtime.getCompiler().getTarget(), new UnsafeSnippets(), PhasePlan.DEFAULT);
+            Snippets.install(runtime, runtime.getCompiler().getTarget(), new ArrayCopySnippets(), PhasePlan.DEFAULT);
         }
 
         // Create compilation queue.
-        compileQueue = new ThreadPoolExecutor(GraalOptions.Threads, GraalOptions.Threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), daemonThreadFactory);
+        compileQueue = new ThreadPoolExecutor(GraalOptions.Threads, GraalOptions.Threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), compilerThreadFactory);
 
         // Create queue status printing thread.
         if (GraalOptions.PrintQueue) {
             Thread t = new Thread() {
+
                 @Override
                 public void run() {
                     while (true) {
@@ -121,9 +143,9 @@
     }
 
     /**
-     * This method is the first method compiled during bootstrapping. Put any code in there that
-     * warms up compiler paths that are otherwise no exercised during bootstrapping and lead to later
-     * deoptimization when application code is compiled.
+     * This method is the first method compiled during bootstrapping. Put any code in there that warms up compiler paths
+     * that are otherwise no exercised during bootstrapping and lead to later deoptimization when application code is
+     * compiled.
      */
     @SuppressWarnings("unused")
     @Deprecated
@@ -164,25 +186,87 @@
     }
 
     public void shutdownCompiler() throws Throwable {
-        compiler.getCompiler().context.print();
+// compiler.getCompiler().context.print();
+        // TODO(tw): Print context results.
         compileQueue.shutdown();
+
+        if (Debug.isEnabled()) {
+            List<DebugValueMap> topLevelMaps = DebugValueMap.getTopLevelMaps();
+            List<DebugValue> debugValues = KeyRegistry.getDebugValues();
+            if (debugValues.size() > 0) {
+                for (DebugValueMap map : topLevelMaps) {
+                    TTY.println("Showing the results for thread: " + map.getName());
+                    map.group();
+                    map.normalize();
+                    printMap(map, debugValues, 0);
+                }
+            }
+        }
+    }
+
+    private void printMap(DebugValueMap map, List<DebugValue> debugValues, int level) {
+
+        printIndent(level);
+        TTY.println(map.getName());
+        for (DebugValue value : debugValues) {
+            long l = map.getCurrentValue(value.getIndex());
+            if (l != 0) {
+                printIndent(level + 1);
+                TTY.println(value.getName() + "=" + l);
+            }
+        }
+
+        for (DebugValueMap child : map.getChildren()) {
+            printMap(child, debugValues, level + 1);
+        }
+    }
+
+    private static void printIndent(int level) {
+        for (int i = 0; i < level; ++i) {
+            TTY.print("    ");
+        }
+        TTY.print("|-> ");
     }
 
     @Override
     public void compileMethod(final HotSpotMethodResolved method, final int entryBCI, boolean blocking) throws Throwable {
         try {
             if (Thread.currentThread() instanceof CompilerThread && method.holder().name().contains("java/util/concurrent")) {
+                // This is required to avoid deadlocking a compiler thread. The issue is that a
+                // java.util.concurrent.BlockingQueue is used to implement the compilation worker
+                // queues. If a compiler thread triggers a compilation, then it may be blocked trying
+                // to add something to its own queue.
                 return;
             }
 
             Runnable runnable = new Runnable() {
+
                 public void run() {
                     try {
-                        PhasePlan plan = new PhasePlan();
+                        PhasePlan plan = getDefaultPhasePlan();
                         GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(compiler.getRuntime());
                         plan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
-                        CiTargetMethod result = compiler.getCompiler().compileMethod(method, -1, plan);
-                        HotSpotTargetMethod.installMethod(compiler, method, result, true);
+                        long startTime = 0;
+                        int index = compiledMethodCount++;
+                        final boolean printCompilation = GraalOptions.PrintCompilation && !TTY.isSuppressed();
+                        if (printCompilation) {
+                            TTY.println(String.format("Graal %4d %-70s %-45s %-50s ...", index, method.holder().name(), method.name(), method.signature().asString()));
+                            startTime = System.nanoTime();
+                        }
+
+                        CiTargetMethod result = null;
+                        TTY.Filter filter = new TTY.Filter(GraalOptions.PrintFilter, method);
+                        try {
+                            result = compiler.getCompiler().compileMethod(method, -1, plan);
+                        } finally {
+                            filter.remove();
+                            if (printCompilation) {
+                                long time = (System.nanoTime() - startTime) / 100000;
+                                TTY.println(String.format("Graal %4d %-70s %-45s %-50s | %3d.%dms %4dnodes %5dB", index, "", "", "", time / 10, time % 10, 0, (result != null ? result.targetCodeSize()
+                                                : -1)));
+                            }
+                        }
+                        compiler.getRuntime().installMethod(method, result);
                     } catch (CiBailout bailout) {
                         if (GraalOptions.ExitVMOnBailout) {
                             bailout.printStackTrace(TTY.cachedOut);
@@ -296,4 +380,10 @@
     public CiConstant createCiConstantObject(Object object) {
         return CiConstant.forObject(object);
     }
+
+    private PhasePlan getDefaultPhasePlan() {
+        PhasePlan phasePlan = new PhasePlan();
+        phasePlan.addPhase(PhasePosition.HIGH_LEVEL, intrinsifyArrayCopy);
+        return phasePlan;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/nodes/TailcallNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,77 @@
+/*
+ * 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.hotspot.nodes;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.cri.ri.*;
+import com.oracle.max.graal.compiler.gen.*;
+import com.oracle.max.graal.hotspot.*;
+import com.oracle.max.graal.hotspot.target.amd64.*;
+import com.oracle.max.graal.java.*;
+import com.oracle.max.graal.nodes.*;
+import com.oracle.max.graal.nodes.spi.*;
+import com.oracle.max.graal.nodes.type.*;
+
+/**
+ * Performs a tail call to the specified target compiled method, with the parameter taken from the supplied FrameState.
+ */
+public class TailcallNode extends FixedWithNextNode implements LIRLowerable {
+
+    @Input private final FrameState frameState;
+    @Input private final ValueNode target;
+
+    /**
+     * Creates a TailcallNode.
+     * @param target points to the start of an nmethod
+     * @param frameState the parameters will be taken from this FrameState
+     */
+    public TailcallNode(ValueNode target, FrameState frameState) {
+        super(StampFactory.illegal());
+        this.target = target;
+        this.frameState = frameState;
+    }
+
+    @Override
+    public void generate(LIRGeneratorTool generator) {
+        LIRGenerator gen = (LIRGenerator) generator;
+        HotSpotVMConfig config = CompilerImpl.getInstance().getConfig();
+        RiResolvedMethod method = frameState.method();
+        boolean isStatic = Modifier.isStatic(method.accessFlags());
+
+        CiKind[] signature = CiUtil.signatureToKinds(method.signature(), isStatic ? null : method.holder().kind(true));
+        CiCallingConvention cc = gen.frameMap().registerConfig.getCallingConvention(CiCallingConvention.Type.JavaCall, signature, gen.target(), false);
+        gen.frameMap().callsMethod(cc, CiCallingConvention.Type.JavaCall); // TODO (aw): I think this is unnecessary for a tail call.
+        List<ValueNode> parameters = new ArrayList<>();
+        for (int i = 0, slot = 0; i < cc.locations.length; i++, slot += FrameStateBuilder.stackSlots(frameState.localAt(slot).kind())) {
+            parameters.add(frameState.localAt(slot));
+        }
+        List<CiValue> argList = gen.visitInvokeArguments(cc, parameters, null);
+
+        CiValue entry = gen.emitLoad(new CiAddress(CiKind.Long, gen.operand(target), config.nmethodEntryOffset), false);
+
+        gen.append(new AMD64TailcallOp(argList, entry, cc.locations));
+    }
+}
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodResolvedImpl.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodResolvedImpl.java	Thu Feb 02 16:07:52 2012 -0800
@@ -58,6 +58,7 @@
     private HotSpotMethodData methodData;
     private byte[] code;
     private boolean canBeInlined;
+    private CiGenericCallback callback;
 
     private HotSpotMethodResolvedImpl() {
         super(null);
@@ -320,10 +321,16 @@
 
     @Override
     public boolean canBeInlined() {
-        return canBeInlined;
+        return canBeInlined && callback == null;
+    }
+    public void neverInline() {
+        this.canBeInlined = false;
     }
 
-    public void setCanBeInlined(boolean canBeInlined) {
-        this.canBeInlined = canBeInlined;
+    public CiGenericCallback callback() {
+        return callback;
+    }
+    public void setCallback(CiGenericCallback callback) {
+        this.callback = callback;
     }
 }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotRuntime.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotRuntime.java	Thu Feb 02 16:07:52 2012 -0800
@@ -34,12 +34,15 @@
 import com.oracle.max.cri.ri.RiType.Representation;
 import com.oracle.max.criutils.*;
 import com.oracle.max.graal.compiler.*;
+import com.oracle.max.graal.compiler.phases.*;
 import com.oracle.max.graal.cri.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.hotspot.*;
 import com.oracle.max.graal.hotspot.Compiler;
 import com.oracle.max.graal.hotspot.nodes.*;
+import com.oracle.max.graal.java.*;
 import com.oracle.max.graal.nodes.*;
+import com.oracle.max.graal.nodes.DeoptimizeNode.DeoptAction;
 import com.oracle.max.graal.nodes.calc.*;
 import com.oracle.max.graal.nodes.extended.*;
 import com.oracle.max.graal.nodes.java.*;
@@ -49,14 +52,12 @@
  * CRI runtime implementation for the HotSpot VM.
  */
 public class HotSpotRuntime implements GraalRuntime {
-    final GraalContext context;
     final HotSpotVMConfig config;
     final HotSpotRegisterConfig regConfig;
     private final HotSpotRegisterConfig globalStubRegConfig;
     private final Compiler compiler;
 
-    public HotSpotRuntime(GraalContext context, HotSpotVMConfig config, Compiler compiler) {
-        this.context = context;
+    public HotSpotRuntime(HotSpotVMConfig config, Compiler compiler) {
         this.config = config;
         this.compiler = compiler;
         regConfig = new HotSpotRegisterConfig(config, false);
@@ -405,18 +406,82 @@
         return (RiResolvedMethod) compiler.getVMEntries().getRiMethod(reflectionMethod);
     }
 
-    public void installMethod(RiMethod method, CiTargetMethod code) {
-        HotSpotTargetMethod.installMethod(CompilerImpl.getInstance(), (HotSpotMethodResolved) method, code, true);
+    @Override
+    public void installMethod(RiResolvedMethod method, CiTargetMethod code) {
+        synchronized (method) {
+            if (((HotSpotMethodResolvedImpl) method).callback() == null) {
+                compiler.getVMEntries().installMethod(new HotSpotTargetMethod(compiler, (HotSpotMethodResolved) method, code), true);
+            } else {
+                // callback stub is installed.
+            }
+        }
     }
 
     @Override
     public RiCompiledMethod addMethod(RiResolvedMethod method, CiTargetMethod code) {
-        Compiler compilerInstance = CompilerImpl.getInstance();
-        return HotSpotTargetMethod.installMethod(compilerInstance, (HotSpotMethodResolved) method, code, false);
+        return compiler.getVMEntries().installMethod(new HotSpotTargetMethod(compiler, (HotSpotMethodResolved) method, code), false);
+    }
+
+    public void installMethodCallback(RiResolvedMethod method, CiGenericCallback callback) {
+        synchronized (method) {
+            ((HotSpotMethodResolvedImpl) method).setCallback(callback);
+            CiTargetMethod callbackStub = createCallbackStub(method, callback);
+            compiler.getVMEntries().installMethod(new HotSpotTargetMethod(compiler, (HotSpotMethodResolved) method, callbackStub), true);
+        }
     }
 
     @Override
     public RiRegisterConfig getGlobalStubRegisterConfig() {
         return globalStubRegConfig;
     }
+
+    private CiTargetMethod createCallbackStub(RiResolvedMethod method, CiGenericCallback callback) {
+        StructuredGraph graph = new StructuredGraph();
+        FrameStateBuilder frameState = new FrameStateBuilder(method, method.maxLocals(), method.maxStackSize(), graph);
+        ValueNode local0 = frameState.loadLocal(0);
+
+        FrameState initialFrameState = frameState.create(0);
+        graph.start().setStateAfter(initialFrameState);
+
+        ConstantNode callbackNode = ConstantNode.forObject(callback, this, graph);
+
+        RuntimeCallNode runtimeCall = graph.add(new RuntimeCallNode(CiRuntimeCall.GenericCallback, new ValueNode[] {callbackNode, local0}));
+        runtimeCall.setStateAfter(initialFrameState.duplicateModified(0, false, CiKind.Void, runtimeCall));
+
+        @SuppressWarnings("unused")
+        HotSpotCompiledMethod hotSpotCompiledMethod = new HotSpotCompiledMethod(null); // initialize class...
+        RiResolvedType compiledMethodClass = getType(HotSpotCompiledMethod.class);
+        RiResolvedField nmethodField = null;
+        for (RiResolvedField field : compiledMethodClass.declaredFields()) {
+            if (field.name().equals("nmethod")) {
+                nmethodField = field;
+                break;
+            }
+        }
+        assert nmethodField != null;
+        LoadFieldNode loadField = graph.add(new LoadFieldNode(runtimeCall, nmethodField));
+
+        CompareNode compare = graph.unique(new CompareNode(loadField, Condition.EQ, ConstantNode.forLong(0, graph)));
+
+        IfNode ifNull = graph.add(new IfNode(compare, 0.01));
+
+        BeginNode beginInvalidated = graph.add(new BeginNode());
+        DeoptimizeNode deoptInvalidated = graph.add(new DeoptimizeNode(DeoptAction.None));
+
+        BeginNode beginTailcall = graph.add(new BeginNode());
+        TailcallNode tailcall = graph.add(new TailcallNode(loadField, initialFrameState));
+        DeoptimizeNode deoptEnd = graph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile));
+
+        graph.start().setNext(runtimeCall);
+        runtimeCall.setNext(loadField);
+        loadField.setNext(ifNull);
+        ifNull.setTrueSuccessor(beginInvalidated);
+        ifNull.setFalseSuccessor(beginTailcall);
+        beginInvalidated.setNext(deoptInvalidated);
+        beginTailcall.setNext(tailcall);
+        tailcall.setNext(deoptEnd);
+
+        CiTargetMethod result = compiler.getCompiler().compileMethod(method, graph, -1, PhasePlan.DEFAULT);
+        return result;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/ArrayCopySnippets.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,422 @@
+/*
+ * 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.hotspot.snippets;
+
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.graal.hotspot.*;
+import com.oracle.max.graal.nodes.*;
+import com.oracle.max.graal.nodes.extended.*;
+import com.oracle.max.graal.nodes.spi.*;
+import com.oracle.max.graal.nodes.type.*;
+import com.oracle.max.graal.snippets.*;
+import com.oracle.max.graal.snippets.nodes.*;
+
+
+public class ArrayCopySnippets implements SnippetsInterface{
+
+    @Snippet
+    public static void arraycopy(byte[] src, int srcPos, byte[] 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) {
+                if ((length & 0x02) == 0) {
+                    if ((length & 0x04) == 0) {
+                        copyLongsDown(src, srcPos, dest, destPos, length >> 3);
+                    } else {
+                        copyIntsDown(src, srcPos, dest, destPos, length >> 2);
+                    }
+                } else {
+                    copyShortsDown(src, srcPos, dest, destPos, length >> 1);
+                }
+            } else {
+                copyBytesDown(src, srcPos, dest, destPos, length);
+            }
+        } else {
+            if ((length & 0x01) == 0) {
+                if ((length & 0x02) == 0) {
+                    if ((length & 0x04) == 0) {
+                        copyLongsUp(src, srcPos, dest, destPos, length >> 3);
+                    } else {
+                        copyIntsUp(src, srcPos, dest, destPos, length >> 2);
+                    }
+                } else {
+                    copyShortsUp(src, srcPos, dest, destPos, length >> 1);
+                }
+            } else {
+                copyBytesUp(src, srcPos, dest, destPos, length);
+            }
+        }
+    }
+
+    @Snippet
+    public static void arraycopy(char[] src, int srcPos, char[] 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) {
+                if ((length & 0x02) == 0) {
+                    copyLongsDown(src, srcPos * 2L, dest, destPos * 2L, length >> 2);
+                } else {
+                    copyIntsDown(src, srcPos * 2L, dest, destPos * 2L, length >> 1);
+                }
+            } else {
+                copyShortsDown(src, srcPos * 2L, dest, destPos * 2L, length);
+            }
+        } else {
+            if ((length & 0x01) == 0) {
+                if ((length & 0x02) == 0) {
+                    copyLongsUp(src, srcPos * 2L, dest, destPos * 2L, length >> 2);
+                } else {
+                    copyIntsUp(src, srcPos * 2L, dest, destPos * 2L, length >> 1);
+                }
+            } else {
+                copyShortsUp(src, srcPos * 2L, dest, destPos * 2L, length);
+            }
+        }
+    }
+
+    @Snippet
+    public static void arraycopy(short[] src, int srcPos, short[] 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) {
+                if ((length & 0x02) == 0) {
+                    copyLongsDown(src, srcPos * 2L, dest, destPos * 2L, length >> 2);
+                } else {
+                    copyIntsDown(src, srcPos * 2L, dest, destPos * 2L, length >> 1);
+                }
+            } else {
+                copyShortsDown(src, srcPos * 2L, dest, destPos * 2L, length);
+            }
+        } else {
+            if ((length & 0x01) == 0) {
+                if ((length & 0x02) == 0) {
+                    copyLongsUp(src, srcPos * 2L, dest, destPos * 2L, length >> 2);
+                } else {
+                    copyIntsUp(src, srcPos * 2L, dest, destPos * 2L, length >> 1);
+                }
+            } else {
+                copyShortsUp(src, srcPos * 2L, dest, destPos * 2L, length);
+            }
+        }
+    }
+
+    @Snippet
+    public static void arraycopy(int[] src, int srcPos, int[] 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(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();
+        }
+        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);
+        }
+    }
+
+    @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);
+        }
+        if (length > 0) {
+            long header = ArrayHeaderSizeNode.sizeFor(CiKind.Object);
+            int cardShift = CardTableShiftNode.get();
+            long cardStart = CardTableStartNode.get();
+            long dstAddr = GetObjectAddressNode.get(dest);
+            long start = (dstAddr + header + destPos * 8L) >>> cardShift;
+            long end = (dstAddr + header + (destPos + length - 1) * 8L) >>> cardShift;
+            long count = end - start;
+            while (count-- >= 0) {
+                DirectStoreNode.store((start + cardStart) + count, false);
+            }
+        }
+    }
+
+    @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--) {
+            Byte a = UnsafeLoadNode.load(src, i + (srcPos + header), CiKind.Byte);
+            UnsafeStoreNode.store(dest, i + (destPos + header), a.byteValue(), CiKind.Byte);
+        }
+    }
+
+    @Snippet
+    public static void copyShortsDown(Object src, long srcOffset, Object dest, long destOffset, int length)  {
+        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Short);
+        for (long i = (length - 1) * 2; i >= 0; i -= 2) {
+            Character a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Short);
+            UnsafeStoreNode.store(dest, i + (destOffset + header), a.charValue(), CiKind.Short);
+        }
+    }
+
+    @Snippet
+    public static void copyIntsDown(Object src, long srcOffset, Object dest, long destOffset, int length)  {
+        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Short);
+        for (long i = (length - 1) * 4; i >= 0; i -= 4) {
+            Integer a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Int);
+            UnsafeStoreNode.store(dest, i + (destOffset + header), a.intValue(), CiKind.Int);
+        }
+    }
+
+    @Snippet
+    public static void copyLongsDown(Object src, long srcOffset, Object dest, long destOffset, int length)  {
+        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Short);
+        for (long i = (length - 1) * 8; i >= 0; i -= 8) {
+            Long a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Long);
+            UnsafeStoreNode.store(dest, i + (destOffset + header), a.longValue(), CiKind.Long);
+        }
+    }
+
+    // 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
+     * @param srcPos source offset
+     * @param dest destination object
+     * @param destPos destination offset
+     * @param length number of bytes to copy
+     */
+    @Snippet
+    public static void copyBytesUp(Object src, int srcPos, Object dest, int destPos, int length)  {
+        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Byte);
+        for (long i = 0; i < length; i++) {
+            Byte a = UnsafeLoadNode.load(src, i + (srcPos + header), CiKind.Byte);
+            UnsafeStoreNode.store(dest, i + (destPos + header), a.byteValue(), CiKind.Byte);
+        }
+    }
+
+    /**
+     * Copies {@code length} shorts from {@code src} starting at offset {@code srcOffset} (in bytes) to {@code dest} starting at offset {@code destOffset} (in bytes).
+     * @param src
+     * @param srcOffset (in bytes)
+     * @param dest
+     * @param destOffset (in bytes)
+     * @param length  (in shorts)
+     */
+    @Snippet
+    public static void copyShortsUp(Object src, long srcOffset, Object dest, long destOffset, int length)  {
+        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Short);
+        for (long i = 0; i < length * 2L; i += 2) {
+            Character a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Short);
+            UnsafeStoreNode.store(dest, i + (destOffset + header), a.charValue(), CiKind.Short);
+        }
+    }
+
+    @Snippet
+    public static void copyIntsUp(Object src, long srcOffset, Object dest, long destOffset, int length)  {
+        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Int);
+        for (long i = 0; i < length * 4L; i += 4) {
+            Integer a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Int);
+            UnsafeStoreNode.store(dest, i + (destOffset + header), a.intValue(), CiKind.Int);
+        }
+    }
+
+    @Snippet
+    public static void copyLongsUp(Object src, long srcOffset, Object dest, long destOffset, int length)  {
+        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Long);
+        for (long i = 0; i < length * 8L; i += 8) {
+            Long a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Long);
+            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);
+        }
+    }
+
+    private static class GetObjectAddressNode extends FixedWithNextNode implements LIRLowerable {
+        @Input private ValueNode object;
+
+        public GetObjectAddressNode(ValueNode obj) {
+            super(StampFactory.forKind(CiKind.Long));
+            this.object = obj;
+        }
+
+        @SuppressWarnings("unused")
+        @NodeIntrinsic
+        public static long get(Object array) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void generate(LIRGeneratorTool gen) {
+            CiValue obj = gen.newVariable(gen.target().wordKind);
+            gen.emitMove(gen.operand(object), obj);
+            gen.setResult(this, obj);
+        }
+    }
+
+    private static class DirectStoreNode extends FixedWithNextNode implements LIRLowerable {
+        @Input private ValueNode address;
+        @Input private ValueNode value;
+
+        public DirectStoreNode(ValueNode address, ValueNode value) {
+            super(StampFactory.illegal());
+            this.address = address;
+            this.value = value;
+        }
+
+        @SuppressWarnings("unused")
+        @NodeIntrinsic
+        public static void store(long address, long value) {
+            throw new UnsupportedOperationException();
+        }
+
+        @SuppressWarnings("unused")
+        @NodeIntrinsic
+        public static void store(long address, boolean value) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void generate(LIRGeneratorTool gen) {
+            CiValue v = gen.operand(value);
+            gen.emitStore(new CiAddress(v.kind, gen.operand(address)), v, false);
+        }
+    }
+
+    private static class CardTableShiftNode extends ConstantNode {
+        public CardTableShiftNode() {
+            super(CiConstant.forInt(CompilerImpl.getInstance().getConfig().cardtableShift));
+        }
+
+        @NodeIntrinsic
+        public static int get() {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    private static class CardTableStartNode extends ConstantNode {
+        public CardTableStartNode() {
+            super(CiConstant.forLong(CompilerImpl.getInstance().getConfig().cardtableStartAddress));
+        }
+
+        @NodeIntrinsic
+        public static long get() {
+            throw new UnsupportedOperationException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/IntrinsifyArrayCopyPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,129 @@
+/*
+ * 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.hotspot.snippets;
+
+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.*;
+import com.oracle.max.graal.cri.*;
+import com.oracle.max.graal.debug.*;
+import com.oracle.max.graal.graph.*;
+import com.oracle.max.graal.nodes.*;
+import com.oracle.max.graal.nodes.java.*;
+
+public class IntrinsifyArrayCopyPhase extends Phase {
+    private final GraalRuntime runtime;
+    private RiResolvedMethod arrayCopy;
+    private RiResolvedMethod byteArrayCopy;
+    private RiResolvedMethod shortArrayCopy;
+    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;
+        try {
+            byteArrayCopy = getArrayCopySnippet(runtime, byte.class);
+            charArrayCopy = getArrayCopySnippet(runtime, char.class);
+            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();
+        } catch (NoSuchMethodException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static RiResolvedMethod getArrayCopySnippet(RiRuntime runtime, Class<?> componentClass) throws NoSuchMethodException {
+        Class<?> arrayClass = Array.newInstance(componentClass, 0).getClass();
+        return runtime.getRiMethod(ArrayCopySnippets.class.getDeclaredMethod("arraycopy", arrayClass, int.class, arrayClass, int.class, int.class));
+    }
+
+    @Override
+    protected void run(StructuredGraph graph) {
+        boolean hits = false;
+        for (MethodCallTargetNode methodCallTarget : graph.getNodes(MethodCallTargetNode.class)) {
+            RiResolvedMethod targetMethod = methodCallTarget.targetMethod();
+            RiResolvedMethod snippetMethod = null;
+            if (targetMethod == arrayCopy) {
+                ValueNode src = methodCallTarget.arguments().get(0);
+                ValueNode dest = methodCallTarget.arguments().get(2);
+                if (src == null || dest == null) { //TODO (gd) this should never be null : check
+                    return;
+                }
+                RiResolvedType srcDeclaredType = src.declaredType();
+                RiResolvedType destDeclaredType = dest.declaredType();
+                if (srcDeclaredType != null
+                                && srcDeclaredType.isArrayClass()
+                                && destDeclaredType != null
+                                && 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;
+                    }
+                }
+            }
+
+            if (snippetMethod != null) {
+                StructuredGraph snippetGraph = (StructuredGraph) snippetMethod.compilerStorage().get(Graph.class);
+                assert snippetGraph != null : "ArrayCopySnippets should be installed";
+                hits = true;
+                Debug.log("%s > Intinsify (%s)", Debug.currentScope(), snippetMethod.signature().argumentTypeAt(0, snippetMethod.holder()).componentType());
+                InliningUtil.inline(methodCallTarget.invoke(), snippetGraph, false);
+            }
+        }
+        if (hits) {
+            new CanonicalizerPhase(null, runtime, null).apply(graph);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/SystemSnippets.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,43 @@
+/*
+ * 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.hotspot.snippets;
+
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.graal.nodes.extended.*;
+import com.oracle.max.graal.snippets.*;
+
+/**
+ * Snippets for {@link java.lang.System} methods.
+ */
+@ClassSubstitution(java.lang.System.class)
+public class SystemSnippets implements SnippetsInterface {
+
+    public static long currentTimeMillis() {
+        return RuntimeCallNode.performCall(CiRuntimeCall.JavaTimeMillis);
+    }
+
+    public static long nanoTime() {
+        return RuntimeCallNode.performCall(CiRuntimeCall.JavaTimeNanos);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/UnsafeSnippets.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,252 @@
+/*
+ * 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.hotspot.snippets;
+
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.cri.util.*;
+import com.oracle.max.graal.nodes.extended.*;
+import com.oracle.max.graal.nodes.java.*;
+import com.oracle.max.graal.snippets.*;
+
+/**
+ * Snippets for {@link sun.misc.Unsafe} methods.
+ */
+@ClassSubstitution(sun.misc.Unsafe.class)
+public class UnsafeSnippets implements SnippetsInterface {
+
+    public boolean compareAndSwapObject(Object o, long offset, Object expected, Object x) {
+        return CompareAndSwapNode.compareAndSwap(o, offset, expected, x);
+    }
+
+    public boolean compareAndSwapInt(Object o, long offset, int expected, int x) {
+        return CompareAndSwapNode.compareAndSwap(o, offset, expected, x);
+    }
+
+    public boolean compareAndSwapLong(Object o, long offset, long expected, long x) {
+        return CompareAndSwapNode.compareAndSwap(o, offset, expected, x);
+    }
+
+    public Object getObject(Object o, long offset) {
+        return UnsafeLoadNode.load(o, offset, CiKind.Object);
+    }
+
+    public Object getObjectVolatile(Object o, long offset) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
+        Object result = getObject(o, offset);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
+        return result;
+    }
+
+    public void putObject(Object o, long offset, Object x) {
+        UnsafeStoreNode.store(o, offset, x, CiKind.Object);
+    }
+
+    public void putObjectVolatile(Object o, long offset, Object x) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
+        putObject(o, offset, x);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
+    }
+
+    public int getInt(Object o, long offset) {
+        Integer value = UnsafeLoadNode.load(o, offset, CiKind.Int);
+        return value;
+    }
+
+    public int getIntVolatile(Object o, long offset) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
+        int result = getInt(o, offset);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
+        return result;
+    }
+
+    public void putInt(Object o, long offset, int x) {
+        UnsafeStoreNode.store(o, offset, x, CiKind.Int);
+    }
+
+    public void putIntVolatile(Object o, long offset, int x) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
+        putInt(o, offset, x);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
+    }
+
+    public boolean getBoolean(Object o, long offset) {
+        @JavacBug(id = 6995200)
+        Boolean result = UnsafeLoadNode.load(o, offset, CiKind.Boolean);
+        return result;
+    }
+
+    public boolean getBooleanVolatile(Object o, long offset) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
+        boolean result = getBoolean(o, offset);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
+        return result;
+    }
+
+    public void putBoolean(Object o, long offset, boolean x) {
+        UnsafeStoreNode.store(o, offset, x, CiKind.Boolean);
+    }
+
+    public void putBooleanVolatile(Object o, long offset, boolean x) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
+        putBoolean(o, offset, x);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
+    }
+
+    public byte getByte(Object o, long offset) {
+        @JavacBug(id = 6995200)
+        Byte result = UnsafeLoadNode.load(o, offset, CiKind.Byte);
+        return result;
+    }
+
+    public byte getByteVolatile(Object o, long offset) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
+        byte result = getByte(o, offset);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
+        return result;
+    }
+
+    public void putByte(Object o, long offset, byte x) {
+        UnsafeStoreNode.store(o, offset, x, CiKind.Byte);
+    }
+
+    public void putByteVolatile(Object o, long offset, byte x) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
+        putByte(o, offset, x);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
+    }
+
+    public short getShort(Object o, long offset) {
+        @JavacBug(id = 6995200)
+        Short result = UnsafeLoadNode.load(o, offset, CiKind.Short);
+        return result;
+    }
+
+    public short getShortVolatile(Object o, long offset) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
+        short result = getShort(o, offset);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
+        return result;
+    }
+
+    public void putShort(Object o, long offset, short x) {
+        UnsafeStoreNode.store(o, offset, x, CiKind.Short);
+    }
+
+    public void putShortVolatile(Object o, long offset, short x) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
+        putShort(o, offset, x);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
+    }
+
+    public char getChar(Object o, long offset) {
+        @JavacBug(id = 6995200)
+        Character result = UnsafeLoadNode.load(o, offset, CiKind.Char);
+        return result;
+    }
+
+    public char getCharVolatile(Object o, long offset) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
+        char result = getChar(o, offset);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
+        return result;
+    }
+
+    public void putChar(Object o, long offset, char x) {
+        UnsafeStoreNode.store(o, offset, x, CiKind.Char);
+    }
+
+    public void putCharVolatile(Object o, long offset, char x) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
+        putChar(o, offset, x);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
+    }
+
+    public long getLong(Object o, long offset) {
+        @JavacBug(id = 6995200)
+        Long result = UnsafeLoadNode.load(o, offset, CiKind.Long);
+        return result;
+    }
+
+    public long getLongVolatile(Object o, long offset) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
+        long result = getLong(o, offset);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
+        return result;
+    }
+
+    public void putLong(Object o, long offset, long x) {
+        UnsafeStoreNode.store(o, offset, x, CiKind.Long);
+    }
+
+    public void putLongVolatile(Object o, long offset, long x) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
+        putLong(o, offset, x);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
+    }
+
+    public float getFloat(Object o, long offset) {
+        @JavacBug(id = 6995200)
+        Float result = UnsafeLoadNode.load(o, offset, CiKind.Float);
+        return result;
+    }
+
+    public float getFloatVolatile(Object o, long offset) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
+        float result = getFloat(o, offset);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
+        return result;
+    }
+
+    public void putFloat(Object o, long offset, float x) {
+        UnsafeStoreNode.store(o, offset, x, CiKind.Float);
+    }
+
+    public void putFloatVolatile(Object o, long offset, float x) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
+        putFloat(o, offset, x);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
+    }
+
+    public double getDouble(Object o, long offset) {
+        @JavacBug(id = 6995200)
+        Double result = UnsafeLoadNode.load(o, offset, CiKind.Double);
+        return result;
+    }
+
+    public double getDoubleVolatile(Object o, long offset) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
+        double result = getDouble(o, offset);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
+        return result;
+    }
+
+    public void putDouble(Object o, long offset, double x) {
+        UnsafeStoreNode.store(o, offset, x, CiKind.Double);
+    }
+
+    public void putDoubleVolatile(Object o, long offset, double x) {
+        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
+        putDouble(o, offset, x);
+        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/target/amd64/AMD64TailcallOp.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2011, 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.hotspot.target.amd64;
+
+import static com.oracle.max.cri.ci.CiValueUtil.*;
+
+import java.util.*;
+
+import com.oracle.max.asm.target.amd64.*;
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.graal.compiler.asm.*;
+import com.oracle.max.graal.compiler.lir.*;
+import com.oracle.max.graal.compiler.target.amd64.*;
+import com.oracle.max.graal.compiler.util.*;
+
+/**
+ * Performs a hard-coded tail call to the specified target, which normally should be an RiCompiledCode instance.
+ */
+public class AMD64TailcallOp extends AMD64LIRInstruction {
+
+    public AMD64TailcallOp(List<CiValue> parameters, CiValue target, CiValue[] callingConvention) {
+        super("TAILCALL", LIRInstruction.NO_OPERANDS, null, toArray(parameters, target), LIRInstruction.NO_OPERANDS, callingConvention.clone());
+        assert inputs.length == temps.length + 1;
+
+        for (int i = 0; i < temps.length; i++) {
+            assert isRegister(temps[i]) : "too many parameters for tail call";
+            assert sameRegister(temps[i], inputs[i]) : "inputs do not match calling convention";
+        }
+    }
+
+    private static CiValue[] toArray(List<CiValue> parameters, CiValue target) {
+        CiValue[] result = new CiValue[parameters.size() + 1];
+        parameters.toArray(result);
+        result[parameters.size()] = target;
+        return result;
+    }
+
+    @Override
+    public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+        // destroy the current frame (now the return address is the top of stack)
+        masm.leave();
+
+        // jump to the target method
+        masm.jmp(asRegister(inputs[inputs.length - 1]));
+        masm.ensureUniquePC();
+    }
+
+    @Override
+    protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+        if (mode == OperandMode.Input) {
+            return EnumSet.of(OperandFlag.Register);
+        } else if (mode == OperandMode.Temp) {
+            return EnumSet.of(OperandFlag.Register);
+        }
+        throw Util.shouldNotReachHere();
+    }
+}
--- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/BlockMap.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/BlockMap.java	Thu Feb 02 16:07:52 2012 -0800
@@ -582,7 +582,7 @@
                 throw new CiBailout("Loop formed by an exception handler");
             }
             if (nextLoop >= Long.SIZE) {
-                // This restriction can be removed by using a fall-back to a BitSet in case we have more than 32 loops
+                // This restriction can be removed by using a fall-back to a BitSet in case we have more than 64 loops
                 // Don't compile such methods for now, until we see a concrete case that allows checking for correctness.
                 throw new CiBailout("Too many loops in method");
             }
--- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderConfiguration.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderConfiguration.java	Thu Feb 02 16:07:52 2012 -0800
@@ -26,13 +26,18 @@
 import com.oracle.max.graal.compiler.phases.*;
 
 public class GraphBuilderConfiguration {
+
+    public static enum ResolvePolicy {
+        Default, EagerForSnippets, Eager,
+    }
+
     private final boolean useBranchPrediction;
-    private final boolean eagerResolving;
+    private final ResolvePolicy resolving;
     private final PhasePlan plan;
 
-    public GraphBuilderConfiguration(boolean useBranchPrediction, boolean eagerResolving, PhasePlan plan) {
+    public GraphBuilderConfiguration(boolean useBranchPrediction, ResolvePolicy resolving, PhasePlan plan) {
         this.useBranchPrediction = useBranchPrediction;
-        this.eagerResolving = eagerResolving;
+        this.resolving = resolving;
         this.plan = plan;
     }
 
@@ -40,8 +45,12 @@
         return useBranchPrediction;
     }
 
+    public boolean eagerResolvingForSnippets() {
+        return (resolving == ResolvePolicy.EagerForSnippets || resolving == ResolvePolicy.Eager);
+    }
+
     public boolean eagerResolving() {
-        return eagerResolving;
+        return (resolving == ResolvePolicy.Eager);
     }
 
     public PhasePlan plan() {
@@ -53,14 +62,14 @@
     }
 
     public static GraphBuilderConfiguration getDefault(PhasePlan plan) {
-        return new GraphBuilderConfiguration(GraalOptions.UseBranchPrediction, false, plan);
+        return new GraphBuilderConfiguration(GraalOptions.UseBranchPrediction, ResolvePolicy.Default, plan);
     }
 
-    public static GraphBuilderConfiguration getDeoptFreeDefault() {
-        return getDeoptFreeDefault(null);
+    public static GraphBuilderConfiguration getSnippetDefault() {
+        return getSnippetDefault(null);
     }
 
-    public static GraphBuilderConfiguration getDeoptFreeDefault(PhasePlan plan) {
-        return new GraphBuilderConfiguration(false, true, plan);
+    public static GraphBuilderConfiguration getSnippetDefault(PhasePlan plan) {
+        return new GraphBuilderConfiguration(false, ResolvePolicy.EagerForSnippets, plan);
     }
 }
--- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java	Thu Feb 02 16:07:52 2012 -0800
@@ -30,18 +30,20 @@
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
-import com.oracle.max.cri.ri.RiType.*;
+import com.oracle.max.cri.ri.RiType.Representation;
 import com.oracle.max.criutils.*;
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.phases.*;
 import com.oracle.max.graal.compiler.schedule.*;
 import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
-import com.oracle.max.graal.java.BlockMap.*;
+import com.oracle.max.graal.java.BlockMap.Block;
+import com.oracle.max.graal.java.BlockMap.DeoptBlock;
+import com.oracle.max.graal.java.BlockMap.ExceptionBlock;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.DeoptimizeNode.DeoptAction;
 import com.oracle.max.graal.nodes.PhiNode.PhiType;
-import com.oracle.max.graal.java.BlockMap.Block;
 import com.oracle.max.graal.nodes.calc.*;
 import com.oracle.max.graal.nodes.extended.*;
 import com.oracle.max.graal.nodes.java.*;
@@ -139,12 +141,12 @@
     private BlockMap createBlockMap() {
         BlockMap map = new BlockMap(method, config.useBranchPrediction());
         map.build();
-        currentContext.metrics.bytecodeCount += method.code().length;
 
-        if (currentContext.isObserved()) {
-            String label = CiUtil.format("BlockListBuilder %f %R %H.%n(%P)", method);
-            currentContext.observable.fireCompilationEvent(label, map);
-        }
+//        if (currentContext.isObserved()) {
+//            String label = CiUtil.format("BlockListBuilder %f %R %H.%n(%P)", method);
+//            currentContext.observable.fireCompilationEvent(label, map);
+//        }
+        // TODO(tw): Reinstall this logging code when debug framework is finished.
         return map;
     }
 
@@ -159,7 +161,6 @@
         this.canTrapBitSet = blockMap.canTrap;
 
         exceptionHandlers = blockMap.exceptionHandlers();
-        currentContext.metrics.blockCount += blockMap.blocks.size();
 
         nextBlockNumber = blockMap.blocks.size();
 
@@ -201,7 +202,6 @@
     }
 
     private int nextBlockNumber() {
-        currentContext.metrics.blockCount++;
         return nextBlockNumber++;
     }
 
@@ -383,8 +383,8 @@
         return p;
     }
 
-    private void genLoadConstant(int cpi) {
-        Object con = constantPool.lookupConstant(cpi);
+    private void genLoadConstant(int cpi, int opcode) {
+        Object con = lookupConstant(cpi, opcode);
 
         if (con instanceof RiType) {
             // this is a load of class constant which might be unresolved
@@ -607,9 +607,7 @@
         assert !x.isDeleted() && !y.isDeleted();
         double probability = profilingInfo.getBranchTakenProbability(bci());
         if (probability < 0) {
-            if (GraalOptions.TraceProbability) {
-                TTY.println("missing probability in " + method + " at bci " + bci());
-            }
+            Debug.log("missing probability in %s at bci %d", method, bci());
             probability = 0.5;
         }
 
@@ -652,23 +650,30 @@
     }
 
     private RiType lookupType(int cpi, int bytecode) {
-        eagerResolving(cpi, bytecode);
+        eagerResolvingForSnippets(cpi, bytecode);
         RiType result = constantPool.lookupType(cpi, bytecode);
-        assert !config.eagerResolving() || result instanceof RiResolvedType;
+        assert !config.eagerResolvingForSnippets() || result instanceof RiResolvedType;
         return result;
     }
 
     private RiMethod lookupMethod(int cpi, int opcode) {
-        eagerResolving(cpi, opcode);
+        eagerResolvingForSnippets(cpi, opcode);
         RiMethod result = constantPool.lookupMethod(cpi, opcode);
-        assert !config.eagerResolving() || ((result instanceof RiResolvedMethod) && ((RiResolvedMethod) result).holder().isInitialized());
+        assert !config.eagerResolvingForSnippets() || ((result instanceof RiResolvedMethod) && ((RiResolvedMethod) result).holder().isInitialized());
         return result;
     }
 
     private RiField lookupField(int cpi, int opcode) {
-        eagerResolving(cpi, opcode);
+        eagerResolvingForSnippets(cpi, opcode);
         RiField result = constantPool.lookupField(cpi, opcode);
-        assert !config.eagerResolving() || (result instanceof RiResolvedField && ((RiResolvedField) result).holder().isInitialized());
+        assert !config.eagerResolvingForSnippets() || (result instanceof RiResolvedField && ((RiResolvedField) result).holder().isInitialized());
+        return result;
+    }
+
+    private Object lookupConstant(int cpi, int opcode) {
+        eagerResolving(cpi, opcode);
+        Object result = constantPool.lookupConstant(cpi);
+        assert !config.eagerResolving() || !(result instanceof RiType) || (result instanceof RiResolvedType);
         return result;
     }
 
@@ -678,6 +683,12 @@
         }
     }
 
+    private void eagerResolvingForSnippets(int cpi, int bytecode) {
+        if (config.eagerResolvingForSnippets()) {
+            constantPool.loadReferencedType(cpi, bytecode);
+        }
+    }
+
     private void genCheckCast() {
         int cpi = stream().readCPI();
         RiType type = lookupType(cpi, CHECKCAST);
@@ -700,11 +711,16 @@
     private void genInstanceOf() {
         int cpi = stream().readCPI();
         RiType type = lookupType(cpi, INSTANCEOF);
-        ConstantNode typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, type instanceof RiResolvedType);
         ValueNode object = frameState.apop();
-        if (typeInstruction != null) {
-            frameState.ipush(append(MaterializeNode.create(currentGraph.unique(new InstanceOfNode(typeInstruction, (RiResolvedType) type, object, false)), currentGraph)));
+        if (type instanceof RiResolvedType) {
+            ConstantNode hub = appendConstant(((RiResolvedType) type).getEncoding(RiType.Representation.ObjectHub));
+            frameState.ipush(append(MaterializeNode.create(currentGraph.unique(new InstanceOfNode(hub, (RiResolvedType) type, object, false)), currentGraph)));
         } else {
+            PlaceholderNode trueSucc = currentGraph.add(new PlaceholderNode());
+            DeoptimizeNode deopt = currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile));
+            IfNode ifNode = currentGraph.add(new IfNode(currentGraph.unique(new NullCheckNode(object, true)), trueSucc, deopt, 1));
+            append(ifNode);
+            lastInstr = trueSucc;
             frameState.ipush(appendConstant(CiConstant.INT_0));
         }
     }
@@ -875,9 +891,7 @@
             } else {
                 exception.exceptionEdge.setNext(createTarget(unwindBlock(bci()), frameState.duplicateWithException(bci(), exception.exception)));
             }
-            if (GraalOptions.Meter) {
-                currentContext.metrics.ExplicitExceptions++;
-            }
+            Debug.metric("ExplicitExceptions").increment();
         }
     }
 
@@ -1142,9 +1156,7 @@
         if (prob != null) {
             assert prob.length == numberOfCases;
         } else {
-            if (GraalOptions.TraceProbability) {
-                TTY.println("Missing probability (switch) in " + method + " at bci " + bci);
-            }
+            Debug.log("Missing probability (switch) in %s at bci %d", method, bci);
             prob = new double[numberOfCases];
             for (int i = 0; i < numberOfCases; i++) {
                 prob[i] = 1.0d / numberOfCases;
@@ -1388,6 +1400,9 @@
             assert frameState.stackSize() == 1 : frameState;
 
             RiType catchType = block.handler.catchType();
+            if (config.eagerResolving()) {
+                catchType = lookupType(block.handler.catchTypeCPI(), INSTANCEOF);
+            }
             ConstantNode typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, catchType, (catchType instanceof RiResolvedType) && ((RiResolvedType) catchType).isInitialized());
             if (typeInstruction != null) {
                 Block nextBlock = block.successors.size() == 1 ? unwindBlock(block.deoptBci) : block.successors.get(1);
@@ -1485,7 +1500,7 @@
             case SIPUSH         : frameState.ipush(appendConstant(CiConstant.forInt(stream.readShort()))); break;
             case LDC            : // fall through
             case LDC_W          : // fall through
-            case LDC2_W         : genLoadConstant(stream.readCPI()); break;
+            case LDC2_W         : genLoadConstant(stream.readCPI(), opcode); break;
             case ILOAD          : loadLocal(stream.readLocalIndex(), CiKind.Int); break;
             case LLOAD          : loadLocal(stream.readLocalIndex(), CiKind.Long); break;
             case FLOAD          : loadLocal(stream.readLocalIndex(), CiKind.Float); break;
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/ConstantNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/ConstantNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -33,11 +33,11 @@
  * long, float, object reference, address, etc.
  */
 @NodeInfo(shortName = "Const")
-public final class ConstantNode extends BooleanNode implements LIRLowerable {
+public class ConstantNode extends BooleanNode implements LIRLowerable {
 
     @Data public final CiConstant value;
 
-    private ConstantNode(CiConstant value) {
+    protected ConstantNode(CiConstant value) {
         this(value, null);
     }
 
@@ -45,7 +45,7 @@
      * Constructs a new ConstantNode representing the specified constant.
      * @param value the constant
      */
-    private ConstantNode(CiConstant value, RiRuntime runtime) {
+    protected ConstantNode(CiConstant value, RiRuntime runtime) {
         super(StampFactory.forConstant(value, runtime));
         this.value = value;
     }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/EndNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/EndNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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/FixedGuardNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FixedGuardNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -61,10 +61,10 @@
                     conditions.remove(n);
                 } else {
                     FixedNode next = this.next();
-                    setNext(graph().add(new DeoptimizeNode(DeoptAction.InvalidateRecompile)));
                     if (next != null) {
                         tool.deleteBranch(next);
                     }
+                    setNext(graph().add(new DeoptimizeNode(DeoptAction.InvalidateRecompile)));
                     return;
                 }
             }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FrameState.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FrameState.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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.*;
@@ -74,27 +75,6 @@
 
     @Input private final NodeInputList<Node> virtualObjectMappings;
 
-    public FrameState outerFrameState() {
-        return outerFrameState;
-    }
-
-    public void setOuterFrameState(FrameState x) {
-        updateUsages(this.outerFrameState, x);
-        this.outerFrameState = x;
-    }
-
-    public FrameState outermostFrameState() {
-        FrameState fs = this;
-        while (fs.outerFrameState() != null) {
-            fs = fs.outerFrameState();
-        }
-        return fs;
-    }
-
-    public void setValueAt(int i, ValueNode x) {
-        values.set(i, x);
-    }
-
     /**
      * The bytecode index to which this frame state applies. This will be {@code -1}
      * iff this state is mutable.
@@ -142,6 +122,27 @@
         assert !rethrowException || stackSize == 1 : "must have exception on top of the stack";
     }
 
+    public FrameState outerFrameState() {
+        return outerFrameState;
+    }
+
+    public void setOuterFrameState(FrameState x) {
+        updateUsages(this.outerFrameState, x);
+        this.outerFrameState = x;
+    }
+
+    public FrameState outermostFrameState() {
+        FrameState fs = this;
+        while (fs.outerFrameState() != null) {
+            fs = fs.outerFrameState();
+        }
+        return fs;
+    }
+
+    public void setValueAt(int i, ValueNode x) {
+        values.set(i, x);
+    }
+
     public boolean rethrowException() {
         return rethrowException;
     }
@@ -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/IfNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/IfNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -86,7 +86,7 @@
      * @param istrue {@code true} if the true successor is requested, {@code false} otherwise
      * @return the corresponding successor
      */
-    public FixedNode successor(boolean istrue) {
+    public BeginNode successor(boolean istrue) {
         return blockSuccessor(istrue ? 0 : 1);
     }
 
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/LoopBeginNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/LoopBeginNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,9 +24,7 @@
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.graal.graph.*;
-import com.oracle.max.graal.nodes.loop.*;
 import com.oracle.max.graal.nodes.spi.*;
 
 
@@ -47,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
@@ -85,47 +78,15 @@
         throw ValueUtil.shouldNotReachHere();
     }
 
-    public Collection<InductionVariableNode> inductionVariables() {
-        // TODO (gd) produces useless garbage
-        List<InductionVariableNode> list = new LinkedList<>();
-        collectInductionVariables(this, list);
-        return list;
-    }
-
-    private static void collectInductionVariables(Node node, Collection<InductionVariableNode> collection) {
-        for (InductionVariableNode iv : node.usages().filter(InductionVariableNode.class)) {
-            collection.add(iv);
-            collectInductionVariables(iv, collection);
-        }
-    }
-
-    @Override
-    public Iterable<? extends Node> phiPredecessors() {
-        return Arrays.asList(new Node[]{this.forwardEdge(), this.loopEnd()});
-    }
-
     public EndNode forwardEdge() {
         return this.endAt(0);
     }
 
-    public LoopCounterNode loopCounter() {
-        return loopCounter(CiKind.Long);
-    }
-
-    public LoopCounterNode loopCounter(CiKind kind) {
-        for (LoopCounterNode counter : usages().filter(LoopCounterNode.class)) {
-            if (counter.kind() == kind) {
-                return counter;
-            }
-        }
-        return graph().add(new LoopCounterNode(kind, this));
-    }
-
     @Override
     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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/MergeNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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/StructuredGraph.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/StructuredGraph.java	Thu Feb 02 16:07:52 2012 -0800
@@ -28,6 +28,7 @@
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.calc.*;
 import com.oracle.max.graal.nodes.java.*;
+import com.oracle.max.graal.nodes.util.*;
 
 
 /**
@@ -172,6 +173,7 @@
 
     public void replaceFixedWithFixed(FixedWithNextNode node, FixedWithNextNode replacement) {
         assert node != null && replacement != null && node.isAlive() && replacement.isAlive() : "cannot replace " + node + " with " + replacement;
+        replacement.setProbability(node.probability());
         FixedNode next = node.next();
         node.setNext(null);
         replacement.setNext(next);
@@ -191,12 +193,38 @@
         assert node != null;
         assert node.usages().isEmpty();
         assert survivingSuccessor >= 0 && survivingSuccessor < node.blockSuccessorCount() : "invalid surviving successor " + survivingSuccessor + " for " + node;
-        FixedNode next = node.blockSuccessor(survivingSuccessor);
+        BeginNode begin = node.blockSuccessor(survivingSuccessor);
+        FixedNode next = begin.next();
+        begin.setNext(null);
         for (int i = 0; i < node.blockSuccessorCount(); i++) {
             node.setBlockSuccessor(i, null);
         }
         node.replaceAtPredecessors(next);
         node.safeDelete();
+        begin.safeDelete();
+    }
+
+    public void removeSplitPropagate(ControlSplitNode node, int survivingSuccessor) {
+        assert node != null;
+        assert node.usages().isEmpty();
+        assert survivingSuccessor >= 0 && survivingSuccessor < node.blockSuccessorCount() : "invalid surviving successor " + survivingSuccessor + " for " + node;
+        BeginNode begin = node.blockSuccessor(survivingSuccessor);
+        FixedNode next = begin.next();
+        begin.setNext(null);
+        for (int i = 0; i < node.blockSuccessorCount(); i++) {
+            BeginNode successor = node.blockSuccessor(i);
+            node.setBlockSuccessor(i, null);
+            if (successor != begin && successor.isAlive()) {
+                GraphUtil.killCFG(successor);
+            }
+        }
+        if (next.isAlive()) {
+            node.replaceAtPredecessors(next);
+            node.safeDelete();
+            begin.safeDelete();
+        } else {
+            assert node.isDeleted();
+        }
     }
 
     public void replaceSplit(ControlSplitNode node, Node replacement, int survivingSuccessor) {
@@ -212,29 +240,36 @@
     public void replaceSplitWithFixed(ControlSplitNode node, FixedWithNextNode replacement, int survivingSuccessor) {
         assert node != null && replacement != null && node.isAlive() && replacement.isAlive() : "cannot replace " + node + " with " + replacement;
         assert survivingSuccessor >= 0 && survivingSuccessor < node.blockSuccessorCount() : "invalid surviving successor " + survivingSuccessor + " for " + node;
-        FixedNode next = node.blockSuccessor(survivingSuccessor);
+        BeginNode begin = node.blockSuccessor(survivingSuccessor);
+        FixedNode next = begin.next();
+        begin.setNext(null);
         for (int i = 0; i < node.blockSuccessorCount(); i++) {
             node.setBlockSuccessor(i, null);
         }
         replacement.setNext(next);
         node.replaceAndDelete(replacement);
+        begin.safeDelete();
     }
 
     public void replaceSplitWithFloating(ControlSplitNode node, FloatingNode replacement, int survivingSuccessor) {
         assert node != null && replacement != null && node.isAlive() && replacement.isAlive() : "cannot replace " + node + " with " + replacement;
         assert survivingSuccessor >= 0 && survivingSuccessor < node.blockSuccessorCount() : "invalid surviving successor " + survivingSuccessor + " for " + node;
-        FixedNode next = node.blockSuccessor(survivingSuccessor);
+        BeginNode begin = node.blockSuccessor(survivingSuccessor);
+        FixedNode next = begin.next();
+        begin.setNext(null);
         for (int i = 0; i < node.blockSuccessorCount(); i++) {
             node.setBlockSuccessor(i, null);
         }
         node.replaceAtPredecessors(next);
         node.replaceAtUsages(replacement);
         node.safeDelete();
+        begin.safeDelete();
     }
 
     public void addAfterFixed(FixedWithNextNode node, FixedWithNextNode newNode) {
         assert node != null && newNode != null && node.isAlive() && newNode.isAlive() : "cannot add " + newNode + " after " + node;
         assert newNode.next() == null;
+        newNode.setProbability(node.probability());
         FixedNode next = node.next();
         node.setNext(newNode);
         newNode.setNext(next);
@@ -244,6 +279,7 @@
         assert node != null && newNode != null && node.isAlive() && newNode.isAlive() : "cannot add " + newNode + " before " + node;
         assert node.predecessor() != null && node.predecessor() instanceof FixedWithNextNode : "cannot add " + newNode + " before " + node;
         assert newNode.next() == null;
+        newNode.setProbability(node.probability());
         FixedWithNextNode pred = (FixedWithNextNode) node.predecessor();
         pred.setNext(newNode);
         newNode.setNext(node);
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/LookupSwitchNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/LookupSwitchNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -41,6 +41,7 @@
      */
     public LookupSwitchNode(ValueNode value, BeginNode[] successors, int[] keys, double[] probability) {
         super(value, successors, probability);
+        assert successors.length == keys.length + 1;
         this.keys = keys;
     }
 
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/InstanceOfNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/InstanceOfNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -34,7 +34,11 @@
  */
 public final class InstanceOfNode extends TypeCheckNode implements Canonicalizable, LIRLowerable {
 
-    @Data public final boolean negated;
+    @Data private final boolean negated;
+
+    public boolean negated() {
+        return negated;
+    }
 
     /**
      * Constructs a new InstanceOfNode.
@@ -71,8 +75,7 @@
             if (constant.isNull()) {
                 return ConstantNode.forBoolean(negated, graph());
             } else {
-                // this should never happen - non-null constants are always expected to provide an exactType
-                assert false;
+                assert false : "non-null constants are always expected to provide an exactType";
             }
         }
         return this;
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/MethodCallTargetNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/MethodCallTargetNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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/loop/BasicInductionVariableNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +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.nodes.loop;
-
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.nodes.*;
-import com.oracle.max.graal.nodes.PhiNode.PhiType;
-import com.oracle.max.graal.nodes.calc.*;
-import com.oracle.max.graal.nodes.spi.*;
-
-/**
- * LinearInductionVariable that is computed in the loops thanks to Phi(init, this + stride).
- * This will keep at least one register busy in the whole loop body
- */
-public class BasicInductionVariableNode extends LinearInductionVariableNode implements Canonicalizable {
-
-    @Input private LoopCounterNode loopCounter;
-
-    public BasicInductionVariableNode(CiKind kind, ValueNode init, ValueNode stride, LoopCounterNode loopCounter) {
-        super(kind, stride, init);
-        this.loopCounter = loopCounter;
-    }
-
-    public LoopCounterNode loopCounter() {
-        return loopCounter;
-    }
-
-    public ValueNode init() {
-        return b();
-    }
-
-    public void setInit(ValueNode init) {
-        setB(init);
-    }
-
-    @Override
-    public ValueNode stride() {
-        return a();
-    }
-
-    public void setStride(ValueNode stride) {
-        setA(stride);
-    }
-
-    @Override
-    public LoopBeginNode loopBegin() {
-        return loopCounter().loopBegin();
-    }
-
-    @Override
-    public void peelOneIteration() {
-        this.setInit(IntegerArithmeticNode.add(init(), stride()));
-    }
-
-    /**
-     * Will lessen the register pressure but augment the code complexity with a multiplication.
-     * @return the new DerivedInductionVariable
-     */
-    public DerivedInductionVariableNode toDerivedInductionVariable() {
-        DerivedInductionVariableNode newDIV = graph().add(new DerivedInductionVariableNode(kind(), init(), stride(), loopCounter()));
-        ((StructuredGraph) graph()).replaceFloating(this, newDIV);
-        return newDIV;
-    }
-
-    @Override
-    public ValueNode canonical(CanonicalizerTool tool) {
-        if (this.init().isConstant() && this.init().asConstant().asLong() == 0 && this.stride().isConstant() && this.stride().asConstant().asLong() == 1) {
-            return this.loopCounter();
-        }
-        return this;
-    }
-
-    @Override
-    public ValueNode lowerInductionVariable() {
-        return ivToPhi(loopBegin(), init(), stride(), kind());
-    }
-
-    @Override
-    public boolean isNextIteration(InductionVariableNode other) {
-        if (other instanceof LoopCounterNode && this.loopCounter() == other) {
-            if (this.init().isConstant() && this.init().asConstant().asLong() == -1 && this.stride().isConstant() && this.stride().asConstant().asLong() == 1) {
-                return true;
-            }
-        } else if (other instanceof LinearInductionVariableNode) {
-            if ((other instanceof BasicInductionVariableNode && ((BasicInductionVariableNode) other).loopCounter() == loopCounter())
-                            || (other instanceof DerivedInductionVariableNode && ((DerivedInductionVariableNode) other).base() == loopCounter())) {
-                LinearInductionVariableNode liv = (LinearInductionVariableNode) other;
-                if (liv.a() == stride() && IntegerAddNode.isIntegerAddition(liv.b(), init(), stride())) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    public static PhiNode ivToPhi(LoopBeginNode loopBegin, ValueNode init, ValueNode stride, CiKind kind) {
-        PhiNode phi = loopBegin.graph().add(new PhiNode(kind, loopBegin, PhiType.Value));
-        IntegerArithmeticNode after = IntegerArithmeticNode.add(phi, stride);
-        phi.addInput(init);
-        phi.addInput(after);
-        return phi;
-    }
-
-    @Override
-    public StrideDirection strideDirection() {
-        ValueNode stride = stride();
-        if (stride.isConstant()) {
-            long val = stride.asConstant().asLong();
-            if (val > 0) {
-                return StrideDirection.Up;
-            }
-            if (val < 0) {
-                return StrideDirection.Down;
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public ValueNode minValue(FixedNode point) {
-        StrideDirection strideDirection = strideDirection();
-        if (strideDirection == StrideDirection.Up) {
-            return init();
-        } else if (strideDirection == StrideDirection.Down) {
-            return searchExtremum(point, StrideDirection.Down);
-        }
-        return null;
-    }
-
-    @Override
-    public ValueNode maxValue(FixedNode point) {
-        StrideDirection strideDirection = strideDirection();
-        if (strideDirection == StrideDirection.Down) {
-            return init();
-        } else if (strideDirection == StrideDirection.Up) {
-            return searchExtremum(point, StrideDirection.Up);
-        }
-        return null;
-    }
-}
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/DerivedInductionVariableNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +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.nodes.loop;
-
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.nodes.*;
-import com.oracle.max.graal.nodes.calc.*;
-import com.oracle.max.graal.nodes.spi.*;
-
-/**
- * LinearInductionVariable that is computed in the loops with offset + scale * base.
- * This is computed in the loop only when necessary, puts less pressure on registers.
- */
-public class DerivedInductionVariableNode extends LinearInductionVariableNode  implements Canonicalizable {
-
-    @Input private InductionVariableNode base;
-
-    public DerivedInductionVariableNode(CiKind kind, ValueNode offset, ValueNode scale, InductionVariableNode base) {
-        super(kind, scale, offset);
-        this.base = base;
-    }
-
-    public InductionVariableNode base() {
-        return base;
-    }
-
-    public ValueNode offset() {
-        return b();
-    }
-
-    public void setOffset(ValueNode offset) {
-        setB(offset);
-    }
-
-    public ValueNode scale() {
-        return a();
-    }
-
-    public void setScale(ValueNode scale) {
-        setA(scale);
-    }
-
-    @Override
-    public LoopBeginNode loopBegin() {
-        return base().loopBegin();
-    }
-
-    @Override
-    public void peelOneIteration() {
-        // nop
-    }
-
-    /**
-     * This will apply strength reduction to this induction variable but will augment register pressure in the loop.
-     * @return the new BasicInductionVariable
-     */
-    public BasicInductionVariableNode toBasicInductionVariable() {
-        InductionVariableNode b = base();
-        if (b instanceof DerivedInductionVariableNode) {
-            b = ((DerivedInductionVariableNode) b).toBasicInductionVariable();
-        }
-        ValueNode init;
-        ValueNode stride;
-        LoopCounterNode counter;
-        if (b instanceof BasicInductionVariableNode) {
-            BasicInductionVariableNode basic = (BasicInductionVariableNode) b;
-            // let the canonicalizer do its job with this
-            init = IntegerArithmeticNode.add(offset(), IntegerArithmeticNode.mul(scale(), basic.init()));
-            stride = IntegerArithmeticNode.mul(scale(), basic.stride());
-            counter = basic.loopCounter();
-        } else {
-            assert b instanceof LoopCounterNode;
-            init = offset();
-            stride = scale();
-            counter = (LoopCounterNode) b;
-        }
-        BasicInductionVariableNode newBIV = graph().add(new BasicInductionVariableNode(kind(), init, stride, counter));
-        ((StructuredGraph) graph()).replaceFloating(this, newBIV);
-        return newBIV;
-    }
-
-    @Override
-    public ValueNode lowerInductionVariable() {
-        return IntegerArithmeticNode.add(offset(), IntegerArithmeticNode.mul(scale(), base()));
-    }
-
-    @Override
-    public ValueNode canonical(CanonicalizerTool tool) {
-        if (base() instanceof DerivedInductionVariableNode) {
-            DerivedInductionVariableNode divBase = (DerivedInductionVariableNode) base();
-            IntegerArithmeticNode newOffset = IntegerArithmeticNode.add(offset(), IntegerArithmeticNode.mul(scale(), divBase.offset()));
-            IntegerArithmeticNode newScale = IntegerArithmeticNode.mul(scale(), divBase.scale());
-            return graph().add(new DerivedInductionVariableNode(kind(), newOffset, newScale, divBase.base()));
-        }
-        return this;
-    }
-
-    @Override
-    public boolean isNextIteration(InductionVariableNode other) {
-        if (other instanceof LoopCounterNode && this.base() == other) {
-            if (this.offset().isConstant() && this.offset().asConstant().asLong() == -1 && this.scale().isConstant() && this.scale().asConstant().asLong() == 1) {
-                return true;
-            }
-        } else if (other instanceof LinearInductionVariableNode) {
-            if ((other instanceof BasicInductionVariableNode && ((BasicInductionVariableNode) other).loopCounter() == base())
-                            || (other instanceof DerivedInductionVariableNode && ((DerivedInductionVariableNode) other).base() == base())) {
-                LinearInductionVariableNode liv = (LinearInductionVariableNode) other;
-                if (liv.a() == scale() && IntegerAddNode.isIntegerAddition(liv.b(), offset(), scale())) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public StrideDirection strideDirection() {
-        switch (scaleDirection()) {
-            case Up:
-                return base().strideDirection();
-            case Down:
-                return StrideDirection.opposite(base().strideDirection());
-        }
-        return null;
-    }
-
-    public StrideDirection scaleDirection() {
-        ValueNode stride = scale();
-        if (stride.isConstant()) {
-            long val = stride.asConstant().asLong();
-            if (val > 0) {
-                return StrideDirection.Up;
-            }
-            if (val < 0) {
-                return StrideDirection.Down;
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public ValueNode stride() {
-        return IntegerArithmeticNode.mul(scale(), base().stride());
-    }
-
-    @Override
-    public ValueNode minValue(FixedNode point) {
-        StrideDirection strideDirection = strideDirection();
-        if (strideDirection == StrideDirection.Up) {
-            StrideDirection scaleDirection = scaleDirection();
-            if (scaleDirection == StrideDirection.Up) {
-                ValueNode baseMinValue = base().minValue(point);
-                if (baseMinValue != null) {
-                    return IntegerArithmeticNode.add(offset(), IntegerArithmeticNode.mul(scale(), baseMinValue));
-                }
-            } else if (scaleDirection == StrideDirection.Down) {
-                ValueNode baseMaxValue = base().maxValue(point);
-                if (baseMaxValue != null) {
-                    return IntegerArithmeticNode.add(offset(), IntegerArithmeticNode.mul(scale(), baseMaxValue));
-                }
-            }
-        } else if (strideDirection == StrideDirection.Down) {
-            return searchExtremum(point, StrideDirection.Down);
-        }
-        return null;
-    }
-
-    @Override
-    public ValueNode maxValue(FixedNode point) {
-        StrideDirection strideDirection = strideDirection();
-        if (strideDirection == StrideDirection.Down) {
-            StrideDirection scaleDirection = scaleDirection();
-            if (scaleDirection == StrideDirection.Up) {
-                ValueNode baseMaxValue = base().maxValue(point);
-                if (baseMaxValue != null) {
-                    return IntegerArithmeticNode.add(offset(), IntegerArithmeticNode.mul(scale(), baseMaxValue));
-                }
-            } else if (scaleDirection == StrideDirection.Down) {
-                ValueNode baseMinValue = base().minValue(point);
-                if (baseMinValue != null) {
-                    return IntegerArithmeticNode.add(offset(), IntegerArithmeticNode.mul(scale(), baseMinValue));
-                }
-            }
-        } else if (strideDirection == StrideDirection.Up) {
-            return searchExtremum(point, StrideDirection.Up);
-        }
-        return null;
-    }
-}
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/InductionVariableNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +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.nodes.loop;
-
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.nodes.*;
-import com.oracle.max.graal.nodes.calc.*;
-import com.oracle.max.graal.nodes.type.*;
-import com.oracle.max.graal.util.*;
-
-/**
- * This is a base class for all induction variables nodes.
- */
-public abstract class InductionVariableNode extends FloatingNode {
-
-    public static enum StrideDirection {
-        Up,
-        Down;
-
-        public static StrideDirection opposite(StrideDirection d) {
-            if (d == Up) {
-                return Down;
-            }
-            if (d == Down) {
-                return Up;
-            }
-            return null;
-        }
-    }
-
-    public InductionVariableNode(CiKind kind) {
-        super(StampFactory.forKind(kind));
-        assert kind.isInt() || kind.isLong();
-    }
-
-    /**
-     * Retruns the loopBeginNode corresponding to the loop this induction variables is attached to.
-     * @return the loopBeginNode corresponding to the loop this induction variables is attached to.
-     */
-    public abstract LoopBeginNode loopBegin();
-
-    /**
-     * This will make the induction be initialized with the value it should have had on the second iteration of the loop.
-     */
-    public abstract void peelOneIteration();
-
-    /**
-     * Transforms this induction variable to generic nodes (Phis, arithmetics...).
-     * @return the generic node that computes the value of this induction variables.
-     */
-    public abstract ValueNode lowerInductionVariable();
-
-    /**
-     * Checks if the provided induction variable is the value that this induction variable will have on the next iteration.
-     * @param other the induction variable this check should run against
-     * @return true if the provided induction variable is the value that this induction variable will have on the next iteration.
-     */
-    public abstract boolean isNextIteration(InductionVariableNode other);
-
-    /**
-     * Tries to statically find the minimum value that this induction variable can have over all possible iterations at a specific {@code point} in the CFG.
-     * @param point the point in the CFG from which static information will be collected
-     * @return the minimum value if it could be found, null otherwise
-     */
-    public abstract ValueNode minValue(FixedNode point);
-
-    /**
-     * Tries to statically find the maximum value that this induction variable can have over all possible iterations at a specific {@code point} in the CFG.
-     * @param point the point in the CFG from which static information will be collected
-     * @return the maximum value if it could be found, null otherwise
-     */
-    public abstract ValueNode maxValue(FixedNode point);
-
-    /**
-     * Tries to statically find the direction of this induction variable.
-     * @return returns {@link StrideDirection#Up Up} if this variable is known to be increasing, {@link StrideDirection#Down Down}  if it is know to decrease, null otherwise.
-     */
-    public abstract StrideDirection strideDirection();
-
-    public abstract ValueNode stride();
-
-    public ValueNode searchExtremum(FixedNode point, StrideDirection direction) {
-        LoopBeginNode upTo = loopBegin();
-        //TODO (gd) collect conditions up the dominating CFG nodes path, stop as soon as we find a matching condition, it will usually be the 'narrowest'
-        FixedNode from = point;
-
-        for (FixedNode node : NodeIterators.dominators(point).until(upTo)) {
-            if (node instanceof IfNode) {
-                IfNode ifNode = (IfNode) node;
-                if (!(ifNode.compare() instanceof CompareNode)) {
-                    continue;
-                }
-                CompareNode compare = (CompareNode) ifNode.compare();
-                ValueNode y = null;
-                Condition cond = null;
-
-                if (from == ifNode.trueSuccessor()) {
-                    cond = compare.condition();
-                } else {
-                    assert from == ifNode.falseSuccessor();
-                    cond = compare.condition().negate();
-                }
-
-                if (compare.x() == this) {
-                    y = compare.y();
-                } else if (compare.y() == this) {
-                    y = compare.x();
-                    cond = cond.mirror();
-                }
-
-                if (y == null || !validConditionAndStrideDirection(cond, direction)) {
-                    continue;
-                }
-
-                return y;
-            }
-            from = node;
-        }
-
-        return null;
-    }
-
-    private static boolean validConditionAndStrideDirection(Condition cond, StrideDirection direction) {
-        if (direction == StrideDirection.Up) {
-            if (cond == Condition.LT || cond == Condition.LE) {
-                return true;
-            }
-        } else if (direction == StrideDirection.Down) {
-            if (cond == Condition.GT || cond == Condition.GE) {
-                return true;
-            }
-        }
-        return false;
-    }
-}
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/LinearInductionVariableNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +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.nodes.loop;
-
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.graph.*;
-import com.oracle.max.graal.nodes.*;
-
-/**
- * InductionVariable of the form a*x+b.
- */
-public abstract class LinearInductionVariableNode extends InductionVariableNode {
-
-    @Input private ValueNode a;
-    @Input private ValueNode b;
-
-    public LinearInductionVariableNode(CiKind kind, ValueNode a, ValueNode b) {
-        super(kind);
-        this.a = a;
-        this.b = b;
-    }
-
-    protected ValueNode a() {
-        return a;
-    }
-
-    protected ValueNode b() {
-        return b;
-    }
-
-    protected void setA(ValueNode a) {
-        updateUsages(this.a, a);
-        this.a = a;
-    }
-
-    protected void setB(ValueNode b) {
-        updateUsages(this.b, b);
-        this.b = b;
-    }
-
-    public boolean isLinearInductionVariableInput(Node n) {
-        return n == a() || n == b();
-    }
-}
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/LoopCounterNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +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.nodes.loop;
-
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.graph.*;
-import com.oracle.max.graal.nodes.*;
-
-/**
- * Counts loop iterations from 0 to Niter.
- * If used directly (and not just by BasicInductionVariables) computed with Phi(0, this + 1)
- */
-public final class LoopCounterNode extends InductionVariableNode {
-    @Input private LoopBeginNode loopBegin;
-
-    @Override
-    public LoopBeginNode loopBegin() {
-        return loopBegin;
-    }
-
-    public LoopCounterNode(CiKind kind, LoopBeginNode loopBegin) {
-        super(kind);
-        this.loopBegin = loopBegin;
-    }
-
-    @Override
-    public void peelOneIteration() {
-        BasicInductionVariableNode biv = null;
-        for (Node usage : usages()) {
-            if (!(usage instanceof InductionVariableNode && ((InductionVariableNode) usage).loopBegin() == this.loopBegin())) {
-                if (biv == null) {
-                    biv = createBasicInductionVariable();
-                    biv.peelOneIteration();
-                }
-                usage.replaceFirstInput(this, biv);
-            }
-        }
-    }
-
-    @Override
-    public ValueNode stride() {
-        return ConstantNode.forIntegerKind(kind(), 1, graph());
-    }
-
-    @Override
-    public ValueNode lowerInductionVariable() {
-        return BasicInductionVariableNode.ivToPhi(loopBegin(), minValue(null), stride(), kind());
-    }
-
-    @Override
-    public boolean isNextIteration(InductionVariableNode other) {
-        if (other instanceof LinearInductionVariableNode) {
-            LinearInductionVariableNode liv = (LinearInductionVariableNode) other;
-            if ((liv instanceof BasicInductionVariableNode && ((BasicInductionVariableNode) liv).loopCounter() == this) || (liv instanceof DerivedInductionVariableNode && ((DerivedInductionVariableNode) liv).base() == this)) {
-                if (liv.a().isConstant() && liv.a().asConstant().asLong() == 1 && liv.b().isConstant() && liv.b().asConstant().asLong() == 1) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public ValueNode minValue(FixedNode point) {
-        return ConstantNode.forIntegerKind(kind(), 0, graph());
-    }
-
-    @Override
-    public ValueNode maxValue(FixedNode point) {
-        return searchExtremum(point, StrideDirection.Up);
-    }
-
-    @Override
-    public StrideDirection strideDirection() {
-        return StrideDirection.Up;
-    }
-
-    private BasicInductionVariableNode createBasicInductionVariable() {
-        return graph().add(new BasicInductionVariableNode(kind(), minValue(null), stride(), this));
-    }
-}
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/spi/EscapeOp.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/spi/EscapeOp.java	Thu Feb 02 16:07:52 2012 -0800
@@ -44,7 +44,7 @@
             assert ((IsTypeNode) usage).objectClass() == 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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/util/NodeIterators.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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/BasicIdealGraphPrinter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/BasicIdealGraphPrinter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -29,12 +29,12 @@
 /**
  * Elementary, generic generator of Ideal Graph Visualizer input for use in printers for specific data structures.
  */
-public class BasicIdealGraphPrinter {
+class BasicIdealGraphPrinter {
 
     /**
      * Edge between two nodes.
      */
-    public static class Edge {
+    protected static class Edge {
         final String from;
         final int fromIndex;
         final String to;
@@ -83,37 +83,41 @@
     /**
      * Creates a new {@link IdealGraphPrinter} that writes to the specified output stream.
      */
-    public BasicIdealGraphPrinter(OutputStream stream) {
-        this.stream = new PrintStream(stream);
+    protected BasicIdealGraphPrinter(OutputStream stream) {
+        try {
+            this.stream = new PrintStream(stream, false, "US-ASCII");
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException(e);
+        }
     }
 
     /**
      * Flushes any buffered output.
      */
-    public void flush() {
+    protected void flush() {
         stream.flush();
     }
 
     /**
      * Starts a new graph document.
      */
-    public void begin() {
+    protected void begin() {
         stream.println("<graphDocument>");
     }
 
-    public void beginGroup() {
+    protected void beginGroup() {
         stream.println("<group>");
     }
 
-    public void beginMethod(String name, String shortName, int bci) {
+    protected void beginMethod(String name, String shortName, int bci) {
         stream.printf(" <method name='%s' shortName='%s' bci='%d'>%n", escape(name), escape(shortName), bci);
     }
 
-    public void beginBytecodes() {
+    protected void beginBytecodes() {
         stream.println("  <bytecodes>\n<![CDATA[");
     }
 
-    public void printBytecode(int bci, String mnemonic, int[] extra) {
+    protected void printBytecode(int bci, String mnemonic, int[] extra) {
         stream.print(bci);
         stream.print(' ');
         stream.print(mnemonic);
@@ -126,31 +130,31 @@
         stream.println();
     }
 
-    public void endBytecodes() {
+    protected void endBytecodes() {
         stream.println("  ]]></bytecodes>");
     }
 
-    public void endMethod() {
+    protected void endMethod() {
         stream.println(" </method>");
     }
 
-    public void beginGraph(String title) {
+    protected void beginGraph(String title) {
         stream.printf(" <graph name='%s'>%n", escape(title));
     }
 
-    public void beginProperties() {
+    protected void beginProperties() {
         stream.print("<properties>");
     }
 
-    public void printProperty(String name, String value) {
+    protected void printProperty(String name, String value) {
         stream.printf("<p name='%s'>%s</p>", escape(name), escape(value));
     }
 
-    public void endProperties() {
+    protected void endProperties() {
         stream.print("</properties>");
     }
 
-    public void printProperties(Map<String, String> properties) {
+    protected void printProperties(Map<String, String> properties) {
         beginProperties();
         for (Entry<String, String> entry : properties.entrySet()) {
             printProperty(entry.getKey(), entry.getValue());
@@ -158,19 +162,19 @@
         endProperties();
     }
 
-    public void beginNodes() {
+    protected void beginNodes() {
         stream.println("  <nodes>");
     }
 
-    public void beginNode(String id) {
+    protected void beginNode(String id) {
         stream.printf("   <node id='%s'>", escape(id));
     }
 
-    public void endNode() {
+    protected void endNode() {
         stream.println("   </node>");
     }
 
-    public void printNode(String id, Map<String, String> properties) {
+    protected void printNode(String id, Map<String, String> properties) {
         beginNode(id);
         if (properties != null) {
             printProperties(properties);
@@ -178,81 +182,87 @@
         endNode();
     }
 
-    public void endNodes() {
+    protected void endNodes() {
         stream.println("  </nodes>");
     }
 
-    public void beginEdges() {
+    protected void beginEdges() {
         stream.println("  <edges>");
     }
 
-    public void printEdge(Edge edge) {
+    protected void printEdge(Edge edge) {
         stream.printf("   <edge from='%s' fromIndex='%d' to='%s' toIndex='%d' label='%s' />%n", escape(edge.from), edge.fromIndex, escape(edge.to), edge.toIndex, escape(edge.label));
     }
 
-    public void endEdges() {
+    protected void endEdges() {
         stream.println("  </edges>");
     }
 
-    public void beginControlFlow() {
+    protected void beginControlFlow() {
         stream.println("  <controlFlow>");
     }
 
-    public void beginBlock(String name) {
+    protected void beginBlock(String name) {
         stream.printf("   <block name='%s'>%n", escape(name));
     }
 
-    public void beginSuccessors() {
+    protected void beginSuccessors() {
         stream.println("    <successors>");
     }
 
-    public void printSuccessor(String name) {
+    protected void printSuccessor(String name) {
         stream.printf("     <successor name='%s'/>%n", escape(name));
     }
 
-    public void endSuccessors() {
+    protected void endSuccessors() {
         stream.println("    </successors>");
     }
 
-    public void beginBlockNodes() {
+    protected void beginBlockNodes() {
         stream.println("    <nodes>");
     }
 
-    public void printBlockNode(String nodeId) {
+    protected void printBlockNode(String nodeId) {
         stream.printf("     <node id='%s'/>%n", escape(nodeId));
     }
 
-    public void endBlockNodes() {
+    protected void endBlockNodes() {
         stream.println("    </nodes>");
     }
 
-    public void endBlock() {
+    protected void endBlock() {
         stream.println("   </block>");
     }
 
-    public void endControlFlow() {
+    protected void endControlFlow() {
         stream.println("  </controlFlow>");
     }
 
-    public void endGraph() {
+    protected void endGraph() {
         stream.println(" </graph>");
     }
 
     /**
      * Ends the current group.
      */
-    public void endGroup() {
+    protected void endGroup() {
         stream.println("</group>");
     }
 
     /**
      * Finishes the graph document and flushes the output stream.
      */
-    public void end() {
+    protected void end() {
         stream.println("</graphDocument>");
         flush();
     }
 
+
+    public boolean isValid() {
+        return !stream.checkError();
+    }
+
+
     private static String escape(String s) {
         StringBuilder str = null;
         for (int i = 0; i < s.length(); i++) {
--- a/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/CFGPrinterObserver.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/CFGPrinterObserver.java	Thu Feb 02 16:07:52 2012 -0800
@@ -107,7 +107,7 @@
             if (schedule == null) {
                 try {
                     schedule = new IdentifyBlocksPhase(true, LIRBlock.FACTORY);
-                    schedule.apply((StructuredGraph) graph, false);
+                    schedule.apply((StructuredGraph) graph);
                     blocks = schedule.getBlocks();
 
                     ComputeLinearScanOrder clso = new ComputeLinearScanOrder(schedule.getBlocks().size(), schedule.loopCount(), (LIRBlock) schedule.getStartBlock());
--- a/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -27,69 +27,37 @@
 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.compiler.util.*;
-import com.oracle.max.graal.compiler.util.LoopUtil.Loop;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.graph.Node.Verbosity;
 import com.oracle.max.graal.graph.NodeClass.NodeClassIterator;
 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.nodes.loop.*;
-import com.oracle.max.graal.printer.BasicIdealGraphPrinter.*;
 
 /**
  * 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 {
-
-    private final BasicIdealGraphPrinter printer;
-    private final HashSet<Class<?>> omittedClasses = new HashSet<>();
-    private final Set<Node> noBlockNodes = new HashSet<>();
-
+class IdealGraphPrinter extends BasicIdealGraphPrinter {
     /**
      * Creates a new {@link IdealGraphPrinter} that writes to the specified output stream.
      */
     public IdealGraphPrinter(OutputStream 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();
+        super(stream);
     }
 
     /**
      * 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, 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();
+    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();
             BytecodeStream bytecodes = new BytecodeStream(method.code());
             while (bytecodes.currentBC() != Bytecodes.END) {
                 int startBCI = bytecodes.currentBCI();
@@ -101,196 +69,93 @@
                         extra[i] = bytecodes.readUByte(startBCI + 1 + i);
                     }
                 }
-                printer.printBytecode(startBCI, mnemonic, extra);
+                printBytecode(startBCI, mnemonic, extra);
                 bytecodes.next();
             }
-            printer.endBytecodes();
+            endBytecodes();
         }
-        printer.endMethod();
+        endMethod();
     }
 
-    /**
-     * 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);
+    public void print(Graph graph, String title) {
+        print(graph, title, null);
     }
 
     /**
      * Prints an entire {@link Graph} with the specified title, optionally using short names for nodes.
      */
-    public void print(Graph graph, String title, boolean shortNames, IdentifyBlocksPhase predefinedSchedule) {
-        printer.beginGraph(title);
-        noBlockNodes.clear();
+    public void print(Graph graph, String title, IdentifyBlocksPhase predefinedSchedule) {
+        beginGraph(title);
+        Set<Node> noBlockNodes = new HashSet<>();
         IdentifyBlocksPhase schedule = predefinedSchedule;
         if (schedule == null) {
             try {
                 schedule = new IdentifyBlocksPhase(true);
-                schedule.apply((StructuredGraph) graph, false);
+                schedule.apply((StructuredGraph) graph);
             } catch (Throwable t) {
                 // nothing to do here...
             }
         }
-        List<Loop> loops = null;
-        try {
-            loops = LoopUtil.computeLoops((StructuredGraph) graph);
-            // loop.nodes() does some more calculations which may fail, so execute this here as well (result is cached)
-            if (loops != null) {
-                for (Loop loop : loops) {
-                    loop.nodes();
-                }
-            }
-        } catch (Throwable t) {
-            t.printStackTrace();
-            loops = null;
+
+        beginNodes();
+        List<Edge> edges = printNodes(graph, schedule == null ? null : schedule.getNodeToBlock(), noBlockNodes);
+        endNodes();
+
+        beginEdges();
+        for (Edge edge : edges) {
+            printEdge(edge);
         }
-
-        printer.beginNodes();
-        List<Edge> edges = printNodes(graph, shortNames, schedule == null ? null : schedule.getNodeToBlock(), loops);
-        printer.endNodes();
-
-        printer.beginEdges();
-        for (Edge edge : edges) {
-            printer.printEdge(edge);
-        }
-        printer.endEdges();
+        endEdges();
 
         if (schedule != null) {
-            printer.beginControlFlow();
+            beginControlFlow();
             for (Block block : schedule.getBlocks()) {
                 printBlock(graph, block, schedule.getNodeToBlock());
             }
-            printNoBlock();
-            printer.endControlFlow();
+            printNoBlock(noBlockNodes);
+            endControlFlow();
         }
 
-        printer.endGraph();
+        endGraph();
         flush();
     }
 
-    private List<Edge> printNodes(Graph graph, boolean shortNames, NodeMap<Block> nodeToBlock, List<Loop> loops) {
+    private List<Edge> printNodes(Graph graph, NodeMap<Block> nodeToBlock, Set<Node> noBlockNodes) {
         ArrayList<Edge> edges = new ArrayList<>();
-        NodeBitMap loopExits = graph.createNodeBitMap();
-        if (loops != null) {
-            for (Loop loop : loops) {
-                loopExits.setUnion(loop.exits());
-            }
-        }
 
         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;
-            }
 
-            printer.beginNode(node.toString(Verbosity.Id));
-            printer.beginProperties();
-            printer.printProperty("idx", node.toString(Verbosity.Id));
+            beginNode(node.toString(Verbosity.Id));
+            beginProperties();
+            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;
-                if (shortNames) {
-                    name = node.toString(Verbosity.Name);
-                } else {
-                    name = node.toString();
-                }
-                printer.printProperty("name", name);
+                String name = node.toString(Verbosity.Name);
+                printProperty("name", name);
             }
-            printer.printProperty("class", node.getClass().getSimpleName());
+            printProperty("class", node.getClass().getSimpleName());
             Block block = nodeToBlock == null ? null : nodeToBlock.get(node);
             if (block != null) {
-                printer.printProperty("block", Integer.toString(block.blockID()));
-                if (!(node instanceof PhiNode || node instanceof FrameState || node instanceof LocalNode || node instanceof InductionVariableNode) && !block.getInstructions().contains(node)) {
-                    printer.printProperty("notInOwnBlock", "true");
+                printProperty("block", Integer.toString(block.blockID()));
+                if (!(node instanceof PhiNode || node instanceof FrameState || node instanceof LocalNode) && !block.getInstructions().contains(node)) {
+                    printProperty("notInOwnBlock", "true");
                 }
             } else {
-                printer.printProperty("block", "noBlock");
+                printProperty("block", "noBlock");
                 noBlockNodes.add(node);
             }
-            if (loopExits.isMarked(node)) {
-                printer.printProperty("loopExit", "true");
-            }
-            StringBuilder sb = new StringBuilder();
-            if (loops != null) {
-                for (Loop loop : loops) {
-                    if (loop.nodes().isMarked(node)) {
-                        if (sb.length() > 0) {
-                            sb.append(", ");
-                        }
-                        sb.append(loop.loopBegin().toString(Verbosity.Id));
-                    }
-                }
-            }
-            if (sb.length() > 0) {
-                printer.printProperty("loops", sb.toString());
-            }
 
             Set<Entry<String, Integer>> nodeColors = colors.get(node);
             if (nodeColors != null) {
                 for (Entry<String, Integer> color : nodeColors) {
                     String name = color.getKey();
                     Integer value = color.getValue();
-                    printer.printProperty(name, Integer.toString(value));
+                    printProperty(name, Integer.toString(value));
                 }
             }
             Set<Entry<String, String>> nodeColorStrings = colorsToString.get(node);
@@ -298,24 +163,24 @@
                 for (Entry<String, String> color : nodeColorStrings) {
                     String name = color.getKey();
                     String value = color.getValue();
-                    printer.printProperty(name, value);
+                    printProperty(name, value);
                 }
             }
             Set<String> nodeBits = bits.get(node);
             if (nodeBits != null) {
                 for (String bit : nodeBits) {
-                    printer.printProperty(bit, "true");
+                    printProperty(bit, "true");
                 }
             }
 
             for (Entry<Object, Object> entry : props.entrySet()) {
                 String key = entry.getKey().toString();
                 String value = entry.getValue() == null ? "null" : entry.getValue().toString();
-                printer.printProperty(key, value);
+                printProperty(key, value);
             }
 
-            printer.endProperties();
-            printer.endNode();
+            endProperties();
+            endNode();
 
             // successors
             int fromIndex = 0;
@@ -323,7 +188,7 @@
             while (succIter.hasNext()) {
                 Position position = succIter.nextPosition();
                 Node successor = node.getNodeClass().get(node, position);
-                if (successor != null && !omittedClasses.contains(successor.getClass())) {
+                if (successor != null) {
                     edges.add(new Edge(node.toString(Verbosity.Id), fromIndex, successor.toString(Verbosity.Id), 0, node.getNodeClass().getName(position)));
                 }
                 fromIndex++;
@@ -335,8 +200,8 @@
             while (inputIter.hasNext()) {
                 Position position = inputIter.nextPosition();
                 Node input = node.getNodeClass().get(node, position);
-                if (input != null && !omittedClasses.contains(input.getClass())) {
-                    edges.add(new Edge(input.toString(Verbosity.Id), input.successors().explicitCount(), node.toString(Verbosity.Id), toIndex, node.getNodeClass().getName(position)));
+                if (input != null) {
+                    edges.add(new Edge(input.toString(Verbosity.Id), input.successors().count(), node.toString(Verbosity.Id), toIndex, node.getNodeClass().getName(position)));
                 }
                 toIndex++;
             }
@@ -346,15 +211,15 @@
     }
 
     private void printBlock(Graph graph, Block block, NodeMap<Block> nodeToBlock) {
-        printer.beginBlock(Integer.toString(block.blockID()));
-        printer.beginSuccessors();
+        beginBlock(Integer.toString(block.blockID()));
+        beginSuccessors();
         for (Block sux : block.getSuccessors()) {
             if (sux != null) {
-                printer.printSuccessor(Integer.toString(sux.blockID()));
+                printSuccessor(Integer.toString(sux.blockID()));
             }
         }
-        printer.endSuccessors();
-        printer.beginBlockNodes();
+        endSuccessors();
+        beginBlockNodes();
 
         Set<Node> nodes = new HashSet<>(block.getInstructions());
 
@@ -386,34 +251,26 @@
                     for (PhiNode phi : ((MergeNode) node).phis()) {
                         nodes.add(phi);
                     }
-                    if (node instanceof LoopBeginNode) {
-                        for (InductionVariableNode iv : ((LoopBeginNode) node).inductionVariables()) {
-                            nodes.add(iv);
-                        }
-                    }
                 }
             }
 
             for (Node node : nodes) {
-                if (!omittedClasses.contains(node.getClass())) {
-                    printer.printBlockNode(node.toString(Verbosity.Id));
-                }
+                printBlockNode(node.toString(Verbosity.Id));
             }
         }
-        printer.endBlockNodes();
-        printer.endBlock();
+        endBlockNodes();
+        endBlock();
     }
 
-    private void printNoBlock() {
+    private void printNoBlock(Set<Node> noBlockNodes) {
         if (!noBlockNodes.isEmpty()) {
-            printer.beginBlock("noBlock");
-            printer.beginBlockNodes();
+            beginBlock("noBlock");
+            beginBlockNodes();
             for (Node node : noBlockNodes) {
-                printer.printBlockNode(node.toString(Verbosity.Id));
+                printBlockNode(node.toString(Verbosity.Id));
             }
-            printer.endBlockNodes();
-            printer.endBlock();
+            endBlockNodes();
+            endBlock();
         }
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinterDumpHandler.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,157 @@
+/*
+ * 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.printer;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.cri.ri.*;
+import com.oracle.max.criutils.*;
+import com.oracle.max.graal.debug.*;
+import com.oracle.max.graal.graph.*;
+
+/**
+ * Observes compilation events and uses {@link IdealGraphPrinter} to generate a graph representation that can be
+ * inspected with the <a href="http://kenai.com/projects/igv">Ideal Graph Visualizer</a>.
+ */
+public class IdealGraphPrinterDumpHandler implements DebugDumpHandler {
+
+    private static final String DEFAULT_FILE_NAME = "output.igv.xml";
+
+    private IdealGraphPrinter printer;
+    private List<RiResolvedMethod> previousInlineContext = new ArrayList<>();
+    private String fileName;
+    private String host;
+    private int port;
+    private boolean initialized;
+
+    /**
+     * Creates a new {@link IdealGraphPrinterDumpHandler} that writes output to a file named after the compiled method.
+     */
+    public IdealGraphPrinterDumpHandler() {
+        this.fileName = DEFAULT_FILE_NAME;
+    }
+
+    /**
+     * Creates a new {@link IdealGraphPrinterDumpHandler} that sends output to a remote IdealGraphVisualizer instance.
+     */
+    public IdealGraphPrinterDumpHandler(String host, int port) {
+        this.host = host;
+        this.port = port;
+    }
+
+
+
+    private void ensureInitialized() {
+        if (!initialized) {
+            initialized = true;
+            if (fileName != null) {
+                initializeFilePrinter();
+            } else {
+                initializeNetworkPrinter();
+            }
+            printer.begin();
+        }
+    }
+
+    private void initializeFilePrinter() {
+        try {
+            FileOutputStream stream = new FileOutputStream(fileName);
+            printer = new IdealGraphPrinter(stream);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private void initializeNetworkPrinter() {
+        try  {
+            Socket socket = new Socket(host, port);
+            BufferedOutputStream stream = new BufferedOutputStream(socket.getOutputStream(), 0x4000);
+            printer = new IdealGraphPrinter(stream);
+            TTY.println("Connected to the IGV on port %d", port);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    public void dump(Object object, final String message) {
+        if (object instanceof Graph) {
+            ensureInitialized();
+            final Graph graph = (Graph) object;
+
+            if (printer.isValid()) {
+                // Get all current RiResolvedMethod instances in the context.
+                List<RiResolvedMethod> inlineContext = Debug.contextSnapshot(RiResolvedMethod.class);
+
+                // Reverse list such that inner method comes after outer method.
+                Collections.reverse(inlineContext);
+
+                // Check for method scopes that must be closed since the previous dump.
+                for (int i = 0; i < previousInlineContext.size(); ++i) {
+                    if (i >= inlineContext.size() || inlineContext.get(i) != previousInlineContext.get(i)) {
+                        for (int j = previousInlineContext.size() - 1; j >= i; --j) {
+                            closeMethodScope();
+                        }
+                    }
+                }
+
+                // Check for method scopes that must be opened since the previous dump.
+                for (int i = 0; i < inlineContext.size(); ++i) {
+                    if (i >= previousInlineContext.size() || inlineContext.get(i) != previousInlineContext.get(i)) {
+                        for (int j = i; j < inlineContext.size(); ++j) {
+                            openMethodScope(inlineContext.get(j));
+                        }
+                    }
+                }
+
+                // Save inline context for next dump.
+                previousInlineContext = inlineContext;
+
+                Debug.sandbox("PrintingGraph", new Runnable() {
+
+                    @Override
+                    public void run() {
+                        // Finally, output the graph.
+                        printer.print(graph, message);
+
+                    }
+                });
+            } else {
+                TTY.println("Fatal error: Printer invalid!");
+                System.exit(-1);
+            }
+        }
+    }
+
+    private void openMethodScope(RiResolvedMethod method) {
+        printer.beginGroup(CiUtil.format("%H::%n", method), CiUtil.format("%h::%n", method), method, -1);
+
+    }
+
+    private void closeMethodScope() {
+        printer.endGroup();
+
+    }
+}
--- a/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinterObserver.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,265 +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.printer;
-
-import java.io.*;
-import java.net.*;
-import java.util.regex.*;
-
-import com.oracle.max.cri.ri.*;
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
-import com.oracle.max.graal.compiler.observer.*;
-import com.oracle.max.graal.compiler.schedule.*;
-import com.oracle.max.graal.graph.*;
-
-/**
- * Observes compilation events and uses {@link IdealGraphPrinter} to generate a graph representation that can be
- * inspected with the <a href="http://kenai.com/projects/igv">Ideal Graph Visualizer</a>.
- */
-public class IdealGraphPrinterObserver implements CompilationObserver {
-
-    private static final Pattern INVALID_CHAR = Pattern.compile("[^A-Za-z0-9_.-]");
-
-    private final String host;
-    private final int port;
-
-    private static class PrintingContext {
-        public IdealGraphPrinter printer;
-        private OutputStream stream;
-        private Socket socket;
-
-    }
-    private final ThreadLocal<PrintingContext> context = new ThreadLocal<PrintingContext>() {
-        @Override
-        protected PrintingContext initialValue() {
-            return new PrintingContext();
-        }
-    };
-
-    /**
-     * Creates a new {@link IdealGraphPrinterObserver} that writes output to a file named after the compiled method.
-     */
-    public IdealGraphPrinterObserver() {
-        this(null, -1);
-    }
-
-    /**
-     * Creates a new {@link IdealGraphPrinterObserver} that sends output to a remote IdealGraphVisualizer instance.
-     */
-    public IdealGraphPrinterObserver(String host, int port) {
-        this.host = host;
-        this.port = port;
-    }
-
-    private PrintingContext context() {
-        return context.get();
-    }
-
-    private IdealGraphPrinter printer() {
-        return context().printer;
-    }
-
-    private Socket socket() {
-        return context().socket;
-    }
-
-    @Override
-    public void compilationStarted(CompilationEvent event) {
-        openPrinter(event.debugObject(RiResolvedMethod.class), false);
-    }
-
-    private void openPrinter(RiResolvedMethod method, boolean error) {
-        assert (context().stream == null && printer() == null);
-        if ((!TTY.isSuppressed() && GraalOptions.Plot) || (GraalOptions.PlotOnError && error)) {
-            String name;
-            if (method != null) {
-                name = method.holder().name();
-                name = name.substring(1, name.length() - 1).replace('/', '.');
-                name = name + "." + method.name();
-            } else {
-                name = "null";
-            }
-
-            openPrinter(name, method);
-        }
-    }
-
-    private void openPrinter(String title, RiResolvedMethod method) {
-        assert (context().stream == null && printer() == null);
-        if (!TTY.isSuppressed()) {
-            // Use a filter to suppress a recursive attempt to open a printer
-            TTY.Filter filter = new TTY.Filter();
-            try {
-                if (host != null) {
-                    openNetworkPrinter(title, method);
-                } else {
-                    openFilePrinter(title, method);
-                }
-            } finally {
-                filter.remove();
-            }
-        }
-    }
-
-    private void openFilePrinter(String title, RiResolvedMethod method) {
-        String filename = title + ".igv.xml";
-        filename = INVALID_CHAR.matcher(filename).replaceAll("_");
-
-        try {
-            context().stream = new FileOutputStream(filename);
-            context().printer = new IdealGraphPrinter(context().stream);
-            printer().begin();
-            printer().beginGroup(title, title, method, -1, "Graal");
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public boolean networkAvailable() {
-        try {
-            Socket s = new Socket(host, port);
-            s.setSoTimeout(10);
-            s.close();
-            return true;
-        } catch (IOException e) {
-            return false;
-        }
-    }
-
-    private void openNetworkPrinter(String title, RiResolvedMethod method) {
-        try {
-            context().socket = new Socket(host, port);
-            if (socket().getInputStream().read() == 'y') {
-                context().stream = new BufferedOutputStream(socket().getOutputStream(), 0x4000);
-            } else {
-                // server currently does not accept any input
-                socket().close();
-                context().socket = null;
-                return;
-            }
-
-            context().printer = new IdealGraphPrinter(context().stream);
-            printer().begin();
-            printer().beginGroup(title, title, method, -1, "Graal");
-            printer().flush();
-            if (socket().getInputStream().read() != 'y') {
-                // server declines input for this method
-                socket().close();
-                context().socket = null;
-                context().stream = null;
-                context().printer = null;
-            }
-        } catch (IOException e) {
-            System.err.println("Error opening connection to " + host + ":" + port + ": " + e);
-
-            if (socket() != null) {
-                try {
-                    socket().close();
-                } catch (IOException ioe) {
-                }
-                context().socket = null;
-            }
-            context().stream = null;
-            context().printer = null;
-        }
-    }
-
-    @Override
-    public void compilationEvent(CompilationEvent event) {
-        boolean lazyStart = false;
-        if (printer() == null && event.hasDebugObject(CompilationEvent.ERROR)) {
-            openPrinter(event.debugObject(RiResolvedMethod.class), true);
-            lazyStart = true;
-        }
-        Graph graph = event.debugObject(Graph.class);
-        if (printer() != null && graph != null) {
-            printer().print(graph, event.label, true, event.debugObject(IdentifyBlocksPhase.class));
-        }
-        if (lazyStart && printer() != null) {
-            closePrinter();
-        }
-    }
-
-    @Override
-    public void compilationFinished(CompilationEvent event) {
-        if (printer() != null) {
-            closePrinter();
-        }
-    }
-
-    private void closePrinter() {
-        assert (printer() != null);
-
-        try {
-            printer().endGroup();
-            printer().end();
-
-            if (socket() != null) {
-                socket().close(); // also closes stream
-            } else {
-                context().stream.close();
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-            context().printer = null;
-            context().stream = null;
-            context().socket = null;
-        }
-    }
-
-    public void printGraphs(String groupTitle, Graph... graphs) {
-        openPrinter(groupTitle, null);
-        if (printer() != null) {
-            int i = 0;
-            for (Graph graph : graphs) {
-                printer().print(graph, "Graph " + i, true);
-                i++;
-            }
-            closePrinter();
-        }
-    }
-
-    public void compilationStarted(String groupTitle) {
-        openPrinter(groupTitle, null);
-    }
-
-    public void printGraph(String graphTitle, Graph graph) {
-        if (printer() != null) {
-            printer().print(graph, graphTitle, true);
-        }
-    }
-
-    public void printSingleGraph(String title, Graph graph) {
-        printSingleGraph(title, title, graph);
-    }
-
-    public void printSingleGraph(String groupTitle, String graphTitle, Graph graph) {
-        openPrinter(groupTitle, null);
-        if (printer() != null) {
-            printer().print(graph, graphTitle, true);
-            closePrinter();
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/ArrayCopySnippets.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,258 +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.snippets;
-
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.nodes.extended.*;
-import com.oracle.max.graal.snippets.nodes.*;
-
-
-public class ArrayCopySnippets implements SnippetsInterface{
-
-    @Snippet
-    public static void arraycopy(byte[] src, int srcPos, byte[] 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) {
-                if ((length & 0x02) == 0) {
-                    if ((length & 0x04) == 0) {
-                        copyLongsDown(src, srcPos, dest, destPos, length >> 3);
-                    } else {
-                        copyIntsDown(src, srcPos, dest, destPos, length >> 2);
-                    }
-                } else {
-                    copyShortsDown(src, srcPos, dest, destPos, length >> 1);
-                }
-            } else {
-                copyBytesDown(src, srcPos, dest, destPos, length);
-            }
-        } else {
-            if ((length & 0x01) == 0) {
-                if ((length & 0x02) == 0) {
-                    if ((length & 0x04) == 0) {
-                        copyLongsUp(src, srcPos, dest, destPos, length >> 3);
-                    } else {
-                        copyIntsUp(src, srcPos, dest, destPos, length >> 2);
-                    }
-                } else {
-                    copyShortsUp(src, srcPos, dest, destPos, length >> 1);
-                }
-            } else {
-                copyBytesUp(src, srcPos, dest, destPos, length);
-            }
-        }
-    }
-
-    @Snippet
-    public static void arraycopy(char[] src, int srcPos, char[] 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) {
-                if ((length & 0x02) == 0) {
-                    copyLongsDown(src, srcPos * 2L, dest, destPos * 2L, length >> 2);
-                } else {
-                    copyIntsDown(src, srcPos * 2L, dest, destPos * 2L, length >> 1);
-                }
-            } else {
-                copyShortsDown(src, srcPos * 2L, dest, destPos * 2L, length);
-            }
-        } else {
-            if ((length & 0x01) == 0) {
-                if ((length & 0x02) == 0) {
-                    copyLongsUp(src, srcPos * 2L, dest, destPos * 2L, length >> 2);
-                } else {
-                    copyIntsUp(src, srcPos * 2L, dest, destPos * 2L, length >> 1);
-                }
-            } else {
-                copyShortsUp(src, srcPos * 2L, dest, destPos * 2L, length);
-            }
-        }
-    }
-
-    @Snippet
-    public static void arraycopy(short[] src, int srcPos, short[] 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) {
-                if ((length & 0x02) == 0) {
-                    copyLongsDown(src, srcPos * 2L, dest, destPos * 2L, length >> 2);
-                } else {
-                    copyIntsDown(src, srcPos * 2L, dest, destPos * 2L, length >> 1);
-                }
-            } else {
-                copyShortsDown(src, srcPos * 2L, dest, destPos * 2L, length);
-            }
-        } else {
-            if ((length & 0x01) == 0) {
-                if ((length & 0x02) == 0) {
-                    copyLongsUp(src, srcPos * 2L, dest, destPos * 2L, length >> 2);
-                } else {
-                    copyIntsUp(src, srcPos * 2L, dest, destPos * 2L, length >> 1);
-                }
-            } else {
-                copyShortsUp(src, srcPos * 2L, dest, destPos * 2L, length);
-            }
-        }
-    }
-
-    @Snippet
-    public static void arraycopy(int[] src, int srcPos, int[] 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();
-        }
-        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);
-        }
-    }
-
-    @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--) {
-            Byte a = UnsafeLoadNode.load(src, i + (srcPos + header), CiKind.Byte);
-            UnsafeStoreNode.store(dest, i + (destPos + header), a.byteValue(), CiKind.Byte);
-        }
-    }
-
-    @Snippet
-    public static void copyShortsDown(Object src, long srcOffset, Object dest, long destOffset, int length)  {
-        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Short);
-        for (long i = (length - 1) * 2; i >= 0; i -= 2) {
-            Character a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Short);
-            UnsafeStoreNode.store(dest, i + (destOffset + header), a.charValue(), CiKind.Short);
-        }
-    }
-
-    @Snippet
-    public static void copyIntsDown(Object src, long srcOffset, Object dest, long destOffset, int length)  {
-        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Short);
-        for (long i = (length - 1) * 4; i >= 0; i -= 4) {
-            Integer a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Int);
-            UnsafeStoreNode.store(dest, i + (destOffset + header), a.intValue(), CiKind.Int);
-        }
-    }
-
-    @Snippet
-    public static void copyLongsDown(Object src, long srcOffset, Object dest, long destOffset, int length)  {
-        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Short);
-        for (long i = (length - 1) * 8; i >= 0; i -= 8) {
-            Long a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Long);
-            UnsafeStoreNode.store(dest, i + (destOffset + header), a.longValue(), CiKind.Long);
-        }
-    }
-
-    /**
-     * Copies {@code length} bytes from {@code src} starting at {@code srcPos} to {@code dest} starting at {@code destPos}.
-     * @param src source object
-     * @param srcPos source offset
-     * @param dest destination object
-     * @param destPos destination offset
-     * @param length number of bytes to copy
-     */
-    @Snippet
-    public static void copyBytesUp(Object src, int srcPos, Object dest, int destPos, int length)  {
-        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Byte);
-        for (long i = 0; i < length; i++) {
-            Byte a = UnsafeLoadNode.load(src, i + (srcPos + header), CiKind.Byte);
-            UnsafeStoreNode.store(dest, i + (destPos + header), a.byteValue(), CiKind.Byte);
-        }
-    }
-
-    /**
-     * Copies {@code length} shorts from {@code src} starting at offset {@code srcOffset} (in bytes) to {@code dest} starting at offset {@code destOffset} (in bytes).
-     * @param src
-     * @param srcOffset (in bytes)
-     * @param dest
-     * @param destOffset (in bytes)
-     * @param length  (in shorts)
-     */
-    @Snippet
-    public static void copyShortsUp(Object src, long srcOffset, Object dest, long destOffset, int length)  {
-        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Short);
-        for (long i = 0; i < length * 2L; i += 2) {
-            Character a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Short);
-            UnsafeStoreNode.store(dest, i + (destOffset + header), a.charValue(), CiKind.Short);
-        }
-    }
-
-    @Snippet
-    public static void copyIntsUp(Object src, long srcOffset, Object dest, long destOffset, int length)  {
-        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Int);
-        for (long i = 0; i < length * 4L; i += 4) {
-            Integer a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Int);
-            UnsafeStoreNode.store(dest, i + (destOffset + header), a.intValue(), CiKind.Int);
-        }
-    }
-
-    @Snippet
-    public static void copyLongsUp(Object src, long srcOffset, Object dest, long destOffset, int length)  {
-        long header = ArrayHeaderSizeNode.sizeFor(CiKind.Long);
-        for (long i = 0; i < length * 8L; i += 8) {
-            Long a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Long);
-            UnsafeStoreNode.store(dest, i + (destOffset + header), a.longValue(), CiKind.Long);
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/GraalIntrinsics.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/GraalIntrinsics.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,7 +25,6 @@
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.phases.*;
-import com.oracle.max.graal.compiler.phases.PhasePlan.PhasePosition;
 import com.oracle.max.graal.cri.*;
 
 /**
@@ -34,12 +33,10 @@
 public class GraalIntrinsics {
     public static void installIntrinsics(GraalRuntime runtime, CiTarget target, PhasePlan plan) {
         if (GraalOptions.Intrinsify) {
-            Snippets.install(runtime, target, new MathSnippetsX86(), GraalOptions.PlotSnippets, plan);
-            Snippets.install(runtime, target, new DoubleSnippets(), GraalOptions.PlotSnippets, plan);
-            Snippets.install(runtime, target, new FloatSnippets(), GraalOptions.PlotSnippets, plan);
-            Snippets.install(runtime, target, new NodeClassSnippets(), GraalOptions.PlotSnippets, plan);
-            Snippets.install(runtime, target, new ArrayCopySnippets(), GraalOptions.PlotSnippets, plan);
-            plan.addPhase(PhasePosition.HIGH_LEVEL, new IntrinsifyArrayCopyPhase(runtime));
+            Snippets.install(runtime, target, new MathSnippetsX86(), plan);
+            Snippets.install(runtime, target, new DoubleSnippets(), plan);
+            Snippets.install(runtime, target, new FloatSnippets(), plan);
+            Snippets.install(runtime, target, new NodeClassSnippets(), plan);
         }
     }
 }
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/IntrinsifyArrayCopyPhase.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +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.snippets;
-
-import java.lang.reflect.*;
-
-import com.oracle.max.cri.ri.*;
-import com.oracle.max.graal.compiler.phases.*;
-import com.oracle.max.graal.compiler.util.*;
-import com.oracle.max.graal.cri.*;
-import com.oracle.max.graal.graph.*;
-import com.oracle.max.graal.nodes.*;
-import com.oracle.max.graal.nodes.java.*;
-
-public class IntrinsifyArrayCopyPhase extends Phase {
-    private final GraalRuntime runtime;
-    private RiResolvedMethod arrayCopy;
-    private RiResolvedMethod byteArrayCopy;
-    private RiResolvedMethod shortArrayCopy;
-    private RiResolvedMethod charArrayCopy;
-    private RiResolvedMethod intArrayCopy;
-    private RiResolvedMethod longArrayCopy;
-
-    public IntrinsifyArrayCopyPhase(GraalRuntime runtime) {
-        this.runtime = runtime;
-        try {
-            byteArrayCopy = getArrayCopySnippet(runtime, byte.class);
-            charArrayCopy = getArrayCopySnippet(runtime, char.class);
-            shortArrayCopy = getArrayCopySnippet(runtime, short.class);
-            intArrayCopy = getArrayCopySnippet(runtime, int.class);
-            longArrayCopy = getArrayCopySnippet(runtime, long.class);
-            arrayCopy = runtime.getRiMethod(System.class.getDeclaredMethod("arraycopy", Object.class, int.class, Object.class, int.class, int.class));
-        } catch (SecurityException e) {
-            e.printStackTrace();
-        } catch (NoSuchMethodException e) {
-            e.printStackTrace();
-        }
-    }
-
-    private static RiResolvedMethod getArrayCopySnippet(RiRuntime runtime, Class<?> componentClass) throws NoSuchMethodException {
-        Class<?> arrayClass = Array.newInstance(componentClass, 0).getClass();
-        return runtime.getRiMethod(ArrayCopySnippets.class.getDeclaredMethod("arraycopy", arrayClass, int.class, arrayClass, int.class, int.class));
-    }
-
-    @Override
-    protected void run(StructuredGraph graph) {
-        for (MethodCallTargetNode methodCallTarget : graph.getNodes(MethodCallTargetNode.class)) {
-            RiResolvedMethod targetMethod = methodCallTarget.targetMethod();
-            RiResolvedMethod snippetMethod = null;
-            if (targetMethod == arrayCopy) {
-                ValueNode src = methodCallTarget.arguments().get(0);
-                ValueNode dest = methodCallTarget.arguments().get(2);
-                if (src == null || dest == null) { //TODO (gd) this should never be null : check
-                    return;
-                }
-                RiResolvedType srcDeclaredType = src.declaredType();
-                RiResolvedType destDeclaredType = dest.declaredType();
-                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;
-                    }
-                }
-            }
-
-            if (snippetMethod != null) {
-                StructuredGraph snippetGraph = (StructuredGraph) snippetMethod.compilerStorage().get(Graph.class);
-                assert snippetGraph != null : "ArrayCopySnippets should be installed";
-                //TTY.println("  >  Intinsify");
-                InliningUtil.inline(methodCallTarget.invoke(), snippetGraph, false);
-            }
-        }
-        new CanonicalizerPhase(null, runtime, null).apply(graph);
-    }
-}
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/Snippets.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/Snippets.java	Thu Feb 02 16:07:52 2012 -0800
@@ -26,62 +26,46 @@
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
-import com.oracle.max.graal.compiler.*;
-import com.oracle.max.graal.compiler.observer.*;
 import com.oracle.max.graal.compiler.phases.*;
 import com.oracle.max.graal.compiler.util.*;
 import com.oracle.max.graal.cri.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.java.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.extended.*;
 import com.oracle.max.graal.nodes.java.*;
-import com.oracle.max.graal.printer.*;
 
 /**
  * Utilities for snippet installation and management.
  */
 public class Snippets {
 
-    public static void install(GraalRuntime runtime, CiTarget target, SnippetsInterface obj, boolean plotGraphs, PhasePlan plan) {
+    public static void install(GraalRuntime runtime, CiTarget target, SnippetsInterface obj, PhasePlan plan) {
         Class<? extends SnippetsInterface> clazz = obj.getClass();
-        GraalContext context = new GraalContext("Installing Snippet");
         BoxingMethodPool pool = new BoxingMethodPool(runtime);
         if (clazz.isAnnotationPresent(ClassSubstitution.class)) {
-            installSubstitution(runtime, target, plotGraphs, plan, clazz, context, pool, clazz.getAnnotation(ClassSubstitution.class).value());
+            installSubstitution(runtime, target, plan, clazz, pool, clazz.getAnnotation(ClassSubstitution.class).value());
         } else {
-            installSnippets(runtime, target, plotGraphs, plan, clazz, context, pool);
+            installSnippets(runtime, target, plan, clazz, pool);
         }
     }
 
-    private static void installSnippets(GraalRuntime runtime, CiTarget target, boolean plotGraphs, PhasePlan plan, Class< ? extends SnippetsInterface> clazz, GraalContext context,
+    private static void installSnippets(GraalRuntime runtime, CiTarget target, PhasePlan plan, Class< ? extends SnippetsInterface> clazz,
                     BoxingMethodPool pool) {
         for (Method snippet : clazz.getDeclaredMethods()) {
-            try {
-                int modifiers = snippet.getModifiers();
-                if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
-                    throw new RuntimeException("Snippet must not be abstract or native");
-                }
-                RiResolvedMethod snippetRiMethod = runtime.getRiMethod(snippet);
-                if (snippetRiMethod.compilerStorage().get(Graph.class) == null) {
-                    buildSnippetGraph(snippetRiMethod, runtime, target, context, pool, plotGraphs, plan);
-                }
-            } catch (GraalInternalError error) {
-                if (context.isObserved()) {
-                    if (error.node() != null) {
-                        context.observable.fireCompilationEvent("VerificationError on Node " + error.node(), CompilationEvent.ERROR, error.node().graph());
-                    } else if (error.graph() != null) {
-                        context.observable.fireCompilationEvent("VerificationError on Graph " + error.graph(), CompilationEvent.ERROR, error.graph());
-                    }
-                }
-                throw error;
-            } catch (Throwable t) {
-                throw new RuntimeException("Error when installing snippet for " + clazz, t);
+            int modifiers = snippet.getModifiers();
+            if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
+                throw new RuntimeException("Snippet must not be abstract or native");
+            }
+            RiResolvedMethod snippetRiMethod = runtime.getRiMethod(snippet);
+            if (snippetRiMethod.compilerStorage().get(Graph.class) == null) {
+                buildSnippetGraph(snippetRiMethod, runtime, target, pool, plan);
             }
         }
     }
 
-    private static void installSubstitution(GraalRuntime runtime, CiTarget target, boolean plotGraphs, PhasePlan plan, Class< ? extends SnippetsInterface> clazz, GraalContext context,
+    private static void installSubstitution(GraalRuntime runtime, CiTarget target, PhasePlan plan, Class< ? extends SnippetsInterface> clazz,
                     BoxingMethodPool pool, Class<?> original) throws GraalInternalError {
         for (Method snippet : clazz.getDeclaredMethods()) {
             try {
@@ -94,50 +78,24 @@
                     throw new RuntimeException("Snippet must not be abstract or native");
                 }
                 RiResolvedMethod snippetRiMethod = runtime.getRiMethod(snippet);
-                StructuredGraph graph = buildSnippetGraph(snippetRiMethod, runtime, target, context, pool, plotGraphs, plan);
+                StructuredGraph graph = buildSnippetGraph(snippetRiMethod, runtime, target, pool, plan);
                 runtime.getRiMethod(method).compilerStorage().put(Graph.class, graph);
             } catch (NoSuchMethodException e) {
                 throw new RuntimeException("Could not resolve method to substitute with: " + snippet.getName(), e);
-            } catch (GraalInternalError error) {
-                if (context.isObserved()) {
-                    if (error.node() != null) {
-                        context.observable.fireCompilationEvent("VerificationError on Node " + error.node(), CompilationEvent.ERROR, error.node().graph());
-                    } else if (error.graph() != null) {
-                        context.observable.fireCompilationEvent("VerificationError on Graph " + error.graph(), CompilationEvent.ERROR, error.graph());
-                    }
-                }
-                throw error;
-            } catch (Throwable t) {
-                throw new RuntimeException("Error when installing snippet for " + clazz, t);
             }
         }
     }
 
-    private static StructuredGraph buildSnippetGraph(RiResolvedMethod snippetRiMethod, GraalRuntime runtime, CiTarget target, GraalContext context, BoxingMethodPool pool, boolean plotGraphs, PhasePlan plan) {
-        IdealGraphPrinterObserver observer = null;
-        if (plotGraphs) {
-            observer = new IdealGraphPrinterObserver(GraalOptions.PrintIdealGraphAddress, GraalOptions.PrintIdealGraphPort);
-            observer.compilationStarted(CiUtil.format("snippet:%h.%n(%p)", snippetRiMethod));
-        }
-        StructuredGraph graph = buildSnippetGraph(snippetRiMethod, runtime, target, context, pool, plan, observer);
-        if (observer != null) {
-            observer.compilationFinished(null);
-        }
-        return graph;
-    }
+    private static StructuredGraph buildSnippetGraph(RiResolvedMethod snippetRiMethod, GraalRuntime runtime, CiTarget target, BoxingMethodPool pool, PhasePlan plan) {
 
-    private static StructuredGraph buildSnippetGraph(RiResolvedMethod snippetRiMethod, GraalRuntime runtime, CiTarget target, GraalContext context, BoxingMethodPool pool, PhasePlan plan, IdealGraphPrinterObserver observer) {
-
-        GraphBuilderConfiguration config = GraphBuilderConfiguration.getDeoptFreeDefault();
+        GraphBuilderConfiguration config = GraphBuilderConfiguration.getSnippetDefault();
         GraphBuilderPhase graphBuilder = new GraphBuilderPhase(runtime, config);
         StructuredGraph graph = new StructuredGraph(snippetRiMethod);
-        graphBuilder.apply(graph, context);
+        graphBuilder.apply(graph);
 
-        if (observer != null) {
-            observer.printGraph(snippetRiMethod.name() + ":" + GraphBuilderPhase.class.getSimpleName(), graph);
-        }
+        Debug.dump(graph, "%s: %s", snippetRiMethod.name(), GraphBuilderPhase.class.getSimpleName());
 
-        new SnippetIntrinsificationPhase(runtime, pool).apply(graph, context);
+        new SnippetIntrinsificationPhase(runtime, pool).apply(graph);
 
         for (Invoke invoke : graph.getInvokes()) {
             MethodCallTargetNode callTarget = invoke.callTarget();
@@ -146,33 +104,29 @@
             if (holder.isSubtypeOf(runtime.getType(SnippetsInterface.class))) {
                 StructuredGraph targetGraph = (StructuredGraph) targetMethod.compilerStorage().get(Graph.class);
                 if (targetGraph == null) {
-                    targetGraph = buildSnippetGraph(targetMethod, runtime, target, context, pool, plan, observer);
+                    targetGraph = buildSnippetGraph(targetMethod, runtime, target, pool, plan);
                 }
                 InliningUtil.inline(invoke, targetGraph, true);
                 new CanonicalizerPhase(target, runtime, null).apply(graph);
             }
         }
 
-        new SnippetIntrinsificationPhase(runtime, pool).apply(graph, context);
+        new SnippetIntrinsificationPhase(runtime, pool).apply(graph);
 
-        if (observer != null) {
-            observer.printGraph(snippetRiMethod.name() + ":" + SnippetIntrinsificationPhase.class.getSimpleName(), graph);
-        }
-        new DeadCodeEliminationPhase().apply(graph, context);
-        new CanonicalizerPhase(target, runtime, null).apply(graph, context);
+        Debug.dump(graph, "%s: %s", snippetRiMethod.name(), GraphBuilderPhase.class.getSimpleName());
+        new DeadCodeEliminationPhase().apply(graph);
+        new CanonicalizerPhase(target, runtime, null).apply(graph);
 
         // TODO (gd) remove when we have safepoint polling elimination
         for (LoopEndNode end : graph.getNodes(LoopEndNode.class)) {
             end.setSafepointPolling(false);
         }
+        new InsertStateAfterPlaceholderPhase().apply(graph);
 
-        if (observer != null) {
-            observer.printGraph(snippetRiMethod.name() + ":" + "Final", graph);
-        }
+        Debug.dump(graph, "%s: Final", snippetRiMethod.name());
 
         snippetRiMethod.compilerStorage().put(Graph.class, graph);
 
         return graph;
     }
-
 }
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/SystemSnippets.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +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.snippets;
-
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.nodes.extended.*;
-
-/**
- * Snippets for {@link java.lang.System} methods.
- */
-@ClassSubstitution(java.lang.System.class)
-public class SystemSnippets implements SnippetsInterface {
-
-    // TODO: public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length) { }
-
-    public static long currentTimeMillis() {
-        return RuntimeCallNode.performCall(CiRuntimeCall.JavaTimeMillis);
-    }
-
-    public static long nanoTime() {
-        return RuntimeCallNode.performCall(CiRuntimeCall.JavaTimeNanos);
-    }
-
-}
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/UnsafeSnippets.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,251 +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.snippets;
-
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.util.*;
-import com.oracle.max.graal.nodes.extended.*;
-import com.oracle.max.graal.nodes.java.*;
-
-/**
- * Snippets for {@link sun.misc.Unsafe} methods.
- */
-@ClassSubstitution(sun.misc.Unsafe.class)
-public class UnsafeSnippets implements SnippetsInterface {
-
-    public boolean compareAndSwapObject(Object o, long offset, Object expected, Object x) {
-        return CompareAndSwapNode.compareAndSwap(o, offset, expected, x);
-    }
-
-    public boolean compareAndSwapInt(Object o, long offset, int expected, int x) {
-        return CompareAndSwapNode.compareAndSwap(o, offset, expected, x);
-    }
-
-    public boolean compareAndSwapLong(Object o, long offset, long expected, long x) {
-        return CompareAndSwapNode.compareAndSwap(o, offset, expected, x);
-    }
-
-    public Object getObject(Object o, long offset) {
-        return UnsafeLoadNode.load(o, offset, CiKind.Object);
-    }
-
-    public Object getObjectVolatile(Object o, long offset) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
-        Object result = getObject(o, offset);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
-        return result;
-    }
-
-    public void putObject(Object o, long offset, Object x) {
-        UnsafeStoreNode.store(o, offset, x, CiKind.Object);
-    }
-
-    public void putObjectVolatile(Object o, long offset, Object x) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
-        putObject(o, offset, x);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
-    }
-
-    public int getInt(Object o, long offset) {
-        Integer value = UnsafeLoadNode.load(o, offset, CiKind.Int);
-        return value;
-    }
-
-    public int getIntVolatile(Object o, long offset) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
-        int result = getInt(o, offset);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
-        return result;
-    }
-
-    public void putInt(Object o, long offset, int x) {
-        UnsafeStoreNode.store(o, offset, x, CiKind.Int);
-    }
-
-    public void putIntVolatile(Object o, long offset, int x) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
-        putInt(o, offset, x);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
-    }
-
-    public boolean getBoolean(Object o, long offset) {
-        @JavacBug(id = 6995200)
-        Boolean result = UnsafeLoadNode.load(o, offset, CiKind.Boolean);
-        return result;
-    }
-
-    public boolean getBooleanVolatile(Object o, long offset) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
-        boolean result = getBoolean(o, offset);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
-        return result;
-    }
-
-    public void putBoolean(Object o, long offset, boolean x) {
-        UnsafeStoreNode.store(o, offset, x, CiKind.Boolean);
-    }
-
-    public void putBooleanVolatile(Object o, long offset, boolean x) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
-        putBoolean(o, offset, x);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
-    }
-
-    public byte getByte(Object o, long offset) {
-        @JavacBug(id = 6995200)
-        Byte result = UnsafeLoadNode.load(o, offset, CiKind.Byte);
-        return result;
-    }
-
-    public byte getByteVolatile(Object o, long offset) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
-        byte result = getByte(o, offset);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
-        return result;
-    }
-
-    public void putByte(Object o, long offset, byte x) {
-        UnsafeStoreNode.store(o, offset, x, CiKind.Byte);
-    }
-
-    public void putByteVolatile(Object o, long offset, byte x) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
-        putByte(o, offset, x);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
-    }
-
-    public short getShort(Object o, long offset) {
-        @JavacBug(id = 6995200)
-        Short result = UnsafeLoadNode.load(o, offset, CiKind.Short);
-        return result;
-    }
-
-    public short getShortVolatile(Object o, long offset) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
-        short result = getShort(o, offset);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
-        return result;
-    }
-
-    public void putShort(Object o, long offset, short x) {
-        UnsafeStoreNode.store(o, offset, x, CiKind.Short);
-    }
-
-    public void putShortVolatile(Object o, long offset, short x) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
-        putShort(o, offset, x);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
-    }
-
-    public char getChar(Object o, long offset) {
-        @JavacBug(id = 6995200)
-        Character result = UnsafeLoadNode.load(o, offset, CiKind.Char);
-        return result;
-    }
-
-    public char getCharVolatile(Object o, long offset) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
-        char result = getChar(o, offset);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
-        return result;
-    }
-
-    public void putChar(Object o, long offset, char x) {
-        UnsafeStoreNode.store(o, offset, x, CiKind.Char);
-    }
-
-    public void putCharVolatile(Object o, long offset, char x) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
-        putChar(o, offset, x);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
-    }
-
-    public long getLong(Object o, long offset) {
-        @JavacBug(id = 6995200)
-        Long result = UnsafeLoadNode.load(o, offset, CiKind.Long);
-        return result;
-    }
-
-    public long getLongVolatile(Object o, long offset) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
-        long result = getLong(o, offset);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
-        return result;
-    }
-
-    public void putLong(Object o, long offset, long x) {
-        UnsafeStoreNode.store(o, offset, x, CiKind.Long);
-    }
-
-    public void putLongVolatile(Object o, long offset, long x) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
-        putLong(o, offset, x);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
-    }
-
-    public float getFloat(Object o, long offset) {
-        @JavacBug(id = 6995200)
-        Float result = UnsafeLoadNode.load(o, offset, CiKind.Float);
-        return result;
-    }
-
-    public float getFloatVolatile(Object o, long offset) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
-        float result = getFloat(o, offset);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
-        return result;
-    }
-
-    public void putFloat(Object o, long offset, float x) {
-        UnsafeStoreNode.store(o, offset, x, CiKind.Float);
-    }
-
-    public void putFloatVolatile(Object o, long offset, float x) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
-        putFloat(o, offset, x);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
-    }
-
-    public double getDouble(Object o, long offset) {
-        @JavacBug(id = 6995200)
-        Double result = UnsafeLoadNode.load(o, offset, CiKind.Double);
-        return result;
-    }
-
-    public double getDoubleVolatile(Object o, long offset) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_READ);
-        double result = getDouble(o, offset);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_READ);
-        return result;
-    }
-
-    public void putDouble(Object o, long offset, double x) {
-        UnsafeStoreNode.store(o, offset, x, CiKind.Double);
-    }
-
-    public void putDoubleVolatile(Object o, long offset, double x) {
-        MembarNode.get(MemoryBarriers.JMM_PRE_VOLATILE_WRITE);
-        putDouble(o, offset, x);
-        MembarNode.get(MemoryBarriers.JMM_POST_VOLATILE_WRITE);
-    }
-}
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/nodes/MathIntrinsicNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/nodes/MathIntrinsicNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -22,8 +22,11 @@
  */
 package com.oracle.max.graal.snippets.nodes;
 
+import static com.oracle.max.graal.compiler.target.amd64.AMD64Arithmetic.*;
+
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.graal.compiler.lir.*;
+import com.oracle.max.graal.compiler.target.amd64.AMD64Arithmetic.Op2Reg;
 import com.oracle.max.graal.compiler.target.amd64.*;
 import com.oracle.max.graal.compiler.util.*;
 import com.oracle.max.graal.nodes.*;
@@ -61,13 +64,13 @@
         Variable input = gen.load(gen.operand(x()));
         Variable result = gen.newVariable(kind());
         switch (operation()) {
-            case ABS:   gen.append(AMD64LogicFloatOpcode.DAND.create(result, input, CiConstant.forDouble(Double.longBitsToDouble(0x7FFFFFFFFFFFFFFFL)))); break;
-            case SQRT:  gen.append(AMD64MathIntrinsicOpcode.SQRT.create(result, input)); break;
-            case LOG:   gen.append(AMD64MathIntrinsicOpcode.LOG.create(result, input)); break;
-            case LOG10: gen.append(AMD64MathIntrinsicOpcode.LOG10.create(result, input)); break;
-            case SIN:   gen.append(AMD64MathIntrinsicOpcode.SIN.create(result, input)); break;
-            case COS:   gen.append(AMD64MathIntrinsicOpcode.COS.create(result, input)); break;
-            case TAN:   gen.append(AMD64MathIntrinsicOpcode.TAN.create(result, input)); break;
+            case ABS:   gen.append(new Op2Reg(DAND, result, input, CiConstant.forDouble(Double.longBitsToDouble(0x7FFFFFFFFFFFFFFFL)))); break;
+            case SQRT:  gen.append(new AMD64MathIntrinsicOp(AMD64MathIntrinsicOp.Opcode.SQRT, result, input)); break;
+            case LOG:   gen.append(new AMD64MathIntrinsicOp(AMD64MathIntrinsicOp.Opcode.LOG, result, input)); break;
+            case LOG10: gen.append(new AMD64MathIntrinsicOp(AMD64MathIntrinsicOp.Opcode.LOG10, result, input)); break;
+            case SIN:   gen.append(new AMD64MathIntrinsicOp(AMD64MathIntrinsicOp.Opcode.SIN, result, input)); break;
+            case COS:   gen.append(new AMD64MathIntrinsicOp(AMD64MathIntrinsicOp.Opcode.COS, result, input)); break;
+            case TAN:   gen.append(new AMD64MathIntrinsicOp(AMD64MathIntrinsicOp.Opcode.TAN, result, input)); break;
             default:    throw Util.shouldNotReachHere();
         }
         gen.setResult(this, result);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/target/amd64/AMD64MathIntrinsicOp.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2011, 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.snippets.target.amd64;
+
+import static com.oracle.max.cri.ci.CiValueUtil.*;
+
+import java.util.*;
+
+import com.oracle.max.asm.target.amd64.*;
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.graal.compiler.asm.*;
+import com.oracle.max.graal.compiler.lir.*;
+import com.oracle.max.graal.compiler.target.amd64.*;
+import com.oracle.max.graal.compiler.util.*;
+
+public class AMD64MathIntrinsicOp extends AMD64LIRInstruction {
+    public enum Opcode  {
+        SQRT,
+        SIN, COS, TAN,
+        LOG, LOG10;
+    }
+
+    public AMD64MathIntrinsicOp(Opcode opcode, CiValue result, CiValue input) {
+        super(opcode, new CiValue[] {result}, null, new CiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS);
+    }
+
+    @Override
+    public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+        Opcode opcode = (Opcode) code;
+        CiValue result = output(0);
+        CiValue input = input(0);
+
+        switch (opcode) {
+            case SQRT:  masm.sqrtsd(asDoubleReg(result), asDoubleReg(input)); break;
+            case LOG:   masm.flog(asDoubleReg(result), asDoubleReg(input), false); break;
+            case LOG10: masm.flog(asDoubleReg(result), asDoubleReg(input), true); break;
+            case SIN:   masm.fsin(asDoubleReg(result), asDoubleReg(input)); break;
+            case COS:   masm.fcos(asDoubleReg(result), asDoubleReg(input)); break;
+            case TAN:   masm.ftan(asDoubleReg(result), asDoubleReg(input)); break;
+            default:    throw Util.shouldNotReachHere();
+        }
+    }
+
+    @Override
+    protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
+        if (mode == OperandMode.Input && index == 0) {
+            return EnumSet.of(OperandFlag.Register);
+        } else if (mode == OperandMode.Output && index == 0) {
+            return EnumSet.of(OperandFlag.Register);
+        }
+        throw Util.shouldNotReachHere();
+    }
+}
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/target/amd64/AMD64MathIntrinsicOpcode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2011, 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.snippets.target.amd64;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.target.amd64.*;
-import com.oracle.max.graal.compiler.util.*;
-
-public enum AMD64MathIntrinsicOpcode implements LIROpcode {
-    SQRT,
-    SIN, COS, TAN,
-    LOG, LOG10;
-
-    public LIRInstruction create(Variable result, Variable input) {
-        CiValue[] inputs = new CiValue[] {input};
-        CiValue[] outputs = new CiValue[] {result};
-
-        return new AMD64LIRInstruction(this, outputs, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) {
-            @Override
-            public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-                emit(tasm, masm, asDoubleReg(output(0)), asDoubleReg(input(0)));
-            }
-        };
-    }
-
-    /**
-     * @param tasm
-     */
-    private void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiRegister result, CiRegister input) {
-        switch (this) {
-            case SQRT:  masm.sqrtsd(result, input); break;
-            case LOG:   masm.flog(result, input, false); break;
-            case LOG10: masm.flog(result, input, true); break;
-            case SIN:   masm.fsin(result, input); break;
-            case COS:   masm.fcos(result, input); break;
-            case TAN:   masm.ftan(result, input); break;
-            default:    throw Util.shouldNotReachHere();
-        }
-    }
-}
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/BoxingEliminationTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/BoxingEliminationTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -22,12 +22,15 @@
  */
 package com.oracle.max.graal.compiler.tests;
 
+import static com.oracle.max.graal.graph.iterators.NodePredicates.*;
+
 import java.util.*;
 
 import org.junit.*;
 
 import com.oracle.max.graal.compiler.phases.*;
 import com.oracle.max.graal.compiler.phases.PhasePlan.PhasePosition;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.extended.*;
@@ -96,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()) {
@@ -109,9 +108,9 @@
         }
         new InliningPhase(null, runtime(), hints, null, phasePlan).apply(graph);
         new CanonicalizerPhase(null, runtime(), null).apply(graph);
-        print(graph);
+        Debug.dump(graph, "Graph");
         new BoxingEliminationPhase().apply(graph);
-        print(graph);
+        Debug.dump(graph, "Graph");
         new ExpandBoxingNodesPhase(pool).apply(graph);
         new CanonicalizerPhase(null, runtime(), null).apply(graph);
         new DeadCodeEliminationPhase().apply(graph);
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/DegeneratedLoopsTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/DegeneratedLoopsTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -22,11 +22,13 @@
  */
 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.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 
@@ -80,21 +82,17 @@
 
     private void test(String snippet) {
         StructuredGraph graph = parse(snippet);
-        print(graph);
+        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);
         }
         new CanonicalizerPhase(null, runtime(), null).apply(graph);
-        StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET); print(referenceGraph);
+        StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET); Debug.dump(referenceGraph, "Graph");
         assertEquals(referenceGraph, graph);
     }
 }
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/EscapeAnalysisTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/EscapeAnalysisTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -28,6 +28,7 @@
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.graal.compiler.phases.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.java.*;
 
@@ -122,9 +123,9 @@
 
         new InliningPhase(null, runtime(), null, null, getDefaultPhasePlan()).apply(graph);
         new DeadCodeEliminationPhase().apply(graph);
-        print(graph);
+        Debug.dump(graph, "Graph");
         new EscapeAnalysisPhase(null, runtime(), null, getDefaultPhasePlan()).apply(graph);
-        print(graph);
+        Debug.dump(graph, "Graph");
         int retCount = 0;
         for (ReturnNode ret : graph.getNodes(ReturnNode.class)) {
             Assert.assertTrue(ret.result().isConstant());
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/GraphTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/GraphTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,18 +24,15 @@
 
 import java.lang.reflect.*;
 
-import org.junit.*;
-
 import junit.framework.Assert;
 
 import com.oracle.max.cri.ri.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.phases.*;
 import com.oracle.max.graal.compiler.phases.PhasePlan.*;
 import com.oracle.max.graal.cri.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.java.*;
 import com.oracle.max.graal.nodes.*;
-import com.oracle.max.graal.printer.*;
 
 /**
  * Base class for Graal compiler unit tests. These are white box tests
@@ -51,28 +48,20 @@
  * <p>
  * The tests can be run in Eclipse with the "Compiler Unit Test" Eclipse
  * launch configuration found in the top level of this project or by
- * running {@code mx gcut} on the command line.
+ * running {@code mx unittest} on the command line.
  */
 public abstract class GraphTest {
 
     protected final GraalRuntime runtime;
-    private static IdealGraphPrinterObserver observer;
 
     public GraphTest() {
         this.runtime = GraalRuntimeAccess.getGraalRuntime();
     }
 
-    @BeforeClass
-    public static void init() {
-        IdealGraphPrinterObserver o = new IdealGraphPrinterObserver(GraalOptions.PrintIdealGraphAddress, GraalOptions.PrintIdealGraphPort);
-        if (o.networkAvailable()) {
-            observer = o;
-        }
-    }
-
     protected void assertEquals(StructuredGraph expected, StructuredGraph graph) {
         if (expected.getNodeCount() != graph.getNodeCount()) {
-            print("Node count not matching", expected, graph);
+            Debug.dump(expected, "Node count not matching - expected");
+            Debug.dump(graph, "Node count not matching - actual");
             Assert.fail("Graphs do not have the same number of nodes");
         }
     }
@@ -94,7 +83,31 @@
                 found = m;
             }
         }
-        return parse(found);
+        if (found != null) {
+            return parse(found);
+        } else {
+            throw new RuntimeException("method not found: " + methodName);
+        }
+    }
+
+    /**
+     * Parses a Java method to produce a graph.
+     *
+     * @param methodName the name of the method in {@code this.getClass()} to be parsed
+     */
+    protected StructuredGraph parseProfiled(String methodName) {
+        Method found = null;
+        for (Method m : this.getClass().getMethods()) {
+            if (m.getName().equals(methodName)) {
+                Assert.assertNull(found);
+                found = m;
+            }
+        }
+        if (found != null) {
+            return parseProfiled(found);
+        } else {
+            throw new RuntimeException("method not found: " + methodName);
+        }
     }
 
     /**
@@ -103,25 +116,23 @@
     protected StructuredGraph parse(Method m) {
         RiResolvedMethod riMethod = runtime.getRiMethod(m);
         StructuredGraph graph = new StructuredGraph(riMethod);
-        new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDeoptFreeDefault()).apply(graph);
+        new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getSnippetDefault()).apply(graph);
+        return graph;
+    }
+
+    /**
+     * Parses a Java method to produce a graph.
+     */
+    protected StructuredGraph parseProfiled(Method m) {
+        RiResolvedMethod riMethod = runtime.getRiMethod(m);
+        StructuredGraph graph = new StructuredGraph(riMethod);
+        new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault()).apply(graph);
         return graph;
     }
 
     protected PhasePlan getDefaultPhasePlan() {
         PhasePlan plan = new PhasePlan();
-        plan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDeoptFreeDefault()));
+        plan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getSnippetDefault()));
         return plan;
     }
-
-    protected void print(String title, StructuredGraph... graphs) {
-        if (observer != null) {
-            observer.printGraphs(getClass().getSimpleName() + ": " + title, graphs);
-        }
-    }
-
-    protected void print(StructuredGraph graph) {
-        if (observer != null) {
-            observer.printSingleGraph(getClass().getSimpleName(), graph);
-        }
-    }
 }
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/IfBoxingEliminationTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/IfBoxingEliminationTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -28,6 +28,7 @@
 
 import com.oracle.max.graal.compiler.phases.*;
 import com.oracle.max.graal.compiler.phases.PhasePlan.PhasePosition;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.extended.*;
 
@@ -84,9 +85,9 @@
         new CanonicalizerPhase(null, runtime(), null).apply(graph);
         new PhiStampPhase().apply(graph);
         new CanonicalizerPhase(null, runtime(), null).apply(graph);
-        print(graph);
+        Debug.dump(graph, "Graph");
         new BoxingEliminationPhase().apply(graph);
-        print(graph);
+        Debug.dump(graph, "Graph");
         new ExpandBoxingNodesPhase(pool).apply(graph);
         new CanonicalizerPhase(null, runtime(), null).apply(graph);
         new DeadCodeEliminationPhase().apply(graph);
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/IfCanonicalizerTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/IfCanonicalizerTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -22,9 +22,12 @@
  */
 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.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 
@@ -136,14 +139,10 @@
         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);
         }
-        print(graph);
+        Debug.dump(graph, "Graph");
         new CanonicalizerPhase(null, runtime(), null).apply(graph);
         StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET);
         assertEquals(referenceGraph, graph);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/InvokeExceptionTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,69 @@
+/*
+ * 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.tests;
+
+import java.util.*;
+
+import org.junit.*;
+
+import com.oracle.max.graal.compiler.phases.*;
+import com.oracle.max.graal.nodes.*;
+
+public class InvokeExceptionTest extends GraphTest {
+
+    public static synchronized void throwException(int i) {
+        if (i == 1) {
+            throw new RuntimeException();
+        }
+    }
+
+    @Test
+    public void test1() {
+        // fill the profiling data...
+        for (int i = 0; i < 10000; i++) {
+            try {
+                throwException(i & 1);
+                test1Snippet(0);
+            } catch (Throwable t) {
+                // nothing to do...
+            }
+        }
+        test("test1Snippet");
+    }
+
+    @SuppressWarnings("all")
+    public static void test1Snippet(int a) {
+        throwException(a);
+    }
+
+    private void test(String snippet) {
+        StructuredGraph graph = parseProfiled(snippet);
+        Collection<Invoke> hints = new ArrayList<>();
+        for (Invoke invoke : graph.getInvokes()) {
+            hints.add(invoke);
+        }
+        new InliningPhase(null, runtime(), hints, null, getDefaultPhasePlan()).apply(graph);
+        new CanonicalizerPhase(null, runtime(), null).apply(graph);
+        new DeadCodeEliminationPhase().apply(graph);
+    }
+}
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/InvokeTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/InvokeTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/MonitorTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -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()) {
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/NestedLoopTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/NestedLoopTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,100 +25,96 @@
 import org.junit.*;
 
 import com.oracle.max.graal.compiler.loop.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.nodes.*;
 
-/**
- * In the following tests, the usages of local variable "a" are replaced with the integer constant 0.
- * Then canonicalization is applied and it is verified that the resulting graph is equal to the
- * graph of the method that just has a "return 1" statement in it.
- */
 public class NestedLoopTest extends GraphTest {
 
     @Test
     public void test1() {
-        test("test1Snippet");
+        test("test1Snippet", 5, 5, 4);
     }
 
     @Test
     public void test2() {
-        test("test2Snippet");
+        test("test2Snippet", 2, 5, 4);
     }
 
     @Test
     public void test3() {
-        test("test3Snippet");
+        test("test3Snippet", 1, 5, 4);
     }
 
     @Test
     public void test4() {
-        test("test4Snippet");
+        test("test4Snippet", 1, 6, 4);
     }
 
     @SuppressWarnings("all")
     public static void test1Snippet(int a) {
-        while (a()) {
-            m1: while (b()) {
-                while (c()) {
-                    if (d()) {
-                        break m1;
+        while (a()) { // a() exits root, while() exits root
+            m1: while (b()) { // b() exits nested & root, while() exits nested
+                while (c()) { // c() exits innermost & nested & root, while() exits innermost
+                    if (d()) { // d() exits innermost & nested & root
+                        break m1; // break exits innermost & nested
                     }
                 }
             }
         }
-    }
+    }// total : root = 5 exits, nested = 5, innermost = 4
 
     @SuppressWarnings("all")
     public static void test2Snippet(int a) {
-        while (a()) {
+        while (a()) { // a() exits root, while() exits root
             try {
-                m1: while (b()) {
-                    while (c()) {
-                        if (d()) {
-                            break m1;
+                m1: while (b()) { // b() exits nested, while() exits nested
+                    while (c()) { // c() exits innermost & nested, while() exits innermost
+                        if (d()) { // d() exits innermost & nested
+                            break m1; // break exits innermost & nested
                         }
                     }
                 }
             } catch (Throwable t) {
             }
         }
-    }
+    }// total : root = 2 exits, nested = 5, innermost = 4
 
     @SuppressWarnings("all")
     public static void test3Snippet(int a) {
-        while (a == 0) {
+        while (a == 0) { // while() exits root
             try {
-                m1: while (b()) {
-                    while (c()) {
-                        if (d()) {
-                            a();
-                            break m1;
+                m1: while (b()) { // b() exits nested, while() exits nested
+                    while (c()) { // c() exits innermost & nested, while() exits innermost
+                        if (d()) { // d() exits innermost & nested
+                            a(); // a() exits nothing (already outside innermost & nested)
+                            break m1; // break exits innermost & nested
                         }
                     }
                 }
             } catch (Throwable t) {
             }
         }
-    }
+    }// total : root = 1 exit, nested = 5, innermost = 4
 
     public static void test4Snippet(int a) {
-        while (a != 0) {
+        while (a != 0) { // while() exits root
             try {
-                m1: while (a != 0) {
-                    b();
-                    while (c()) {
-                        if (d()) {
-                            break m1;
+                m1: while (a != 0) { // while() exits nested
+                    b(); // b() exits nested
+                    while (c()) { // c() exits innermost & nested, while() exits innermost
+                        if (d()) { // d() exits innermost & nested
+                            break m1; // break exits innermost & nested
                         }
                     }
                     if (a != 2) {
-                        a();
-                        throw new Exception();
+                        a(); // a() exits nothing (already outside innermost & nested)
+                        throw new Exception(); // throw exits nested
                     }
                 }
             } catch (Throwable t) {
             }
         }
-    }
+    } // total : root = 1 exit, nested = 6, innermost = 4
 
     private static boolean a() {
         return false;
@@ -145,9 +141,9 @@
         return null;
     }
 
-    private void test(String snippet) {
+    private void test(String snippet, int rootExits, int nestedExits, int innerExits) {
         StructuredGraph graph = parse(snippet);
-        print(graph);
+        Debug.dump(graph, "Graph");
         LoopInfo loopInfo = LoopUtil.computeLoopInfo(graph);
         loopInfo.print();
         Loop rootLoop = loopInfo.rootLoops().get(0);
@@ -157,10 +153,15 @@
         Invoke b = getInvoke("b", graph);
         Invoke c = getInvoke("c", graph);
         Invoke d = getInvoke("d", graph);
-        Assert.assertTrue(rootLoop.localContainsFixed((FixedNode) a));
-        Assert.assertTrue(nestedLoop.localContainsFixed((FixedNode) b));
-        Assert.assertTrue(innerMostLoop.localContainsFixed((FixedNode) c));
-        Assert.assertTrue(innerMostLoop.localContainsFixed((FixedNode) d));
-        print(graph);
+        Assert.assertTrue(rootLoop.containsDirectFixed((FixedNode) a));
+        Assert.assertTrue(nestedLoop.containsDirectFixed((FixedNode) b));
+        Assert.assertTrue(innerMostLoop.containsDirectFixed((FixedNode) c));
+        Assert.assertTrue(innerMostLoop.containsDirectFixed((FixedNode) d));
+        Assert.assertTrue(rootLoop.containsFixed((FixedNode) d));
+        Assert.assertTrue(nestedLoop.containsFixed((FixedNode) d));
+        Assert.assertEquals(rootExits, rootLoop.exits().cardinality());
+        Assert.assertEquals(nestedExits, nestedLoop.exits().cardinality());
+        Assert.assertEquals(innerExits, innerMostLoop.exits().cardinality());
+        Debug.dump(graph, "Graph");
     }
 }
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/PhiCreationTests.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/PhiCreationTests.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,6 +24,7 @@
 
 import org.junit.*;
 
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.nodes.*;
 
 /**
@@ -66,7 +67,7 @@
     @Test
     public void test3() {
         StructuredGraph graph = parse("test3Snippet");
-        print(graph);
+        Debug.dump(graph, "Graph");
         Assert.assertFalse(graph.getNodes(PhiNode.class).iterator().hasNext());
     }
 
@@ -82,7 +83,7 @@
     @Test
     public void test4() {
         StructuredGraph graph = parse("test4Snippet");
-        print(graph);
+        Debug.dump(graph, "Graph");
         Assert.assertFalse(graph.getNodes(PhiNode.class).iterator().hasNext());
     }
 
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/ScalarTypeSystemTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/ScalarTypeSystemTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -27,6 +27,7 @@
 import org.junit.*;
 
 import com.oracle.max.graal.compiler.phases.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.nodes.*;
 
 /**
@@ -162,7 +163,7 @@
 
     private void test(String snippet, String referenceSnippet) {
         StructuredGraph graph = parse(snippet);
-        print(graph);
+        Debug.dump(graph, "Graph");
         new CanonicalizerPhase(null, runtime(), null).apply(graph);
         StructuredGraph referenceGraph = parse(referenceSnippet);
         assertEquals(referenceGraph, graph);
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/StraighteningTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/StraighteningTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -27,6 +27,7 @@
 import org.junit.*;
 
 import com.oracle.max.graal.compiler.phases.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.nodes.*;
 
 public class StraighteningTest extends GraphTest {
@@ -87,7 +88,7 @@
 
     private void test(String snippet) {
         StructuredGraph graph = parse(snippet);
-        print(graph);
+        Debug.dump(graph, "Graph");
         new CanonicalizerPhase(null, runtime(), null).apply(graph);
         StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET);
         assertEquals(referenceGraph, graph);
--- a/mx.bat	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-python mxtool/mx.py %*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mx.cmd	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,1 @@
+python mxtool/mx.py %*
--- a/mx/commands.py	Thu Feb 02 15:40:30 2012 -0800
+++ b/mx/commands.py	Thu Feb 02 16:07:52 2012 -0800
@@ -34,7 +34,16 @@
 import json
 
 _graal_home = dirname(dirname(__file__))
+
+""" Used to distinguish an exported GraalVM (see 'mx export'). """
 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src')) 
+
+""" The VM that will be run by the 'vm' command: graal(default), client or server.
+    This can be set via the global '--vm' option. """
+_vm = 'graal'
+
+""" The VM build that will be run by the 'vm' command: product(default), fastdebug or debug.
+    This can be set via the global '--fastdebug' and '--debug' options. """
 _vmbuild = 'product'
 
 _copyrightTemplate = """/*
@@ -133,7 +142,7 @@
         res = []
         mx.log("=== Server VM ===")
         printArg = '-XX:+PrintCompilation' if verbose else '-XX:-PrintCompilation'
-        res.append(vm(['-cp', cp, printArg] + sharedArgs, vm="-server"))
+        res.append(vm(['-cp', cp, printArg] + sharedArgs, vm='server'))
         mx.log("=== Graal VM ===")
         printArg = '-G:+PrintCompilation' if verbose else '-G:-PrintCompilation'
         res.append(vm(['-cp', cp, printArg, '-G:-Extend', '-G:-Inline'] + sharedArgs))
@@ -204,7 +213,7 @@
     
     failed = []
     for (test, n) in numTests.items():
-        if not sanitycheck.getDacapo(test, n, dacapoArgs).test('-graal', opts=vmOpts):
+        if not sanitycheck.getDacapo(test, n, dacapoArgs).test('graal', opts=vmOpts):
             failed.append(test)
     
     if len(failed) != 0:
@@ -304,6 +313,7 @@
 
 
     parser = ArgumentParser(prog='mx build');
+    parser.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to be built')
     
     # Call mx.build to compile the Java sources        
     opts = mx.build(['--source', '1.7'] + args, parser=parser)
@@ -315,31 +325,30 @@
     if len(builds) == 0:
         builds = ['product']
 
+    vm = opts.vm
+    if vm == 'server':
+        buildSuffix = ''
+    elif vm == 'client':
+        buildSuffix = '1'
+    else:
+        assert vm is 'graal'
+        buildSuffix = 'graal'
+        
     for build in builds:
 
         jdk = _jdk(build, True)
         if build == 'debug':
             build = 'jvmg'
-        
-        graalVmDir = join(jdk, 'jre', 'lib', 'amd64', 'graal')
-        if not exists(graalVmDir):
-            mx.log('Creating Graal directory in JDK7: ' + graalVmDir)
-            os.makedirs(graalVmDir)
+            
+        vmDir = join(jdk, 'jre', 'lib', 'amd64', vm)
+        if not exists(vmDir):
+            mx.log('Creating VM directory in JDK7: ' + vmDir)
+            os.makedirs(vmDir)
     
         def filterXusage(line):
             if not 'Xusage.txt' in line:
                 sys.stderr.write(line + os.linesep)
                 
-        # Update graal_paths.hpp
-        out = StringIO.StringIO()
-        out.write(_copyrightTemplate.format(time.strftime('%Y')))
-        for p in mx.project('com.oracle.max.graal.hotspot').all_deps([], False):
-            out.write('    prepend_to_graal_classpath(scp_compiler, graal_dir, "' + p.name + '");\n')
-        graalPaths = join(_graal_home, 'src', 'share', 'vm', 'graal', 'graal_paths.hpp')
-        assert exists(graalPaths), 'File does not exist: ' + graalPaths
-        mx.update_file(graalPaths, out.getvalue())
-        out.close()
-                
         if platform.system() == 'Windows':
             compilelogfile = _graal_home + '/graalCompile.log'
             mksHome = mx.get_env('MKS_HOME', 'C:\\cygwin\\bin')
@@ -363,16 +372,20 @@
             env.setdefault('HOTSPOT_BUILD_JOBS', '3')
             env['ALT_BOOTDIR'] = jdk
             env.setdefault('INSTALL', 'y')
-            mx.run([mx.gmake_cmd(), build + 'graal'], cwd=join(_graal_home, 'make'), err=filterXusage)
+            mx.run([mx.gmake_cmd(), build + buildSuffix], cwd=join(_graal_home, 'make'), err=filterXusage)
     
-def vm(args, vm='-graal', nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None):
+def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None):
     """run the GraalVM"""
 
+    if vm is None:
+        vm = _vm
+        
     build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product'
+    mx.expand_project_in_args(args)  
     if mx.java().debug:
         args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000'] + args
     exe = join(_jdk(build), 'bin', mx.exe_suffix('java'))
-    return mx.run([exe, vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
+    return mx.run([exe, '-' + vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
 
 
 # Table of unit tests.
@@ -494,7 +507,7 @@
             
             for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild):
                 t = Task(str(test) + ':' + vmbuild)
-                if not test.test('-graal'):
+                if not test.test('graal'):
                     t.abort(test.group + ' ' + test.name + ' Failed')
                 t.stop()
     except KeyboardInterrupt:
@@ -508,7 +521,7 @@
     total.stop()
 
 def bench(args):
-    """run benchmarks and parse their ouput for results
+    """run benchmarks and parse their output for results
 
     Results are JSON formated : {group : {benchmark : score}}."""
     resultFile = None
@@ -537,24 +550,37 @@
     #DaCapo
     if ('dacapo' in args or 'all' in args):
         benchmarks += sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
+    else:
+        dacapos = [a[7:] for a in args if a.startswith('dacapo:')]
+        for dacapo in dacapos:
+            if dacapo not in sanitycheck.dacapoSanityWarmup.keys():
+                mx.abort('Unknown dacapo : ' + dacapo)
+            benchmarks += [sanitycheck.getDacapo(dacapo, sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark])]
+        
     #Bootstrap
     if ('bootstrap' in args or 'all' in args):
         benchmarks += sanitycheck.getBootstraps()
     #SPECjvm2008
     if ('specjvm2008' in args or 'all' in args):
-        benchmarks += [sanitycheck.getSPECjvm2008(True, 120, 120)]
+        benchmarks += [sanitycheck.getSPECjvm2008([], True, 120, 120)]
+    else:
+        specjvms = [a[12:] for a in args if a.startswith('specjvm2008:')]
+        for specjvm in specjvms:
+            benchmarks += [sanitycheck.getSPECjvm2008([specjvm], True, 120, 120)]
     
     for test in benchmarks:
         if not results.has_key(test.group):
             results[test.group] = {}
-        results[test.group].update(test.bench('-' + vm))
+        results[test.group].update(test.bench(vm))
     mx.log(json.dumps(results))
     if resultFile:
         with open(resultFile, 'w') as f:
             f.write(json.dumps(results))
     
 def specjvm2008(args):
-    sanitycheck.getSPECjvm2008().bench('-graal')
+    benchArgs = [a[1:] for a in args if a[0] == '@']
+    vmArgs = [a for a in args if a[0] != '@']
+    sanitycheck.getSPECjvm2008(benchArgs).bench('graal', opts=vmArgs)
     
 def mx_init():
     _vmbuild = 'product'
@@ -572,9 +598,10 @@
     }
 
     if (_vmSourcesAvailable):
-        mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product VM')
-        mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug VM')
-        mx.add_argument('--fastdebug', action='store_const', dest='vmbuild', const='fastdebug', help='select the fast debug VM')
+        mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to run (default: graal)')
+        mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product build of the VM')
+        mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug build of the VM')
+        mx.add_argument('--fastdebug', action='store_const', dest='vmbuild', const='fastdebug', help='select the fast debug build of the VM')
         
         commands.update({
             'export': [export, '[-options] [zipfile]'],
@@ -593,6 +620,8 @@
         mx.abort('Requires Java version 1.7 or greater, got version ' + version)
     
     if (_vmSourcesAvailable):
+        global _vm
+        _vm = opts.vm
         if hasattr(opts, 'vmbuild') and opts.vmbuild is not None:
             global _vmbuild
             _vmbuild = opts.vmbuild
--- a/mx/eclipse-settings/org.eclipse.jdt.core.prefs	Thu Feb 02 15:40:30 2012 -0800
+++ b/mx/eclipse-settings/org.eclipse.jdt.core.prefs	Thu Feb 02 16:07:52 2012 -0800
@@ -167,7 +167,7 @@
 org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
 org.eclipse.jdt.core.formatter.comment.format_block_comments=true
 org.eclipse.jdt.core.formatter.comment.format_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
 org.eclipse.jdt.core.formatter.comment.format_html=true
 org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
 org.eclipse.jdt.core.formatter.comment.format_line_comments=true
--- a/mx/eclipse-settings/org.eclipse.jdt.ui.prefs	Thu Feb 02 15:40:30 2012 -0800
+++ b/mx/eclipse-settings/org.eclipse.jdt.ui.prefs	Thu Feb 02 16:07:52 2012 -0800
@@ -48,7 +48,7 @@
 cleanup_settings_version=2
 comment_clear_blank_lines=false
 comment_format_comments=true
-comment_format_header=true
+comment_format_header=false
 comment_format_html=true
 comment_format_source_code=true
 comment_indent_parameter_description=true
--- a/mx/projects	Thu Feb 02 15:40:30 2012 -0800
+++ b/mx/projects	Thu Feb 02 16:07:52 2012 -0800
@@ -50,7 +50,12 @@
 # graal.graph
 project@com.oracle.max.graal.graph@subDir=graal
 project@com.oracle.max.graal.graph@sourceDirs=src
-project@com.oracle.max.graal.graph@dependencies=JUNIT
+project@com.oracle.max.graal.graph@dependencies=com.oracle.max.graal.debug,JUNIT
+
+# graal.debug
+project@com.oracle.max.graal.debug@subDir=graal
+project@com.oracle.max.graal.debug@sourceDirs=src
+project@com.oracle.max.graal.debug@checkstyle=com.oracle.max.graal.graph
 
 # graal.snippets
 project@com.oracle.max.graal.snippets@subDir=graal
--- a/mx/sanitycheck.py	Thu Feb 02 15:40:30 2012 -0800
+++ b/mx/sanitycheck.py	Thu Feb 02 16:07:52 2012 -0800
@@ -27,7 +27,6 @@
 import re
 import mx
 import os
-import commands
 from os.path import isfile, join, exists
 
 dacapoSanityWarmup = {
@@ -67,16 +66,16 @@
 class SanityCheckLevel:
     Fast, Gate, Normal, Extensive, Benchmark = range(5)
     
-def getSPECjvm2008(skipKitValidation=False, warmupTime=None, iterationTime=None):
+def getSPECjvm2008(benchArgs = [], skipKitValidation=False, warmupTime=None, iterationTime=None):
     
     specjvm2008 = mx.get_env('SPECJVM2008')
     if specjvm2008 is None or not exists(join(specjvm2008, 'SPECjvm2008.jar')):
         mx.abort('Please set the SPECJVM2008 environment variable to a SPECjvm2008 directory')
     
-    score = re.compile(r"^(Score on|Noncompliant) (?P<benchmark>[a-zA-Z0-9\.\-]+)( result)?: (?P<score>[0-9]+(,|\.)[0-9]+)( SPECjvm2008 Base)? ops/m$")
+    score = re.compile(r"^(Score on|Noncompliant) (?P<benchmark>[a-zA-Z0-9\._]+)( result)?: (?P<score>[0-9]+(,|\.)[0-9]+)( SPECjvm2008 Base)? ops/m$")
     error = re.compile(r"^Errors in benchmark: ")
     # The ' ops/m' at the end of the success string is important : it's how you can tell valid and invalid runs apart
-    success = re.compile(r"^(Noncompliant c|C)omposite result: [0-9]+,[0-9]+( SPECjvm2008 (Base|Peak))? ops/m$")
+    success = re.compile(r"^(Noncompliant c|C)omposite result: [0-9]+(,|\.)[0-9]+( SPECjvm2008 (Base|Peak))? ops/m$")
     matcher = Matcher(score, {'const:name' : 'benchmark', 'const:score' : 'score'}, startNewLine=True)
     
     opts = []
@@ -87,7 +86,7 @@
     if skipKitValidation:
         opts += ['-ikv']
     
-    return Test("SPECjvm2008", "SPECjvm2008", ['-jar', 'SPECjvm2008.jar'] + opts, [success], [error], [matcher], vmOpts=['-Xms3g'], defaultCwd=specjvm2008)
+    return Test("SPECjvm2008", "SPECjvm2008", ['-jar', 'SPECjvm2008.jar'] + opts + benchArgs, [success], [error], [matcher], vmOpts=['-Xms3g'], defaultCwd=specjvm2008)
 
 def getDacapos(level=SanityCheckLevel.Normal, gateBuildLevel=None, dacapoArgs=[]):
     checks = []
@@ -135,7 +134,7 @@
         self.name = name
         self.group = group
         self.successREs = successREs
-        self.failureREs = failureREs
+        self.failureREs = failureREs + [re.compile(r"Exception occured in scope: ")]
         self.scoreMatchers = scoreMatchers
         self.vmOpts = vmOpts
         self.cmd = cmd
@@ -162,6 +161,9 @@
         result = parser.parse(vm, self.vmOpts + opts + self.cmd, cwd, vmbuild)
         
         parsedLines = result['parsed']
+        if len(parsedLines) == 0:
+            return False
+        
         assert len(parsedLines) == 1, 'Test matchers should not return more than one line'
         
         parsed = parsedLines[0]
@@ -175,7 +177,7 @@
             os.unlink(parsed['jvmError'])
             return False
         
-        if parsed.has_key('failed') and parsed['failed'] is 1:
+        if parsed.has_key('failed') and parsed['failed'] is '1':
             return False
         
         return result['retcode'] is 0 and parsed.has_key('passed') and parsed['passed'] is '1'
@@ -188,6 +190,8 @@
             cwd = self.defaultCwd
         parser = OutputParser(nonZeroIsFatal = False)
         
+        for successRE in self.successREs:
+            parser.addMatcher(Matcher(successRE, {'const:passed' : 'const:1'}))
         for failureRE in self.failureREs:
             parser.addMatcher(Matcher(failureRE, {'const:failed' : 'const:1'}))
         for scoreMatcher in self.scoreMatchers:
@@ -195,16 +199,23 @@
             
         result = parser.parse(vm, self.vmOpts + opts + self.cmd, cwd, vmbuild)
         if result['retcode'] is not 0:
-            return {}
+            mx.abort("Benchmark failed (non-zero retcode)")
         
         parsed = result['parsed']
         
         ret = {}
         
+        passed = False;
+        
         for line in parsed:
-            assert line.has_key('name') and line.has_key('score')
-            if line.has_key('failed') and parsed['failed'] is 1:
-                return {}
+            assert (line.has_key('name') and line.has_key('score')) or line.has_key('passed')
+            if line.has_key('failed') and line['failed'] is '1':
+                mx.abort("Benchmark failed")
+            if line.has_key('passed') and line['passed'] is '1':
+                passed = True
             ret[line['name']] = line['score']
         
+        if not passed:
+            mx.abort("Benchmark failed (not passed)")
+        
         return ret
--- a/mxtool/mx.py	Thu Feb 02 15:40:30 2012 -0800
+++ b/mxtool/mx.py	Thu Feb 02 16:07:52 2012 -0800
@@ -592,7 +592,14 @@
             # The preexec_fn=os.setsid
             p = subprocess.Popen(args, cwd=cwd, preexec_fn=preexec_fn, creationflags=creationflags)
             _currentSubprocess = (p, args)
-            retcode = p.wait()
+            if get_os() == 'windows':
+                # on windows use a poll loop, otherwise signal does not get handled
+                retcode = None
+                while retcode == None:
+                    retcode = p.poll()
+                    time.sleep(0.05)
+            else:
+                retcode = p.wait()            
         else:
             def redirect(stream, f):
                 for line in iter(stream.readline, ''):
--- a/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -54,11 +54,11 @@
         bciValue = bytecode.getBci() + " " + bciValue;
         bciValue = bciValue.trim();
 
-        Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<InputNode>(graph.getNodes());
+        Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<>(graph.getNodes());
         StringPropertyMatcher matcher = new StringPropertyMatcher("bci", bciValue);
         List<InputNode> nodeList = selector.selectMultiple(matcher);
         if (nodeList.size() > 0) {
-            nodes = new LinkedHashSet<InputNode>();
+            nodes = new LinkedHashSet<>();
             for (InputNode n : nodeList) {
                 nodes.add(n);
             }
--- a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -37,6 +37,7 @@
         super(NbBundle.getMessage(BytecodeViewAction.class, "CTL_BytecodeViewAction"));
     }
 
+    @Override
     public void actionPerformed(ActionEvent evt) {
         TopComponent win = BytecodeViewTopComponent.findInstance();
         win.open();
--- a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java	Thu Feb 02 16:07:52 2012 -0800
@@ -34,11 +34,7 @@
 import org.openide.explorer.ExplorerManager;
 import org.openide.explorer.ExplorerUtils;
 import org.openide.explorer.view.BeanTreeView;
-import org.openide.util.Lookup;
-import org.openide.util.LookupEvent;
-import org.openide.util.LookupListener;
-import org.openide.util.NbBundle;
-import org.openide.util.Utilities;
+import org.openide.util.*;
 import org.openide.windows.TopComponent;
 import org.openide.windows.WindowManager;
 
@@ -128,7 +124,7 @@
 
     @Override
     public void componentOpened() {
-        Lookup.Template<InputGraphProvider> tpl = new Lookup.Template<InputGraphProvider>(InputGraphProvider.class);
+        Lookup.Template<InputGraphProvider> tpl = new Lookup.Template<>(InputGraphProvider.class);
         result = Utilities.actionsGlobalContext().lookup(tpl);
         result.addLookupListener(this);
     }
@@ -149,6 +145,7 @@
         return PREFERRED_ID;
     }
 
+    @Override
     public ExplorerManager getExplorerManager() {
         return manager;
     }
@@ -171,10 +168,12 @@
         return super.requestFocusInWindow(temporary);
     }
 
+    @Override
     public void resultChanged(LookupEvent lookupEvent) {
         final InputGraphProvider p = LookupHistory.getLast(InputGraphProvider.class);//)Utilities.actionsGlobalContext().lookup(InputGraphProvider.class);
         if (p != null) {
             SwingUtilities.invokeLater(new Runnable() {
+                @Override
                 public void run() {
                     InputGraph graph = p.getGraph();
                     if (graph != null) {
--- a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/MethodNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/MethodNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -50,6 +50,7 @@
             this.graph = graph;
         }
 
+        @Override
         protected Node[] createNodes(InputBytecode bc) {
             if (bc.getInlined() == null) {
                 return new Node[]{new BytecodeNode(bc, graph, bciString)};
--- a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/SelectBytecodesAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/SelectBytecodesAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -28,7 +28,6 @@
 import org.openide.nodes.Node;
 import org.openide.util.HelpCtx;
 import org.openide.util.NbBundle;
-import org.openide.util.Utilities;
 import org.openide.util.actions.CookieAction;
 
 /**
@@ -37,6 +36,7 @@
  */
 public final class SelectBytecodesAction extends CookieAction {
 
+    @Override
     protected void performAction(Node[] activatedNodes) {
         SelectBytecodesCookie c = activatedNodes[0].getCookie(SelectBytecodesCookie.class);
         InputGraphProvider p = LookupHistory.getLast(InputGraphProvider.class);//Utilities.actionsGlobalContext().lookup(InputGraphProvider.class);
@@ -45,14 +45,17 @@
         }
     }
 
+    @Override
     protected int mode() {
         return CookieAction.MODE_EXACTLY_ONE;
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(SelectBytecodesAction.class, "CTL_SelectBytecodesAction");
     }
 
+    @Override
     protected Class[] cookieClasses() {
         return new Class[]{
             SelectBytecodesCookie.class
@@ -65,6 +68,7 @@
         putValue("noIconInMenu", Boolean.TRUE);
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/build.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
-<!-- for some information on what you could do (e.g. targets to override). -->
-<!-- If you delete this file and reopen the project it will be recreated. -->
-<project name="com.sun.hotspot.igv.controlflow" default="netbeans" basedir=".">
-    <description>Builds, tests, and runs the project com.sun.hotspot.igv.controlflow.</description>
-    <import file="nbproject/build-impl.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/manifest.mf	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-OpenIDE-Module: com.sun.hotspot.igv.controlflow
-OpenIDE-Module-Layer: com/sun/hotspot/igv/controlflow/layer.xml
-OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/controlflow/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.0
-
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/build-impl.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-*** GENERATED FROM project.xml - DO NOT EDIT  ***
-***         EDIT ../build.xml INSTEAD         ***
--->
-<project name="com.sun.hotspot.igv.controlflow-impl" basedir="..">
-    <property file="nbproject/private/suite-private.properties"/>
-    <property file="nbproject/suite.properties"/>
-    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
-    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
-    <property file="${suite.dir}/nbproject/platform.properties"/>
-    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="name"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{name}" value="${@{value}}"/>
-        </sequential>
-    </macrodef>
-    <property file="${user.properties.file}"/>
-    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
-        <condition>
-            <not>
-                <available file="${harness.dir}" type="dir"/>
-            </not>
-        </condition>
-    </fail>
-    <import file="${harness.dir}/build.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/genfiles.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-build.xml.data.CRC32=b524efb3
-build.xml.script.CRC32=79a27be9
-build.xml.stylesheet.CRC32=79c3b980
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=b524efb3
-nbproject/build-impl.xml.script.CRC32=582bdab7
-nbproject/build-impl.xml.stylesheet.CRC32=deb65f65
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/platform.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-# Deprecated since 5.0u1; for compatibility with 5.0:
-disabled.clusters=\
-    apisupport1,\
-    harness,\
-    ide8,\
-    java1,\
-    nb6.0,\
-    profiler2
-disabled.modules=\
-    org.netbeans.core.execution,\
-    org.netbeans.core.multiview,\
-    org.netbeans.core.output2,\
-    org.netbeans.modules.applemenu,\
-    org.netbeans.modules.autoupdate.services,\
-    org.netbeans.modules.autoupdate.ui,\
-    org.netbeans.modules.core.kit,\
-    org.netbeans.modules.favorites,\
-    org.netbeans.modules.javahelp,\
-    org.netbeans.modules.masterfs,\
-    org.netbeans.modules.options.keymap,\
-    org.netbeans.modules.sendopts,\
-    org.netbeans.modules.templates,\
-    org.openide.compat,\
-    org.openide.execution,\
-    org.openide.util.enumerations
-enabled.clusters=\
-    platform7
-nbjdk.active=JDK_1.6
-nbplatform.active=default
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
-    <type>org.netbeans.modules.apisupport.project</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
-            <code-name-base>com.sun.hotspot.igv.controlflow</code-name-base>
-            <suite-component/>
-            <module-dependencies>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.data</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.hierarchicallayout</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.layout</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.util</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.jdesktop.layout</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <release-version>1</release-version>
-                        <specification-version>1.16.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.netbeans.api.visual</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>2.9</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.util</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>8.14.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.util.lookup</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>8.6.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.windows</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>6.16</specification-version>
-                    </run-dependency>
-                </dependency>
-            </module-dependencies>
-            <public-packages/>
-        </data>
-    </configuration>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/suite.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-suite.dir=${basedir}/..
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.controlflow;
-
-import com.sun.hotspot.igv.data.InputBlockEdge;
-import com.sun.hotspot.igv.layout.Link;
-import com.sun.hotspot.igv.layout.Port;
-import java.awt.BasicStroke;
-import java.awt.Point;
-import java.awt.Stroke;
-import java.util.ArrayList;
-import java.util.List;
-import org.netbeans.api.visual.widget.ConnectionWidget;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class BlockConnectionWidget extends ConnectionWidget implements Link {
-
-    private static final Stroke NORMAL_STROKE = new BasicStroke(1.0f);
-    private static final Stroke BOLD_STROKE = new BasicStroke(2.5f);
-    private static final Stroke DASHED_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, new float[]{5, 5}, 0);
-    private static final Stroke BOLD_DASHED_STROKE = new BasicStroke(2.5f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, new float[]{5, 5}, 0);
-    
-    private BlockWidget from;
-    private BlockWidget to;
-    private Port inputSlot;
-    private Port outputSlot;
-    private List<Point> points;
-    private InputBlockEdge edge;
-    private boolean isDashed = false;
-    private boolean isBold = false;
-
-    public BlockConnectionWidget(ControlFlowScene scene, InputBlockEdge edge) {
-        super(scene);
-
-        this.edge = edge;
-        this.from = (BlockWidget) scene.findWidget(edge.getFrom());
-        this.to = (BlockWidget) scene.findWidget(edge.getTo());
-        inputSlot = to.getInputSlot();
-        outputSlot = from.getOutputSlot();
-        points = new ArrayList<Point>();
-    }
-
-    public InputBlockEdge getEdge() {
-        return edge;
-    }
-
-    public Port getTo() {
-        return inputSlot;
-    }
-
-    public Port getFrom() {
-        return outputSlot;
-    }
-
-    public void setBold(boolean bold) {
-        this.isBold = bold;
-        updateStroke();
-    }
-
-    public void setDashed(boolean dashed) {
-        this.isDashed = dashed;
-        updateStroke();
-    }
-
-    private void updateStroke() {
-        Stroke stroke = NORMAL_STROKE;
-        if (isBold) {
-            if (isDashed) {
-                stroke = BOLD_DASHED_STROKE;
-            } else {
-                stroke = BOLD_STROKE;
-            }
-        } else if (isDashed) {
-            stroke = DASHED_STROKE;
-        }
-        setStroke(stroke);
-    }
-
-    public void setControlPoints(List<Point> p) {
-        this.points = p;
-    }
-
-    @Override
-    public List<Point> getControlPoints() {
-        return points;
-    }
-
-    @Override
-    public String toString() {
-        return "Connection[ " + from.toString() + " - " + to.toString() + "]";
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockWidget.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.controlflow;
-
-import com.sun.hotspot.igv.data.InputBlock;
-import com.sun.hotspot.igv.layout.Cluster;
-import com.sun.hotspot.igv.layout.Port;
-import com.sun.hotspot.igv.layout.Vertex;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.Point;
-import java.awt.Rectangle;
-import org.netbeans.api.visual.border.BorderFactory;
-import org.netbeans.api.visual.model.ObjectState;
-import org.netbeans.api.visual.widget.LabelWidget;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class BlockWidget extends LabelWidget implements Vertex {
-
-    public static final Dimension MIN_SIZE = new Dimension(20, 20);
-    private InputBlock block;
-    private Port inputSlot;
-    private Port outputSlot;
-    private Cluster cluster;
-    private boolean root;
-    private static final Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
-    private static final Font boldFont = font.deriveFont(Font.BOLD);
-    public static final Color NORMAL_FOREGROUND_COLOR = Color.BLACK;
-    public static final Color HOVER_FOREGROUND_COLOR = Color.BLUE;
-
-    /** Creates a new instance of BlockWidget */
-    public BlockWidget(ControlFlowScene scene, InputBlock block) {
-        super(scene);
-        this.block = block;
-        this.setLabel(block.getName());
-        this.setForeground(NORMAL_FOREGROUND_COLOR);
-        this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
-        this.setMinimumSize(MIN_SIZE);
-
-        this.setFont(font);
-        this.setAlignment(Alignment.CENTER);
-
-        final BlockWidget widget = this;
-        inputSlot = new Port() {
-            public Point getRelativePosition() {
-                return new Point((int) (getSize().getWidth() / 2), (int) (getSize().getHeight() / 2));
-            }
-            public Vertex getVertex() {
-                return widget;
-            }
-        };
-        outputSlot = new Port() {
-            public Point getRelativePosition() {
-                return new Point((int) (getSize().getWidth() / 2), (int) (getSize().getHeight() / 2));
-            }
-            public Vertex getVertex() {
-                return widget;
-            }
-        };
-    }
-
-    public Port getInputSlot() {
-        return inputSlot;
-    }
-
-    public Port getOutputSlot() {
-        return outputSlot;
-    }
-
-    public InputBlock getBlock() {
-        return block;
-    }
-
-    public Dimension getSize() {
-        Rectangle bounds = getBounds();
-        if (bounds != null) {
-            return bounds.getSize();
-        } else {
-            return MIN_SIZE;
-        }
-    }
-
-    public void setPosition(Point p) {
-        this.setPreferredLocation(p);
-    }
-
-    @Override
-    public String toString() {
-        return block.getName();
-    }
-
-    public Point getPosition() {
-        return this.getPreferredLocation();
-    }
-
-    public Cluster getCluster() {
-        return cluster;
-    }
-
-    public boolean isRoot() {
-        return root;
-    }
-
-    public void setCluster(Cluster c) {
-        cluster = c;
-    }
-
-    public void setRoot(boolean b) {
-        root = b;
-    }
-
-    public int compareTo(Vertex o) {
-        return toString().compareTo(o.toString());
-    }
-
-    @Override
-    protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
-        super.notifyStateChanged(previousState, state);
-
-        if (previousState.isHovered() != state.isHovered()) {
-            if (state.isHovered()) {
-                this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR));
-            } else {
-                this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
-            }
-        }
-
-        if (previousState.isSelected() != state.isSelected()) {
-            if (state.isSelected()) {
-                this.setFont(boldFont);
-            } else {
-                this.setFont(font);
-            }
-        }
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/Bundle.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-CTL_ControlFlowAction=Control Flow
-CTL_ControlFlowTopComponent=Control Flow
-HINT_ControlFlowTopComponent=Shows the blocks of the current graph.
-OpenIDE-Module-Name=ControlFlow
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.controlflow;
-
-import java.awt.event.ActionEvent;
-import javax.swing.AbstractAction;
-import org.openide.util.NbBundle;
-import org.openide.windows.TopComponent;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class ControlFlowAction extends AbstractAction {
-
-    public ControlFlowAction() {
-        super(NbBundle.getMessage(ControlFlowAction.class, "CTL_ControlFlowAction"));
-    }
-
-    public void actionPerformed(ActionEvent evt) {
-        TopComponent win = ControlFlowTopComponent.findInstance();
-        win.open();
-        win.requestActive();
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,299 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.controlflow;
-
-import com.sun.hotspot.igv.data.InputBlockEdge;
-import com.sun.hotspot.igv.data.InputBlock;
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.data.services.InputGraphProvider;
-import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.util.LookupHistory;
-import java.awt.Color;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-import javax.swing.BorderFactory;
-import org.netbeans.api.visual.action.ActionFactory;
-import org.netbeans.api.visual.action.MoveProvider;
-import org.netbeans.api.visual.action.RectangularSelectDecorator;
-import org.netbeans.api.visual.action.RectangularSelectProvider;
-import org.netbeans.api.visual.action.SelectProvider;
-import org.netbeans.api.visual.action.WidgetAction;
-import org.netbeans.api.visual.anchor.AnchorFactory;
-import org.netbeans.api.visual.anchor.AnchorShape;
-import org.netbeans.api.visual.router.RouterFactory;
-import org.netbeans.api.visual.widget.LayerWidget;
-import org.netbeans.api.visual.widget.Widget;
-import org.netbeans.api.visual.graph.GraphScene;
-import org.netbeans.api.visual.graph.layout.GraphLayout;
-import org.netbeans.api.visual.layout.LayoutFactory;
-import org.netbeans.api.visual.layout.SceneLayout;
-import org.netbeans.api.visual.widget.ConnectionWidget;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class ControlFlowScene extends GraphScene<InputBlock, InputBlockEdge> implements SelectProvider, MoveProvider, RectangularSelectDecorator, RectangularSelectProvider {
-
-    private HashSet<BlockWidget> selection;
-    private InputGraph oldGraph;
-    private LayerWidget edgeLayer;
-    private LayerWidget mainLayer;
-    private LayerWidget selectLayer;
-    private WidgetAction hoverAction = this.createWidgetHoverAction();
-    private WidgetAction selectAction = new DoubleClickSelectAction(this);
-    private WidgetAction moveAction = ActionFactory.createMoveAction(null, this);
-
-    public ControlFlowScene() {
-        selection = new HashSet<BlockWidget>();
-
-        this.getInputBindings().setZoomActionModifiers(0);
-        this.setLayout(LayoutFactory.createAbsoluteLayout());
-
-        mainLayer = new LayerWidget(this);
-        this.addChild(mainLayer);
-
-        edgeLayer = new LayerWidget(this);
-        this.addChild(edgeLayer);
-        
-        selectLayer = new LayerWidget(this);
-        this.addChild(selectLayer);
-
-        this.getActions().addAction(hoverAction);
-        this.getActions().addAction(selectAction);
-        this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
-        this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
-    }
-
-    public void setGraph(InputGraph g) {
-        if (g == oldGraph) {
-            return;
-        }
-        oldGraph = g;
-
-        ArrayList<InputBlock> blocks = new ArrayList<InputBlock>(this.getNodes());
-        for (InputBlock b : blocks) {
-            removeNode(b);
-        }
-
-        ArrayList<InputBlockEdge> edges = new ArrayList<InputBlockEdge>(this.getEdges());
-        for (InputBlockEdge e : edges) {
-            removeEdge(e);
-        }
-
-        for (InputBlock b : g.getBlocks()) {
-            addNode(b);
-        }
-
-        for (InputBlockEdge e : g.getBlockEdges()) {
-            addEdge(e);
-            assert g.getBlocks().contains(e.getFrom());
-            assert g.getBlocks().contains(e.getTo());
-            this.setEdgeSource(e, e.getFrom());
-            this.setEdgeTarget(e, e.getTo());
-        }
-
-        GraphLayout<InputBlock, InputBlockEdge> layout = new HierarchicalGraphLayout<InputBlock, InputBlockEdge>();//GridGraphLayout();
-        SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(this, layout);
-        sceneLayout.invokeLayout();
-
-        this.validate();
-    }
-
-    public void clearSelection() {
-        for (BlockWidget w : selection) {
-            w.setState(w.getState().deriveSelected(false));
-        }
-        selection.clear();
-        selectionChanged();
-    }
-
-    public void selectionChanged() {
-        InputGraphProvider p = LookupHistory.getLast(InputGraphProvider.class);//)Utilities.actionsGlobalContext().lookup(InputGraphProvider.class);
-        if (p != null) {
-            Set<InputNode> inputNodes = new HashSet<InputNode>();
-            for (BlockWidget w : selection) {
-                inputNodes.addAll(w.getBlock().getNodes());
-            }
-            p.setSelectedNodes(inputNodes);
-        }
-    }
-
-    public void addToSelection(BlockWidget widget) {
-        widget.setState(widget.getState().deriveSelected(true));
-        selection.add(widget);
-        selectionChanged();
-    }
-
-    public void removeFromSelection(BlockWidget widget) {
-        widget.setState(widget.getState().deriveSelected(false));
-        selection.remove(widget);
-        selectionChanged();
-    }
-
-    public boolean isAimingAllowed(Widget widget, Point point, boolean b) {
-        return false;
-    }
-
-    public boolean isSelectionAllowed(Widget widget, Point point, boolean b) {
-        return true;
-    }
-
-    public void select(Widget widget, Point point, boolean change) {
-        if (widget == this) {
-            clearSelection();
-        } else {
-
-            assert widget instanceof BlockWidget;
-            BlockWidget bw = (BlockWidget) widget;
-            if (change) {
-                if (selection.contains(bw)) {
-                    removeFromSelection(bw);
-                } else {
-                    addToSelection(bw);
-                }
-            } else {
-                if (!selection.contains(bw)) {
-                    clearSelection();
-                    addToSelection(bw);
-                }
-            }
-        }
-    }
-
-    public void movementStarted(Widget widget) {
-    }
-
-    public void movementFinished(Widget widget) {
-    }
-
-    public Point getOriginalLocation(Widget widget) {
-        return widget.getPreferredLocation();
-    }
-
-    public void setNewLocation(Widget widget, Point location) {
-        if (selection.contains(widget)) {
-            // move entire selection
-            Point originalLocation = getOriginalLocation(widget);
-            int xOffset = location.x - originalLocation.x;
-            int yOffset = location.y - originalLocation.y;
-            for (Widget w : selection) {
-                Point p = new Point(w.getPreferredLocation());
-                p.translate(xOffset, yOffset);
-                w.setPreferredLocation(p);
-            }
-        } else {
-            widget.setPreferredLocation(location);
-        }
-    }
-
-    public Widget createSelectionWidget() {
-        Widget widget = new Widget(this);
-        widget.setOpaque(false);
-        widget.setBorder(BorderFactory.createLineBorder(Color.black, 2));
-        widget.setForeground(Color.red);
-        return widget;
-    }
-
-    public void performSelection(Rectangle rectangle) {
-
-        if (rectangle.width < 0) {
-            rectangle.x += rectangle.width;
-            rectangle.width *= -1;
-        }
-
-        if (rectangle.height < 0) {
-            rectangle.y += rectangle.height;
-            rectangle.height *= -1;
-        }
-
-        boolean changed = false;
-        for (InputBlock b : this.getNodes()) {
-            BlockWidget w = (BlockWidget) findWidget(b);
-            Rectangle r = new Rectangle(w.getBounds());
-            r.setLocation(w.getLocation());
-            if (r.intersects(rectangle)) {
-                if (!selection.contains(w)) {
-                    changed = true;
-                    selection.add(w);
-                    w.setState(w.getState().deriveSelected(true));
-                }
-            } else {
-                if (selection.contains(w)) {
-                    changed = true;
-                    selection.remove(w);
-                    w.setState(w.getState().deriveSelected(false));
-                }
-            }
-        }
-
-        if (changed) {
-            selectionChanged();
-        }
-
-    }
-
-    protected Widget attachNodeWidget(InputBlock node) {
-        BlockWidget w = new BlockWidget(this, node);
-        mainLayer.addChild(w);
-        w.getActions().addAction(hoverAction);
-        w.getActions().addAction(selectAction);
-        w.getActions().addAction(moveAction);
-        return w;
-    }
-
-    protected Widget attachEdgeWidget(InputBlockEdge edge) {
-        BlockConnectionWidget w = new BlockConnectionWidget(this, edge);
-        switch (edge.getState()) {
-            case NEW:
-                w.setBold(true);
-                break;
-            case DELETED:
-                w.setDashed(true);
-                break;
-        }
-        w.setRouter(RouterFactory.createDirectRouter());
-        w.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED);
-        edgeLayer.addChild(w);
-        return w;
-    }
-
-    protected void attachEdgeSourceAnchor(InputBlockEdge edge, InputBlock oldSourceNode, InputBlock sourceNode) {
-        Widget w = this.findWidget(edge);
-        assert w instanceof ConnectionWidget;
-        ConnectionWidget cw = (ConnectionWidget) w;
-        cw.setSourceAnchor(AnchorFactory.createRectangularAnchor(findWidget(sourceNode)));
-
-    }
-
-    protected void attachEdgeTargetAnchor(InputBlockEdge edge, InputBlock oldTargetNode, InputBlock targetNode) {
-        Widget w = this.findWidget(edge);
-        assert w instanceof ConnectionWidget;
-        ConnectionWidget cw = (ConnectionWidget) w;
-        cw.setTargetAnchor(AnchorFactory.createRectangularAnchor(findWidget(targetNode)));
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.form	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
-  <AuxValues>
-    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
-    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
-    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
-    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
-    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
-    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
-    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
-    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
-    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
-  </AuxValues>
-
-  <Layout>
-    <DimensionLayout dim="0">
-      <Group type="103" groupAlignment="0" attributes="0">
-          <EmptySpace min="0" pref="400" max="32767" attributes="0"/>
-      </Group>
-    </DimensionLayout>
-    <DimensionLayout dim="1">
-      <Group type="103" groupAlignment="0" attributes="0">
-          <EmptySpace min="0" pref="300" max="32767" attributes="0"/>
-      </Group>
-    </DimensionLayout>
-  </Layout>
-</Form>
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.controlflow;
-
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.data.services.InputGraphProvider;
-import com.sun.hotspot.igv.util.LookupHistory;
-import java.awt.BorderLayout;
-import java.io.Serializable;
-import javax.swing.JScrollPane;
-import javax.swing.SwingUtilities;
-import org.openide.ErrorManager;
-import org.openide.util.Lookup;
-import org.openide.util.LookupEvent;
-import org.openide.util.LookupListener;
-import org.openide.util.NbBundle;
-import org.openide.util.Utilities;
-import org.openide.windows.TopComponent;
-import org.openide.windows.WindowManager;
-
-/**
- * 
- * @author Thomas Wuerthinger
- */
-final class ControlFlowTopComponent extends TopComponent implements LookupListener {
-
-    private static ControlFlowTopComponent instance;
-    private Lookup.Result result = null;
-    private static final String PREFERRED_ID = "ControlFlowTopComponent";
-    private ControlFlowScene scene;
-
-    private ControlFlowTopComponent() {
-        initComponents();
-        setName(NbBundle.getMessage(ControlFlowTopComponent.class, "CTL_ControlFlowTopComponent"));
-        setToolTipText(NbBundle.getMessage(ControlFlowTopComponent.class, "HINT_ControlFlowTopComponent"));
-
-        scene = new ControlFlowScene();
-        this.setLayout(new BorderLayout());
-        this.associateLookup(scene.getLookup());
-
-
-        JScrollPane panel = new JScrollPane(scene.createView());
-        this.add(panel, BorderLayout.CENTER);
-    }
-
-
-
-    /** This method is called from within the constructor to
-     * initialize the form.
-     * WARNING: Do NOT modify this code. The content of this method is
-     * always regenerated by the Form Editor.
-     */
-    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
-    private void initComponents() {
-
-        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
-        this.setLayout(layout);
-        layout.setHorizontalGroup(
-            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
-            .add(0, 400, Short.MAX_VALUE)
-        );
-        layout.setVerticalGroup(
-            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
-            .add(0, 300, Short.MAX_VALUE)
-        );
-    }// </editor-fold>//GEN-END:initComponents
-    // Variables declaration - do not modify//GEN-BEGIN:variables
-    // End of variables declaration//GEN-END:variables
-
-    /**
-     * Gets default instance. Do not use directly: reserved for *.settings files only,
-     * i.e. deserialization routines; otherwise you could get a non-deserialized instance.
-     * To obtain the singleton instance, use {@link findInstance}.
-     */
-    public static synchronized ControlFlowTopComponent getDefault() {
-        if (instance == null) {
-            instance = new ControlFlowTopComponent();
-        }
-        return instance;
-    }
-
-    /**
-     * Obtain the ControlFlowTopComponent instance. Never call {@link #getDefault} directly!
-     */
-    public static synchronized ControlFlowTopComponent findInstance() {
-        TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
-        if (win == null) {
-            ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find ControlFlow component. It will not be located properly in the window system.");
-            return getDefault();
-        }
-        if (win instanceof ControlFlowTopComponent) {
-            return (ControlFlowTopComponent) win;
-        }
-        ErrorManager.getDefault().log(ErrorManager.WARNING, "There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior.");
-        return getDefault();
-    }
-
-    @Override
-    public int getPersistenceType() {
-        return TopComponent.PERSISTENCE_ALWAYS;
-    }
-
-    @Override
-    public void componentOpened() {
-        Lookup.Template<InputGraphProvider> tpl = new Lookup.Template<InputGraphProvider>(InputGraphProvider.class);
-        result = Utilities.actionsGlobalContext().lookup(tpl);
-        result.addLookupListener(this);
-    }
-
-    @Override
-    public void componentClosed() {
-        result.removeLookupListener(this);
-        result = null;
-    }
-
-    public void resultChanged(LookupEvent lookupEvent) {
-        final InputGraphProvider p = LookupHistory.getLast(InputGraphProvider.class);//Utilities.actionsGlobalContext().lookup(InputGraphProvider.class);
-        if (p != null) {
-            SwingUtilities.invokeLater(new Runnable() {
-
-                public void run() {
-                    InputGraph g = p.getGraph();
-                    if (g != null) {
-                        scene.setGraph(g);
-                    }
-                }
-            });
-        }
-    }
-
-    @Override
-    public Object writeReplace() {
-        return new ResolvableHelper();
-    }
-
-    @Override
-    protected String preferredID() {
-        return PREFERRED_ID;
-    }
-
-    @Override
-    public void requestActive() {
-        super.requestActive();
-        scene.getView().requestFocus();
-    }
-
-    final static class ResolvableHelper implements Serializable {
-
-        private static final long serialVersionUID = 1L;
-
-        public Object readResolve() {
-            return ControlFlowTopComponent.getDefault();
-        }
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentSettings.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
-<settings version="1.0">
-    <module name="com.sun.hotspot.igv.controlflow" spec="1.0"/>
-    <instanceof class="org.openide.windows.TopComponent"/>
-    <instanceof class="com.sun.hotspot.igv.controlflow.ControlFlowTopComponent"/>
-    <instance class="com.sun.hotspot.igv.controlflow.ControlFlowTopComponent" method="getDefault"/>
-</settings>
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentWstcref.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd">
-<tc-ref version="2.0" >
-    <module name="com.sun.hotspot.igv.controlflow" spec="1.0"/>
-    <tc-id id="ControlFlowTopComponent"/>
-    <state opened="true"/>
-</tc-ref>
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/DoubleClickSelectAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +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.sun.hotspot.igv.controlflow;
-
-import java.awt.Point;
-import java.awt.event.MouseEvent;
-import org.netbeans.api.visual.action.SelectProvider;
-import org.netbeans.api.visual.action.WidgetAction;
-import org.netbeans.api.visual.widget.Widget;
-
-/**
- * Selection action that acts on double-click only. Does not support aiming.
- * 
- * @author Peter Hofer
- */
-public class DoubleClickSelectAction extends WidgetAction.LockedAdapter {
-
-    private final SelectProvider provider;
-
-    public DoubleClickSelectAction(SelectProvider provider) {
-        this.provider = provider;
-    }
-
-    protected boolean isLocked() {
-        return false;
-    }
-
-    @Override
-    public State mousePressed(Widget widget, WidgetMouseEvent event) {
-        if (event.getClickCount() >= 2 && (event.getButton() == MouseEvent.BUTTON1 || event.getButton() == MouseEvent.BUTTON2)) {
-            boolean invert = (event.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) != 0;
-            Point point = event.getPoint();
-            if (provider.isSelectionAllowed(widget, point, invert)) {
-                provider.select(widget, point, invert);
-                return State.CHAIN_ONLY;
-            }
-        }
-        return State.REJECTED;
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.controlflow;
-
-import com.sun.hotspot.igv.hierarchicallayout.HierarchicalLayoutManager;
-import com.sun.hotspot.igv.layout.Cluster;
-import com.sun.hotspot.igv.layout.LayoutGraph;
-import com.sun.hotspot.igv.layout.Link;
-import com.sun.hotspot.igv.layout.Port;
-import com.sun.hotspot.igv.layout.Vertex;
-import java.awt.Dimension;
-import java.awt.Point;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.netbeans.api.visual.graph.layout.GraphLayout;
-import org.netbeans.api.visual.graph.layout.UniversalGraph;
-import org.netbeans.api.visual.widget.Widget;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class HierarchicalGraphLayout<N, E> extends GraphLayout<N, E> {
-
-    public HierarchicalGraphLayout() {
-    }
-
-    private class LinkWrapper implements Link {
-
-        private VertexWrapper from;
-        private VertexWrapper to;
-
-        public LinkWrapper(VertexWrapper from, VertexWrapper to) {
-            this.from = from;
-            this.to = to;
-        }
-
-        public Port getFrom() {
-            return from.getSlot();
-        }
-
-        public Port getTo() {
-            return to.getSlot();
-        }
-
-        public List<Point> getControlPoints() {
-            return new ArrayList<Point>();
-        }
-
-        public void setControlPoints(List<Point> list) {
-        // Do nothing for now
-        }
-    }
-
-    private class VertexWrapper implements Vertex {
-
-        private N node;
-        private UniversalGraph<N, E> graph;
-        private Port slot;
-        private Point position;
-
-        public VertexWrapper(N node, UniversalGraph<N, E> graph) {
-            this.node = node;
-            this.graph = graph;
-            final VertexWrapper vertex = this;
-            this.slot = new Port() {
-
-                public Vertex getVertex() {
-                    return vertex;
-                }
-
-                public Point getRelativePosition() {
-                    return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2));
-                }
-            };
-
-            Widget w = graph.getScene().findWidget(node);
-            this.position = w.getPreferredLocation();
-        }
-
-        public Cluster getCluster() {
-            return null;
-        }
-
-        public Dimension getSize() {
-            Widget w = graph.getScene().findWidget(node);
-            return w.getBounds().getSize();
-        }
-
-        public Point getPosition() {
-            return position;
-        }
-
-        public void setPosition(Point p) {
-            HierarchicalGraphLayout.this.setResolvedNodeLocation(graph, node, p);
-            position = p;
-        }
-
-        public boolean isRoot() {
-            return false;
-        }
-
-        public int compareTo(Vertex o) {
-            @SuppressWarnings("unchecked")
-            VertexWrapper vw = (VertexWrapper) o;
-            return node.toString().compareTo(vw.node.toString());
-        }
-
-        public Port getSlot() {
-            return slot;
-        }
-    }
-
-    protected void performGraphLayout(UniversalGraph<N, E> graph) {
-        
-        Set<LinkWrapper> links = new LinkedHashSet<LinkWrapper>();
-        Set<VertexWrapper> vertices = new LinkedHashSet<VertexWrapper>();
-        Map<N, VertexWrapper> vertexMap = new HashMap<N, VertexWrapper>();
-
-        for (N node : graph.getNodes()) {
-            VertexWrapper v = new VertexWrapper(node, graph);
-            vertexMap.put(node, v);
-            vertices.add(v);
-        }
-
-        for (E edge : graph.getEdges()) {
-            N source = graph.getEdgeSource(edge);
-            N target = graph.getEdgeTarget(edge);
-            LinkWrapper l = new LinkWrapper(vertexMap.get(source), vertexMap.get(target));
-            links.add(l);
-        }
-
-        HierarchicalLayoutManager m = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.NONE);
-
-        LayoutGraph layoutGraph = new LayoutGraph(links, vertices);
-        m.doLayout(layoutGraph);
-    }
-
-    protected void performNodesLayout(UniversalGraph<N, E> graph, Collection<N> nodes) {
-        throw new UnsupportedOperationException();
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/layer.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
-<filesystem>
-    <folder name="Actions">
-        <folder name="Window">
-            <file name="com-sun-hotspot-igv-controlflow-ControlFlowAction.instance"/>
-        </folder>
-    </folder>
-    <folder name="Menu">
-        <folder name="Window">
-            <file name="ControlFlowAction.shadow">
-                <attr name="originalFile" stringvalue="Actions/Window/com-sun-hotspot-igv-controlflow-ControlFlowAction.instance"/>
-            </file>
-        </folder>
-    </folder>
-    <folder name="Windows2">
-        <folder name="Components">
-            <file name="ControlFlowTopComponent.settings" url="ControlFlowTopComponentSettings.xml"/>
-        </folder>
-        <folder name="Modes">
-            <folder name="customRightTopMode">
-                <file name="ControlFlowTopComponent.wstcref" url="ControlFlowTopComponentWstcref.xml"/>
-            </folder>
-        </folder>
-    </folder>
-</filesystem>
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.xml	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.xml	Thu Feb 02 16:07:52 2012 -0800
@@ -1,134 +1,142 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
-    <type>org.netbeans.modules.apisupport.project</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
-            <code-name-base>com.sun.hotspot.igv.coordinator</code-name-base>
-            <suite-component/>
-            <module-dependencies>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.data</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.difference</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.settings</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.util</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.netbeans.api.progress</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <release-version>1</release-version>
-                        <specification-version>1.23.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.actions</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>6.21.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.awt</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>7.30.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.dialogs</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>7.18.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.explorer</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>6.34.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.filesystems</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>7.46.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.loaders</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>7.20.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.nodes</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>7.20.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.util</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>8.14.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.util.lookup</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>8.6.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.windows</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>6.39.1</specification-version>
-                    </run-dependency>
-                </dependency>
-            </module-dependencies>
-            <public-packages/>
-        </data>
-    </configuration>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.apisupport.project</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+            <code-name-base>com.sun.hotspot.igv.coordinator</code-name-base>
+            <suite-component/>
+            <module-dependencies>
+                <dependency>
+                    <code-name-base>com.sun.hotspot.igv.connection</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>1.0</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>com.sun.hotspot.igv.data</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>1.0</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>com.sun.hotspot.igv.difference</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>1.0</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>com.sun.hotspot.igv.settings</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>1.0</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>com.sun.hotspot.igv.util</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>1.0</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.netbeans.api.progress</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <release-version>1</release-version>
+                        <specification-version>1.23.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.actions</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>6.21.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.awt</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.30.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.dialogs</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.18.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.explorer</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>6.34.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.filesystems</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.46.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.loaders</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.20.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.nodes</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.20.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.util</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>8.14.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.util.lookup</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>8.6.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.windows</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>6.39.1</specification-version>
+                    </run-dependency>
+                </dependency>
+            </module-dependencies>
+            <public-packages/>
+        </data>
+    </configuration>
+</project>
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/META-INF/services/com.sun.hotspot.igv.data.services.GroupOrganizer	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-com.sun.hotspot.igv.coordinator.StandardGroupOrganizer
-com.sun.hotspot.igv.coordinator.GraphCountGroupOrganizer
\ No newline at end of file
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/Bundle.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/Bundle.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,6 +1,6 @@
-AdvancedOption_DisplayName_Coordinator=Settings
-AdvancedOption_Tooltip_Coordinator=Visualization Tool Settings
-CTL_OutlineTopComponent=Outline
-CTL_SomeAction=test
-HINT_OutlineTopComponent=Displays loaded groups of graphs.
-OpenIDE-Module-Name=Coordinator
\ No newline at end of file
+AdvancedOption_DisplayName_Coordinator=Settings
+AdvancedOption_Tooltip_Coordinator=Visualization Tool Settings
+CTL_OutlineTopComponent=Outline
+CTL_SomeAction=test
+HINT_OutlineTopComponent=Displays loaded groups of graphs.
+OpenIDE-Module-Name=Coordinator
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,14 +24,8 @@
 package com.sun.hotspot.igv.coordinator;
 
 import com.sun.hotspot.igv.coordinator.actions.RemoveCookie;
-import com.sun.hotspot.igv.data.ChangedListener;
-import com.sun.hotspot.igv.data.GraphDocument;
-import com.sun.hotspot.igv.data.Group;
-import com.sun.hotspot.igv.data.services.GroupOrganizer;
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.data.Pair;
+import com.sun.hotspot.igv.data.*;
 import java.awt.Image;
-import java.util.ArrayList;
 import java.util.List;
 import org.openide.nodes.AbstractNode;
 import org.openide.nodes.Children;
@@ -46,108 +40,67 @@
  */
 public class FolderNode extends AbstractNode {
 
-    private GroupOrganizer organizer;
     private InstanceContent content;
-    private List<Pair<String, List<Group>>> structure;
-    private List<String> subFolders;
     private FolderChildren children;
 
-    private static class FolderChildren extends Children.Keys<Pair<String, List<Group>>> implements ChangedListener<Group> {
+    private static class FolderChildren extends Children.Keys<FolderElement> implements ChangedListener {
 
-        private FolderNode parent;
-        private List<Group> registeredGroups;
-        private final GraphDocument document;
+        private final Folder folder;
 
-        public FolderChildren(GraphDocument document) {
-            this.document = document;
-        }
-
-        public void setParent(FolderNode parent) {
-            this.parent = parent;
-            this.registeredGroups = new ArrayList<Group>();
+        public FolderChildren(Folder folder) {
+            this.folder = folder;
+            folder.getChangedEvent().addListener(this);
         }
 
         @Override
-        protected Node[] createNodes(Pair<String, List<Group>> p) {
-
-            for(Group g : registeredGroups) {
-                g.getChangedEvent().removeListener(this);
-            }
-            registeredGroups.clear();
-            
-            if (p.getLeft().length() == 0) {
-
-                List<Node> curNodes = new ArrayList<Node>();
-                for (Group g : p.getRight()) {
-                    for (InputGraph graph : g.getGraphListCopy()) {
-                        curNodes.add(new GraphNode(document, graph));
-                    }
-                    g.getChangedEvent().addListener(this);
-                    registeredGroups.add(g);
-                }
-
-                Node[] result = new Node[curNodes.size()];
-                for (int i = 0; i < curNodes.size(); i++) {
-                    result[i] = curNodes.get(i);
-                }
-                return result;
-
-            } else {
-                return new Node[]{new FolderNode(document, p.getLeft(), parent.organizer, parent.subFolders, p.getRight())};
+        protected Node[] createNodes(FolderElement e) {
+             if (e instanceof InputGraph) {
+                return new Node[]{new GraphNode((InputGraph) e)};
+            } else if (e instanceof Folder) {
+                 return new Node[]{new FolderNode((Folder) e)};
+             } else {
+                return null;
             }
         }
 
         @Override
         public void addNotify() {
-            this.setKeys(parent.structure);
+            this.setKeys(folder.getElements());
         }
         
-        public void changed(Group source) {
-            for(Pair<String, List<Group>> p : parent.structure) {
-                refreshKey(p);
-            }
+        @Override
+        public void changed(Object source) {
+            addNotify();
          }
     }
 
-    protected InstanceContent getContent() {
-        return content;
-    }
-
     @Override
     public Image getIcon(int i) {
         return ImageUtilities.loadImage("com/sun/hotspot/igv/coordinator/images/folder.png");
     }
 
-    protected FolderNode(GraphDocument document, String name, GroupOrganizer organizer, List<String> subFolders, List<Group> groups) {
-        this(document, name, organizer, subFolders, groups, new FolderChildren(document), new InstanceContent());
+    protected FolderNode(Folder folder) {
+        this(folder, new FolderChildren(folder), new InstanceContent());
     }
 
-    private FolderNode(final GraphDocument document, String name, GroupOrganizer organizer, List<String> oldSubFolders, final List<Group> groups, FolderChildren children, InstanceContent content) {
+    private FolderNode(final Folder folder, FolderChildren children, InstanceContent content) {
         super(children, new AbstractLookup(content));
-        children.setParent(this);
         this.content = content;
         this.children = children;
-        content.add(new RemoveCookie() {
-
-            public void remove() {
-                for (Group g : groups) {
-                    document.removeGroup(g);
-                    
+        if (folder instanceof FolderElement) {
+            final FolderElement folderElement = (FolderElement) folder;
+            this.setDisplayName(folderElement.getName());
+            content.add(new RemoveCookie() {
+                @Override
+                public void remove() {
+                    folderElement.getParent().removeElement(folderElement);
                 }
-            }
-        });
-        init(name, organizer, oldSubFolders, groups);
+            });
+        }
     }
 
-    public void init(String name, GroupOrganizer organizer, List<String> oldSubFolders, List<Group> groups) {
+    public void init(String name, List<Group> groups) {
         this.setDisplayName(name);
-        this.organizer = organizer;
-        this.subFolders = new ArrayList<String>(oldSubFolders);
-        if (name.length() > 0) {
-            this.subFolders.add(name);
-        }
-        structure = organizer.organize(subFolders, groups);
-        assert structure != null;
         children.addNotify();
 
         for (Group g : groups) {
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphCountGroupOrganizer.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.sun.hotspot.igv.coordinator;
-
-import com.sun.hotspot.igv.data.Group;
-import com.sun.hotspot.igv.data.Pair;
-import com.sun.hotspot.igv.data.services.GroupOrganizer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class GraphCountGroupOrganizer implements GroupOrganizer {
-
-    public String getName() {
-        return "Graph count structure";
-    }
-
-    public List<Pair<String, List<Group>>> organize(List<String> subFolders, List<Group> groups) {
-
-        List<Pair<String, List<Group>>> result = new ArrayList<Pair<String, List<Group>>>();
-
-        if (subFolders.size() == 0) {
-            Map<Integer, List<Group>> map = new HashMap<Integer, List<Group>>(groups.size());
-            for (Group g : groups) {
-                Integer cur = g.getGraphsCount();
-                if (!map.containsKey(cur)) {
-                    map.put(cur, new ArrayList<Group>());
-                }
-                map.get(cur).add(g);
-            }
-
-            SortedSet<Integer> keys = new TreeSet<Integer>(map.keySet());
-            for (Integer i : keys) {
-                result.add(new Pair<String, List<Group>>("Graph count " + i, map.get(i)));
-            }
-
-        } else if (subFolders.size() == 1) {
-            for (Group g : groups) {
-                List<Group> children = new ArrayList<Group>();
-                children.add(g);
-                Pair<String, List<Group>> p = new Pair<String, List<Group>>();
-                p.setLeft(g.getName());
-                p.setRight(children);
-                result.add(p);
-            }
-        } else if (subFolders.size() == 2) {
-            result.add(new Pair<String, List<Group>>("", groups));
-        }
-
-        return result;
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -27,7 +27,6 @@
 import com.sun.hotspot.igv.coordinator.actions.DiffGraphCookie;
 import com.sun.hotspot.igv.coordinator.actions.GraphOpenCookie;
 import com.sun.hotspot.igv.coordinator.actions.GraphRemoveCookie;
-import com.sun.hotspot.igv.data.GraphDocument;
 import com.sun.hotspot.igv.data.InputGraph;
 import com.sun.hotspot.igv.data.Properties;
 import com.sun.hotspot.igv.data.services.GraphViewer;
@@ -48,18 +47,15 @@
  * @author Thomas Wuerthinger
  */
 public class GraphNode extends AbstractNode {
-    private final GraphDocument document;
     private final InputGraph graph;
 
     /** Creates a new instance of GraphNode */
-    public GraphNode(GraphDocument document, InputGraph graph) {
-        this(document, graph, new InstanceContent());
+    public GraphNode(InputGraph graph) {
+        this(graph, new InstanceContent());
     }
 
-    private GraphNode(GraphDocument document, InputGraph graph, InstanceContent content) {
+    private GraphNode(InputGraph graph, InstanceContent content) {
         super(Children.LEAF, new AbstractLookup(content));
-
-        this.document = document;
         this.graph = graph;
         this.setDisplayName(graph.getName());
         content.add(graph);
@@ -72,7 +68,7 @@
         }
 
         // Action for removing a graph
-        content.add(new GraphRemoveCookie(document, graph));
+        content.add(new GraphRemoveCookie(graph));
 
         // Action for diffing to the current graph
         content.add(new DiffGraphCookie(graph));
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.form	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.form	Thu Feb 02 16:07:52 2012 -0800
@@ -16,28 +16,17 @@
 
   <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
   <SubComponents>
-    <Container class="javax.swing.JPanel" name="jPanel2">
+    <Container class="javax.swing.JScrollPane" name="treeView">
+      <AuxValues>
+        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new BeanTreeView();"/>
+      </AuxValues>
       <Constraints>
         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
           <BorderConstraints direction="Center"/>
         </Constraint>
       </Constraints>
 
-      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
-      <SubComponents>
-        <Container class="javax.swing.JScrollPane" name="treeView">
-          <AuxValues>
-            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new BeanTreeView();"/>
-          </AuxValues>
-          <Constraints>
-            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
-              <BorderConstraints direction="Center"/>
-            </Constraint>
-          </Constraints>
-
-          <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
-        </Container>
-      </SubComponents>
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
     </Container>
   </SubComponents>
 </Form>
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,37 +23,25 @@
  */
 package com.sun.hotspot.igv.coordinator;
 
-import com.sun.hotspot.igv.coordinator.actions.ImportAction;
-import com.sun.hotspot.igv.coordinator.actions.RemoveAction;
-import com.sun.hotspot.igv.coordinator.actions.RemoveAllAction;
-import com.sun.hotspot.igv.coordinator.actions.SaveAllAction;
-import com.sun.hotspot.igv.coordinator.actions.SaveAsAction;
-import com.sun.hotspot.igv.coordinator.actions.StructuredViewAction;
+import com.sun.hotspot.igv.connection.Server;
+import com.sun.hotspot.igv.coordinator.actions.*;
 import com.sun.hotspot.igv.data.GraphDocument;
-import com.sun.hotspot.igv.data.ChangedListener;
 import com.sun.hotspot.igv.data.Group;
 import com.sun.hotspot.igv.data.services.GroupCallback;
-import com.sun.hotspot.igv.data.services.GroupOrganizer;
-import com.sun.hotspot.igv.data.services.GroupReceiver;
 import java.awt.BorderLayout;
-import java.awt.Component;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import javax.swing.BoxLayout;
-import javax.swing.JPanel;
 import javax.swing.UIManager;
 import javax.swing.border.Border;
 import org.openide.ErrorManager;
+import org.openide.actions.GarbageCollectAction;
 import org.openide.awt.Toolbar;
 import org.openide.awt.ToolbarPool;
 import org.openide.explorer.ExplorerManager;
 import org.openide.explorer.ExplorerUtils;
 import org.openide.explorer.view.BeanTreeView;
-import org.openide.util.Lookup;
 import org.openide.util.LookupEvent;
 import org.openide.util.LookupListener;
 import org.openide.util.NbBundle;
@@ -72,7 +60,7 @@
     private ExplorerManager manager;
     private GraphDocument document;
     private FolderNode root;
-    private GroupOrganizer organizer;
+    private Server server;
 
     private OutlineTopComponent() {
         initComponents();
@@ -88,18 +76,10 @@
 
     private void initListView() {
         manager = new ExplorerManager();
-        organizer = new StandardGroupOrganizer();
-        root = new FolderNode(document, "", organizer, new ArrayList<String>(), document.getGroups());
+        root = new FolderNode(document);
         manager.setRootContext(root);
         ((BeanTreeView) this.treeView).setRootVisible(false);
 
-        document.getChangedEvent().addListener(new ChangedListener<GraphDocument>() {
-
-            public void changed(GraphDocument document) {
-                updateStructure();
-            }
-        });
-
         associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
     }
 
@@ -117,50 +97,32 @@
 
         toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
         toolbar.add(RemoveAllAction.get(RemoveAllAction.class));
-
-        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());
+        
+        toolbar.add(GarbageCollectAction.get(GarbageCollectAction.class).getToolbarPresenter());
 
         for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
             tb.setVisible(false);
         }
     }
 
-    public void setOrganizer(GroupOrganizer organizer) {
-        this.organizer = organizer;
-        updateStructure();
-    }
-
     private void initReceivers() {
 
         final GroupCallback callback = new GroupCallback() {
 
+            @Override
             public void started(Group g) {
-                getDocument().addGroup(g);
+                getDocument().addElement(g);
             }
         };
-
-        Collection<? extends GroupReceiver> receivers = Lookup.getDefault().lookupAll(GroupReceiver.class);
-        if (receivers.size() > 0) {
-            JPanel panel = new JPanel();
-            panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
-
-            for (GroupReceiver r : receivers) {
-                Component c = r.init(callback);
-                panel.add(c);
-            }
-
-            jPanel2.add(panel, BorderLayout.PAGE_START);
-        }
-    }
-
-    private void updateStructure() {
-        root.init("", organizer, new ArrayList<String>(), document.getGroups());
+        
+        server = new Server(callback);
     }
 
     public void clear() {
         document.clear();
     }
 
+    @Override
     public ExplorerManager getExplorerManager() {
         return manager;
     }
@@ -234,6 +196,7 @@
         return super.requestFocusInWindow(temporary);
     }
 
+    @Override
     public void resultChanged(LookupEvent lookupEvent) {
     }
 
@@ -266,19 +229,13 @@
     // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
     private void initComponents() {
 
-        jPanel2 = new javax.swing.JPanel();
         treeView = new BeanTreeView();
 
         setLayout(new java.awt.BorderLayout());
-
-        jPanel2.setLayout(new java.awt.BorderLayout());
-        jPanel2.add(treeView, java.awt.BorderLayout.CENTER);
-
-        add(jPanel2, java.awt.BorderLayout.CENTER);
+        add(treeView, java.awt.BorderLayout.CENTER);
     }// </editor-fold>//GEN-END:initComponents
 
     // Variables declaration - do not modify//GEN-BEGIN:variables
-    private javax.swing.JPanel jPanel2;
     private javax.swing.JScrollPane treeView;
     // End of variables declaration//GEN-END:variables
 }
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardConfiguration.xml	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardConfiguration.xml	Thu Feb 02 16:07:52 2012 -0800
@@ -4,7 +4,7 @@
     <Row>
         <Toolbar name="Edit" position="1" visible="false"/>
         <Toolbar name="File" position="1" visible="false" />
-        <Toolbar name="Memory" position="1" visible="false" />
+        <Toolbar name="Memory" position="1" visible="true" />
     </Row>
     <Row>
         <Toolbar name="WorkspaceSwitcher" />
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardGroupOrganizer.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.sun.hotspot.igv.coordinator;
-
-import com.sun.hotspot.igv.data.Group;
-import com.sun.hotspot.igv.data.services.GroupOrganizer;
-import com.sun.hotspot.igv.data.Pair;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class StandardGroupOrganizer implements GroupOrganizer {
-
-    public String getName() {
-        return "-- None --";
-    }
-
-    public List<Pair<String, List<Group>>> organize(List<String> subFolders, List<Group> groups) {
-        List<Pair<String, List<Group>>> result = new ArrayList<Pair<String, List<Group>>>();
-        if (groups.size() == 1 && subFolders.size() > 0) {
-            result.add(new Pair<String, List<Group>>("", groups));
-        } else {
-            for (Group g : groups) {
-                Pair<String, List<Group>> p = new Pair<String, List<Group>>();
-                p.setLeft(g.getName());
-                p.setRight(Arrays.asList(g));
-                result.add(p);
-            }
-        }
-        return result;
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -35,12 +35,14 @@
  */
 public final class DiffGraphAction extends CookieAction {
 
+    @Override
     protected void performAction(Node[] activatedNodes) {
         DiffGraphCookie c = activatedNodes[0].getCookie(DiffGraphCookie.class);
         assert c != null;
         c.openDiff();
     }
 
+    @Override
     protected int mode() {
         return CookieAction.MODE_EXACTLY_ONE;
     }
@@ -58,12 +60,14 @@
         return false;
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(DiffGraphAction.class, "CTL_DiffGraphAction");
     }
 
-    protected Class[] cookieClasses() {
-        return new Class[]{
+    @Override
+    protected Class<?>[] cookieClasses() {
+        return new Class<?>[]{
             DiffGraphCookie.class
         };
     }
@@ -73,6 +77,7 @@
         return "com/sun/hotspot/igv/coordinator/images/diff.png";
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphCookie.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphCookie.java	Thu Feb 02 16:07:52 2012 -0800
@@ -28,9 +28,6 @@
 import com.sun.hotspot.igv.data.services.InputGraphProvider;
 import com.sun.hotspot.igv.difference.Difference;
 import com.sun.hotspot.igv.util.LookupHistory;
-import org.openide.DialogDescriptor;
-import org.openide.DialogDisplayer;
-import org.openide.NotifyDescriptor;
 import org.openide.nodes.Node;
 import org.openide.util.Lookup;
 
@@ -60,16 +57,6 @@
 
     public void openDiff() {
         InputGraph other = getCurrentGraph();
-
-        if (!graph.getGroup().isComplete() || !other.getGroup().isComplete()) {
-            String msg = "One of the graphs or the groups they belong to are still being loaded. Creating a diff now can cause problems. Do you want to continue?";
-            NotifyDescriptor desc = new NotifyDescriptor(msg, "Incomplete data", NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE, null, NotifyDescriptor.NO_OPTION);
-
-            if (DialogDisplayer.getDefault().notify(desc) == DialogDescriptor.NO_OPTION) {
-                return;
-            }
-        }
-
         final GraphViewer viewer = Lookup.getDefault().lookup(GraphViewer.class);
         if (viewer != null) {
             InputGraph diffGraph = Difference.createDiffGraph(other, graph);
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/GraphOpenCookie.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/GraphOpenCookie.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,9 +25,6 @@
 
 import com.sun.hotspot.igv.data.InputGraph;
 import com.sun.hotspot.igv.data.services.GraphViewer;
-import org.openide.DialogDescriptor;
-import org.openide.DialogDisplayer;
-import org.openide.NotifyDescriptor;
 import org.openide.cookies.OpenCookie;
 
 public class GraphOpenCookie implements OpenCookie {
@@ -40,16 +37,8 @@
         this.graph = graph;
     }
 
+    @Override
     public void open() {
-        if (!graph.getGroup().isComplete()) {
-            String msg = "This graph or the group it belongs to is still being loaded. Opening this graph now can cause problems. Do you want to continue and open the graph?";
-            NotifyDescriptor desc = new NotifyDescriptor(msg, "Incomplete data", NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE, null, NotifyDescriptor.NO_OPTION);
-
-            if (DialogDisplayer.getDefault().notify(desc) == DialogDescriptor.NO_OPTION) {
-                return;
-            }
-        }
-
         viewer.view(graph);
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/GraphRemoveCookie.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/GraphRemoveCookie.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,36 +23,17 @@
  */
 package com.sun.hotspot.igv.coordinator.actions;
 
-import com.sun.hotspot.igv.data.GraphDocument;
 import com.sun.hotspot.igv.data.InputGraph;
-import org.openide.DialogDescriptor;
-import org.openide.DialogDisplayer;
-import org.openide.NotifyDescriptor;
 
 public class GraphRemoveCookie implements RemoveCookie {
-    private final GraphDocument document;
     private final InputGraph graph;
 
-    public GraphRemoveCookie(GraphDocument document, InputGraph graph) {
-        this.document = document;
+    public GraphRemoveCookie(InputGraph graph) {
         this.graph = graph;
     }
 
+    @Override
     public void remove() {
-        if (!graph.getGroup().isComplete()) {
-            String msg = "This graph or the group it belongs to is still being loaded. Removing this graph now can cause problems. Do you want to continue and remove the graph?";
-            NotifyDescriptor desc = new NotifyDescriptor(msg, "Incomplete data", NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE, null, NotifyDescriptor.NO_OPTION);
-
-            if (DialogDisplayer.getDefault().notify(desc) == DialogDescriptor.NO_OPTION) {
-                return;
-            }
-        }
-
-        if (graph.getGroup().getGraphsCount() > 1) {
-            graph.getGroup().removeGraph(graph);
-        } else {
-            // Last graph, remove the entire group
-            document.removeGroup(graph.getGroup());
-        }
+        graph.getGroup().removeElement(graph);
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -27,8 +27,8 @@
 import com.sun.hotspot.igv.coordinator.OutlineTopComponent;
 import com.sun.hotspot.igv.data.GraphDocument;
 import com.sun.hotspot.igv.data.serialization.Parser;
+import com.sun.hotspot.igv.data.serialization.XMLParser;
 import com.sun.hotspot.igv.settings.Settings;
-import com.sun.hotspot.igv.data.serialization.XMLParser;
 import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import java.io.File;
@@ -38,6 +38,7 @@
 import javax.swing.Action;
 import javax.swing.JFileChooser;
 import javax.swing.KeyStroke;
+import javax.swing.SwingUtilities;
 import javax.swing.filechooser.FileFilter;
 import org.netbeans.api.progress.ProgressHandle;
 import org.netbeans.api.progress.ProgressHandleFactory;
@@ -59,16 +60,19 @@
     public static FileFilter getFileFilter() {
         return new FileFilter() {
 
+            @Override
             public boolean accept(File f) {
                 return f.getName().toLowerCase().endsWith(".xml") || f.isDirectory();
             }
 
+            @Override
             public String getDescription() {
                 return "XML files (*.xml)";
             }
         };
     }
 
+    @Override
     public void performAction() {
 
         JFileChooser fc = new JFileChooser();
@@ -96,6 +100,7 @@
 
                 final XMLParser.ParseMonitor parseMonitor = new XMLParser.ParseMonitor() {
 
+                    @Override
                     public void setProgress(double d) {
                         try {
                             int curAvailable = inputStream.available();
@@ -105,6 +110,7 @@
                         }
                     }
 
+                    @Override
                     public void setState(String state) {
                         setProgress(0.0);
                         handle.progress(state);
@@ -117,12 +123,18 @@
 
                 RequestProcessor.getDefault().post(new Runnable() {
 
+                    @Override
                     public void run() {
-                        GraphDocument document = null;
                         try {
-                            document = parser.parse(is, parseMonitor);
+                            final GraphDocument document = parser.parse(is, parseMonitor);
                             parseMonitor.setState("Finishing");
-                            component.getDocument().addGraphDocument(document);
+                            SwingUtilities.invokeLater(new Runnable(){
+
+                                @Override
+                                public void run() {
+                                    component.getDocument().addGraphDocument(document);
+                                }
+                            });
                         } catch (SAXException ex) {
                             String s = "Exception during parsing the XML file, could not load document!";
                             if (ex instanceof XMLParser.MissingAttributeException) {
@@ -145,6 +157,7 @@
         }
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(ImportAction.class, "CTL_ImportAction");
     }
@@ -159,6 +172,7 @@
         return "com/sun/hotspot/igv/coordinator/images/import.png";
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/OutlineAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/OutlineAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,7 +24,7 @@
 
 package com.sun.hotspot.igv.coordinator.actions;
 
-import com.sun.hotspot.igv.coordinator.*;
+import com.sun.hotspot.igv.coordinator.OutlineTopComponent;
 import java.awt.event.ActionEvent;
 import javax.swing.AbstractAction;
 import org.openide.util.NbBundle;
@@ -40,6 +40,7 @@
         super(NbBundle.getMessage(OutlineAction.class, "CTL_OutlineAction"));
     }
 
+    @Override
     public void actionPerformed(ActionEvent evt) {
         TopComponent win = OutlineTopComponent.findInstance();
         win.open();
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -36,6 +36,7 @@
  */
 public final class RemoveAction extends NodeAction {
 
+    @Override
     protected void performAction(Node[] activatedNodes) {
         for (Node n : activatedNodes) {
             RemoveCookie removeCookie = n.getCookie(RemoveCookie.class);
@@ -49,6 +50,7 @@
         putValue(Action.SHORT_DESCRIPTION, "Remove selected graphs and groups");
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(RemoveAction.class, "CTL_RemoveAction");
     }
@@ -58,6 +60,7 @@
         return "com/sun/hotspot/igv/coordinator/images/remove.png";
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
@@ -67,6 +70,7 @@
         return false;
     }
 
+    @Override
     protected boolean enable(Node[] nodes) {
         return nodes.length > 0;
     }
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAllAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAllAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -40,6 +40,7 @@
 public final class RemoveAllAction extends CallableSystemAction {
 
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(RemoveAllAction.class, "CTL_RemoveAllAction");
     }
@@ -54,6 +55,7 @@
         return "com/sun/hotspot/igv/coordinator/images/removeall.png";
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -39,11 +39,13 @@
  */
 public final class SaveAllAction extends CallableSystemAction {
 
+    @Override
     public void performAction() {
         final OutlineTopComponent component = OutlineTopComponent.findInstance();
         SaveAsAction.save(component.getDocument());
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(SaveAllAction.class, "CTL_SaveAllAction");
     }
@@ -58,6 +60,7 @@
         return "com/sun/hotspot/igv/coordinator/images/saveall.gif";
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -28,12 +28,7 @@
 import com.sun.hotspot.igv.data.Group;
 import com.sun.hotspot.igv.data.serialization.Printer;
 import com.sun.hotspot.igv.settings.Settings;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
+import java.io.*;
 import javax.swing.Action;
 import javax.swing.JFileChooser;
 import org.openide.nodes.Node;
@@ -52,12 +47,13 @@
         putValue(Action.SHORT_DESCRIPTION, "Save selected groups to XML file...");
     }
 
+    @Override
     protected void performAction(Node[] activatedNodes) {
 
         GraphDocument doc = new GraphDocument();
         for (Node n : activatedNodes) {
             Group group = n.getLookup().lookup(Group.class);
-            doc.addGroup(group);
+            doc.addElement(group);
         }
 
         save(doc);
@@ -80,10 +76,10 @@
             }
             Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath());
             try {
-                Writer writer = new OutputStreamWriter(new FileOutputStream(file));
-                Printer p = new Printer();
-                p.export(writer, doc);
-                writer.close();
+                try (Writer writer = new OutputStreamWriter(new FileOutputStream(file))) {
+                    Printer p = new Printer();
+                    p.export(writer, doc);
+                }
             } catch (FileNotFoundException e) {
                 e.printStackTrace();
             } catch (IOException e) {
@@ -97,6 +93,7 @@
         return CookieAction.MODE_SOME;
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(SaveAsAction.class, "CTL_SaveAsAction");
     }
@@ -106,6 +103,7 @@
         return "com/sun/hotspot/igv/coordinator/images/save.png";
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
@@ -115,6 +113,7 @@
         return false;
     }
 
+    @Override
     protected boolean enable(Node[] nodes) {
 
         int cnt = 0;
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/StructuredViewAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.sun.hotspot.igv.coordinator.actions;
-
-import com.sun.hotspot.igv.coordinator.OutlineTopComponent;
-import com.sun.hotspot.igv.data.services.GroupOrganizer;
-import java.awt.Component;
-import java.awt.Image;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.image.BufferedImage;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.swing.Action;
-import javax.swing.ButtonGroup;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-import javax.swing.event.PopupMenuEvent;
-import javax.swing.event.PopupMenuListener;
-import org.openide.awt.DropDownButtonFactory;
-import org.openide.util.HelpCtx;
-import org.openide.util.ImageUtilities;
-import org.openide.util.Lookup;
-import org.openide.util.actions.CallableSystemAction;
-
-public class StructuredViewAction extends CallableSystemAction {
-
-    private static JButton dropDownButton;
-    private static ButtonGroup buttonGroup;
-    private static JPopupMenu popup;
-    private MyMenuItemListener menuItemListener;
-    private Map<JMenuItem, GroupOrganizer> map;
-
-    public StructuredViewAction() {
-
-        putValue(Action.SHORT_DESCRIPTION, "Cluster nodes into blocks");
-    }
-
-    @Override
-    public Component getToolbarPresenter() {
-
-        Image iconImage = ImageUtilities.loadImage("com/sun/hotspot/igv/coordinator/images/structure.png");
-        ImageIcon icon = new ImageIcon(iconImage);
-
-        popup = new JPopupMenu();
-
-        menuItemListener = new MyMenuItemListener();
-
-        buttonGroup = new ButtonGroup();
-
-        Collection<? extends GroupOrganizer> organizersCollection = Lookup.getDefault().lookupAll(GroupOrganizer.class);
-
-        List<GroupOrganizer> organizers = new ArrayList<GroupOrganizer>(organizersCollection);
-        Collections.sort(organizers, new Comparator<GroupOrganizer>() {
-            public int compare(GroupOrganizer a, GroupOrganizer b) {
-                return a.getName().compareTo(b.getName());
-            }
-        });
-
-        map = new HashMap<JMenuItem, GroupOrganizer>();
-
-        boolean first = true;
-        for(GroupOrganizer organizer : organizers) {
-            JCheckBoxMenuItem item = new JCheckBoxMenuItem(organizer.getName());
-            map.put(item, organizer);
-            item.addActionListener(menuItemListener);
-            buttonGroup.add(item);
-            popup.add(item);
-            if(first) {
-                item.setSelected(true);
-                first = false;
-            }
-        }
-
-        dropDownButton = DropDownButtonFactory.createDropDownButton(
-                new ImageIcon(
-                new BufferedImage(32, 32, BufferedImage.TYPE_BYTE_GRAY)),
-                popup);
-
-        dropDownButton.setIcon(icon);
-
-        dropDownButton.setToolTipText("Choose group organization");
-
-        dropDownButton.addItemListener(new ItemListener() {
-
-            public void itemStateChanged(ItemEvent e) {
-                int state = e.getStateChange();
-                if (state == ItemEvent.SELECTED) {
-                    performAction();
-                }
-            }
-        });
-
-        dropDownButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                performAction();
-            }
-        });
-
-        popup.addPopupMenuListener(new PopupMenuListener() {
-
-            public void popupMenuCanceled(PopupMenuEvent e) {
-                dropDownButton.setSelected(false);
-            }
-
-            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
-                dropDownButton.setSelected(false);
-            }
-
-            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
-                dropDownButton.setSelected(true);
-            }
-        });
-
-        return dropDownButton;
-
-    }
-
-    private class MyMenuItemListener implements ActionListener {
-
-        public void actionPerformed(ActionEvent ev) {
-            JMenuItem item = (JMenuItem) ev.getSource();
-            GroupOrganizer organizer = map.get(item);
-            assert organizer != null : "Organizer must exist!";
-            OutlineTopComponent.findInstance().setOrganizer(organizer);
-        }
-    }
-
-
-    @Override
-    public void performAction() {
-        popup.show(dropDownButton, 0, dropDownButton.getHeight());
-    }
-
-    public String getName() {
-        return "Structured View";
-    }
-
-    public HelpCtx getHelpCtx() {
-        return HelpCtx.DEFAULT_HELP;
-    }
-
-    @Override
-    protected boolean asynchronous() {
-        return false;
-    }
-
-}
--- a/src/share/tools/IdealGraphVisualizer/Data/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,8 +1,8 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
-src.dir=src
-build.test.classes.dir=${build.dir}/test/classes
-build.test.results.dir=${build.dir}/test/results
-test.src.dir=test
-build.test.classes.dir=${build.dir}/test/classes
-build.test.results.dir=${build.dir}/test/results
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
+src.dir=src
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+test.src.dir=test
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/ChangedEvent.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/ChangedEvent.java	Thu Feb 02 16:07:52 2012 -0800
@@ -39,6 +39,7 @@
         this.object = object;
     }
 
+    @Override
     protected void fire(ChangedListener<T> l) {
         l.changed(object);
     }
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/ControllableChangedListener.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/ControllableChangedListener.java	Thu Feb 02 16:07:52 2012 -0800
@@ -45,6 +45,7 @@
 		enabled = b;
 	}
 
+    @Override
 	public void changed(T source) {
 		if(enabled) {
 			filteredChanged(source);
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Event.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Event.java	Thu Feb 02 16:07:52 2012 -0800
@@ -37,7 +37,7 @@
     private boolean eventWasFired;
     
     public Event() {
-        listener = new ArrayList<L>();
+        listener = new ArrayList<>();
         fireEvents = true;
     }
 
@@ -55,7 +55,7 @@
 
     public void fire() {
         if(fireEvents) {
-            List<L> tmpList = new ArrayList<L>(listener);
+            List<L> tmpList = new ArrayList<>(listener);
             for (L l : tmpList) {
                 fire(l);
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Folder.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,33 @@
+/*
+ * 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.sun.hotspot.igv.data;
+
+import java.util.List;
+
+public interface Folder {
+    List<? extends FolderElement> getElements();
+    void removeElement(FolderElement element);
+    void addElement(FolderElement group);
+    ChangedEvent<? extends Folder> getChangedEvent();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/FolderElement.java	Thu Feb 02 16:07:52 2012 -0800
@@ -0,0 +1,31 @@
+/*
+ * 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.sun.hotspot.igv.data;
+
+public interface FolderElement {
+    
+    Folder getParent();
+    String getName();
+    void setParent(Folder parent);
+}
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,51 +24,36 @@
 package com.sun.hotspot.igv.data;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 /**
  *
  * @author Thomas Wuerthinger
  */
-public class GraphDocument extends Properties.Entity implements ChangedEventProvider<GraphDocument> {
+public class GraphDocument extends Properties.Entity implements ChangedEventProvider<GraphDocument>, Folder {
 
-    private List<Group> groups;
+    private List<FolderElement> elements;
     private ChangedEvent<GraphDocument> changedEvent;
 
     public GraphDocument() {
-        groups = new ArrayList<Group>();
-        changedEvent = new ChangedEvent<GraphDocument>(this);
+        elements = new ArrayList<>();
+        changedEvent = new ChangedEvent<>(this);
     }
 
     public void clear() {
-        groups.clear();
+        elements.clear();
         getChangedEvent().fire();
     }
 
+    @Override
     public ChangedEvent<GraphDocument> getChangedEvent() {
         return changedEvent;
     }
 
-    public List<Group> getGroups() {
-        return Collections.unmodifiableList(groups);
-    }
-
-    public void addGroup(Group group) {
-        groups.add(group);
-        getChangedEvent().fire();
-    }
-
-    public void removeGroup(Group group) {
-        if (groups.contains(group)) {
-            groups.remove(group);
-            getChangedEvent().fire();
-        }
-    }
-
     public void addGraphDocument(GraphDocument document) {
-        for (Group g : document.groups) {
-            this.addGroup(g);
+        for (FolderElement e : document.elements) {
+            e.setParent(this);
+            this.addElement(e);
         }
         document.clear();
         getChangedEvent().fire();
@@ -78,12 +63,30 @@
     public String toString() {
         StringBuilder sb = new StringBuilder();
 
-        sb.append("GraphDocument: " + getProperties().toString() + " \n\n");
-        for (Group g : getGroups()) {
+        sb.append("GraphDocument: ").append(getProperties().toString()).append(" \n\n");
+        for (FolderElement g : getElements()) {
             sb.append(g.toString());
             sb.append("\n\n");
         }
 
         return sb.toString();
     }
+
+    @Override
+    public List<? extends FolderElement> getElements() {
+        return elements;
+    }
+
+    @Override
+    public void removeElement(FolderElement element) {
+        if (elements.remove(element)) {
+            getChangedEvent().fire();
+        }
+    }
+
+    @Override
+    public void addElement(FolderElement element) {
+        elements.add(element);
+        getChangedEvent().fire();
+    }
 }
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,54 +23,36 @@
  */
 package com.sun.hotspot.igv.data;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 /**
  *
  * @author Thomas Wuerthinger
  */
-public class Group extends Properties.Entity implements ChangedEventProvider<Group> {
+public class Group extends Properties.Entity implements ChangedEventProvider<Group>, Folder, FolderElement {
 
+    private final List<FolderElement> elements;
     private final List<InputGraph> graphs;
 
     private InputMethod method;
-    private String assembly;
     private transient ChangedEvent<Group> changedEvent;
-    private transient boolean complete = true;
+    private Folder parent;
 
-    public Group() {
-        graphs = Collections.synchronizedList(new ArrayList<InputGraph>());
-        changedEvent = new ChangedEvent<Group>(this);
+    public Group(Folder parent) {
+        elements = new ArrayList<>();
+        graphs = new ArrayList<>();
+        changedEvent = new ChangedEvent<>(this);
+        this.parent = parent;
 
         // Ensure that name and type are never null
         getProperties().setProperty("name", "");
         getProperties().setProperty("type", "");
     }
 
-    public void setComplete(boolean complete) {
-        this.complete = complete;
-    }
-
-    public boolean isComplete() {
-        return complete;
-    }
-
     public void fireChangedEvent() {
         changedEvent.fire();
     }
 
-    public void setAssembly(String s) {
-        this.assembly = s;
-    }
-
-    public String getAssembly() {
-        return assembly;
-    }
-
     public void setMethod(InputMethod method) {
         this.method = method;
     }
@@ -79,56 +61,37 @@
         return method;
     }
 
+    @Override
     public ChangedEvent<Group> getChangedEvent() {
         return changedEvent;
     }
 
-    public List<InputGraph> getGraphs() {
-        return Collections.unmodifiableList(graphs);
+    @Override
+    public List<FolderElement> getElements() {
+        return Collections.unmodifiableList(elements);
     }
 
     public int getGraphsCount() {
-        return graphs.size();
+        return elements.size();
     }
-
-    public List<InputGraph> getGraphListCopy() {
-        synchronized (graphs) {
-            return new ArrayList<InputGraph>(graphs);
+    
+    @Override
+    public void addElement(FolderElement element) {
+        elements.add(element);
+        if (element instanceof InputGraph) {
+            graphs.add((InputGraph) element);
+        } else {
+            
         }
-    }
-
-    public void addGraph(InputGraph graph) {
-        synchronized (graphs) {
-            graph.setParent(this, graphs.size());
-            graphs.add(graph);
-        }
+        element.setParent(this);
         changedEvent.fire();
     }
 
-    public InputGraph addGraph(String name) {
-        return addGraph(name, null);
-    }
-
-    public InputGraph addGraph(String name, Pair<InputGraph, InputGraph> pair) {
-        InputGraph g;
-        synchronized (graphs) {
-            g = new InputGraph(graphs.size(), this, name, pair);
-            graphs.add(g);
-        }
-        changedEvent.fire();
-        return g;
-    }
-
-    public void removeGraph(InputGraph g) {
-        if (graphs.remove(g)) {
-            changedEvent.fire();
-        }
-    }
-
     public Set<Integer> getAllNodes() {
-        Set<Integer> result = new HashSet<Integer>();
-        synchronized (graphs) {
-            for (InputGraph g : graphs) {
+        Set<Integer> result = new HashSet<>();
+        for (FolderElement e : elements) {
+            if (e instanceof InputGraph) {
+                InputGraph g = (InputGraph) e;
                 result.addAll(g.getNodesAsSet());
             }
         }
@@ -138,21 +101,80 @@
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
-        sb.append("Group " + getProperties().toString() + "\n");
-        synchronized (graphs) {
-            for (InputGraph g : graphs) {
-                sb.append(g.toString());
-                sb.append('\n');
-            }
+        sb.append("Group ").append(getProperties()).append("\n");
+        for (FolderElement g : elements) {
+            sb.append(g.toString());
+            sb.append('\n');
         }
         return sb.toString();
     }
 
+    @Override
     public String getName() {
         return getProperties().get("name");
     }
 
     public String getType() {
         return getProperties().get("type");
+        
+    }
+
+    InputGraph getPrev(InputGraph graph) {
+        InputGraph lastGraph = null;
+        for (FolderElement e : elements) {
+            if (e == graph) {
+                return lastGraph;
+            }
+            if (e instanceof InputGraph) {
+                lastGraph = (InputGraph) e;
+            }
+        }
+        return null;
+    }
+
+    InputGraph getNext(InputGraph graph) {
+        boolean found = false;
+        for (FolderElement e : elements) {
+            if (e == graph) {
+                found = true;
+            } else if (found && e instanceof InputGraph) {
+                return (InputGraph) e;
+            }
+        }
+        return null;
+    }
+
+    public InputGraph getLastGraph() {
+        InputGraph lastGraph = null;
+        for (FolderElement e : elements) {
+            if (e instanceof InputGraph) {
+                lastGraph = (InputGraph) e;
+            }
+        }
+        return lastGraph;
+    }
+
+    @Override
+    public Folder getParent() {
+         return parent;
+    }
+
+    @Override
+    public void removeElement(FolderElement element) {
+        if (elements.remove(element)) {
+            if (element instanceof InputGraph) {
+                graphs.remove((InputGraph) element);
+            }
+            changedEvent.fire();
+        }
+    }
+
+    public List<InputGraph> getGraphs() {
+        return graphs;
+    }
+
+    @Override
+    public void setParent(Folder parent) {
+        this.parent = parent;
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputBlock.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputBlock.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,12 +23,7 @@
  */
 package com.sun.hotspot.igv.data;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 /**
  *
@@ -63,7 +58,7 @@
             return false;
         }
 
-        final HashSet<String> s = new HashSet<String>();
+        final HashSet<String> s = new HashSet<>();
         for (InputBlock succ : successors) {
             s.add(succ.name);
         }
@@ -80,8 +75,8 @@
     InputBlock(InputGraph graph, String name) {
         this.graph = graph;
         this.name = name;
-        nodes = new ArrayList<InputNode>();
-        successors = new LinkedHashSet<InputBlock>(2);
+        nodes = new ArrayList<>();
+        successors = new LinkedHashSet<>(2);
     }
 
     public String getName() {
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputEdge.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputEdge.java	Thu Feb 02 16:07:52 2012 -0800
@@ -40,6 +40,7 @@
     
     public static final Comparator<InputEdge> OUTGOING_COMPARATOR = new Comparator<InputEdge>(){
 
+        @Override
             public int compare(InputEdge o1, InputEdge o2) {
                 if(o1.getFromIndex() == o2.getFromIndex()) {
                     return o1.getTo() - o2.getTo();
@@ -51,6 +52,7 @@
     
     public static final Comparator<InputEdge> INGOING_COMPARATOR = new Comparator<InputEdge>(){
 
+        @Override
             public int compare(InputEdge o1, InputEdge o2) {
                 if(o1.getToIndex() == o2.getToIndex()) {
                     return o1.getFrom() - o2.getFrom();
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,54 +23,38 @@
  */
 package com.sun.hotspot.igv.data;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  *
  * @author Thomas Wuerthinger
  */
-public class InputGraph extends Properties.Entity {
+public class InputGraph extends Properties.Entity implements FolderElement {
 
     private Map<Integer, InputNode> nodes;
     private Set<InputEdge> edges;
-    private Group parent;
+    private Folder parent;
+    private Group parentGroup;
     private Map<String, InputBlock> blocks;
     private Set<InputBlockEdge> blockEdges;
     private Map<Integer, InputBlock> nodeToBlock;
-    private Pair<InputGraph, InputGraph> sourceGraphs;
-    private int parentIndex;
 
-    public static InputGraph createWithoutGroup(String name, Pair<InputGraph, InputGraph> sourceGraphs) {
-        return new InputGraph(-1, null, name, sourceGraphs);
-    }
-
-    InputGraph(int parentIndex, Group parent, String name, Pair<InputGraph, InputGraph> sourceGraphs) {
-        this.parentIndex = parentIndex;
-        this.parent = parent;
-        this.sourceGraphs = sourceGraphs;
+    public InputGraph(String name) {
         setName(name);
-        nodes = new LinkedHashMap<Integer, InputNode>();
-        edges = new LinkedHashSet<InputEdge>();
-        blocks = new LinkedHashMap<String, InputBlock>();
-        blockEdges = new LinkedHashSet<InputBlockEdge>();
-        nodeToBlock = new LinkedHashMap<Integer, InputBlock>();
+        nodes = new LinkedHashMap<>();
+        edges = new LinkedHashSet<>();
+        blocks = new LinkedHashMap<>();
+        blockEdges = new LinkedHashSet<>();
+        nodeToBlock = new LinkedHashMap<>();
     }
     
-    public void setParent(Group parent, int parentIndex) {
-        assert (this.parent == null);
-        assert (this.parentIndex == -1);
-
+    @Override
+    public void setParent(Folder parent) {
         this.parent = parent;
-        this.parentIndex = parentIndex;
+        if (parent instanceof Group) {
+            assert this.parentGroup == null;
+            this.parentGroup = (Group) parent;
+        }
     }
 
     public InputBlockEdge addBlockEdge(InputBlock left, InputBlock right) {
@@ -79,14 +63,10 @@
         left.addSuccessor(right);
         return edge;
     }
-
-    public Pair<InputGraph, InputGraph> getSourceGraphs() {
-        return sourceGraphs;
-    }
     
     public List<InputNode> findRootNodes() {
-        List<InputNode> result = new ArrayList<InputNode>();
-        Set<Integer> nonRoot = new HashSet<Integer>();
+        List<InputNode> result = new ArrayList<>();
+        Set<Integer> nonRoot = new HashSet<>();
         for(InputEdge curEdges : getEdges()) {
             nonRoot.add(curEdges.getTo());
         }
@@ -102,7 +82,7 @@
     
     public Map<InputNode, List<InputEdge>> findAllOutgoingEdges() {
         
-        Map<InputNode, List<InputEdge>> result = new HashMap<InputNode, List<InputEdge>>(getNodes().size());
+        Map<InputNode, List<InputEdge>> result = new HashMap<>(getNodes().size());
         for(InputNode n : this.getNodes()) {
             result.put(n, new ArrayList<InputEdge>());
         }
@@ -125,7 +105,7 @@
     
     public Map<InputNode, List<InputEdge>> findAllIngoingEdges() {
         
-        Map<InputNode, List<InputEdge>> result = new HashMap<InputNode, List<InputEdge>>(getNodes().size());
+        Map<InputNode, List<InputEdge>> result = new HashMap<>(getNodes().size());
         for(InputNode n : this.getNodes()) {
             result.put(n, new ArrayList<InputEdge>());
         }
@@ -147,7 +127,7 @@
     }
     
     public List<InputEdge> findOutgoingEdges(InputNode n) {
-        List<InputEdge> result = new ArrayList<InputEdge>();
+        List<InputEdge> result = new ArrayList<>();
         
         for(InputEdge e : this.edges) {
             if(e.getFrom() == n.getId()) {
@@ -177,7 +157,7 @@
 
     public void ensureNodesInBlocks() {
         InputBlock noBlock = null;
-        Set<InputNode> scheduledNodes = new HashSet<InputNode>();
+        Set<InputNode> scheduledNodes = new HashSet<>();
 
         for (InputBlock b : getBlocks()) {
             for (InputNode n : b.getNodes()) {
@@ -213,27 +193,18 @@
     }
 
     public InputGraph getNext() {
-        List<InputGraph> list = parent.getGraphs();
-        if (parentIndex == list.size() - 1) {
-            return null;
-        } else {
-            return list.get(parentIndex + 1);
-        }
+        return parentGroup.getNext(this);
     }
 
     public InputGraph getPrev() {
-        List<InputGraph> list = parent.getGraphs();
-        if (parentIndex == 0) {
-            return null;
-        } else {
-            return list.get(parentIndex - 1);
-        }
+        return parentGroup.getPrev(this);
     }
 
     private void setName(String name) {
         this.getProperties().setProperty("name", name);
     }
 
+    @Override
     public String getName() {
         return getProperties().get("name");
     }
@@ -279,13 +250,13 @@
     }
 
     public Group getGroup() {
-        return parent;
+        return parentGroup;
     }
 
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
-        sb.append("Graph " + getName() + " " + getProperties().toString() + "\n");
+        sb.append("Graph ").append(getName()).append(" ").append(getProperties().toString()).append("\n");
         for (InputNode n : nodes.values()) {
             sb.append(n.toString());
             sb.append("\n");
@@ -317,4 +288,9 @@
     public Collection<InputBlockEdge> getBlockEdges() {
         return Collections.unmodifiableSet(blockEdges);
     }
+
+    @Override
+    public Folder getParent() {
+        return parent;
+    }
 }
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputMethod.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputMethod.java	Thu Feb 02 16:07:52 2012 -0800
@@ -70,8 +70,8 @@
         this.name = name;
         this.bci = bci;
         this.shortName = shortName;
-        inlined = new ArrayList<InputMethod>();
-        bytecodes = new ArrayList<InputBytecode>();
+        inlined = new ArrayList<>();
+        bytecodes = new ArrayList<>();
     }
 
     public List<InputBytecode> getBytecodes() {
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -34,6 +34,7 @@
     private int id;
 
     public static final Comparator<InputNode> COMPARATOR = new Comparator<InputNode>() {
+        @Override
         public int compare(InputNode o1, InputNode o2) {
             return o1.getId() - o2.getId();
         }
@@ -42,6 +43,7 @@
     public static Comparator<InputNode> getPropertyComparator(final String propertyName) {
         return new Comparator<InputNode>() {
 
+            @Override
             public int compare(InputNode o1, InputNode o2) {
 
                 int i1 = 0;
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Pair.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Pair.java	Thu Feb 02 16:07:52 2012 -0800
@@ -61,7 +61,7 @@
         if (o == null || !(o instanceof Pair)) {
             return false;
         }
-        Pair obj = (Pair) o;
+        Pair<?,?> obj = (Pair<?,?>) o;
         boolean b1 = (l == obj.l);
         if (l != null) {
             b1 = l.equals(obj.l);
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,12 +24,7 @@
 package com.sun.hotspot.igv.data;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
@@ -119,6 +114,7 @@
             properties = new Properties(object.getProperties());
         }
 
+        @Override
         public Properties getProperties() {
             return properties;
         }
@@ -139,10 +135,12 @@
             this.matcher = matcher;
         }
 
+        @Override
         public String getName() {
             return matcher.getName();
         }
 
+        @Override
         public boolean match(String p) {
             if (p == null) {
                 return false;
@@ -167,10 +165,12 @@
             this.value = value;
         }
 
+        @Override
         public String getName() {
             return name;
         }
 
+        @Override
         public boolean match(String p) {
             if (p == null) {
                 throw new IllegalArgumentException("Property value must not be null!");
@@ -207,10 +207,12 @@
             }
         }
 
+        @Override
         public String getName() {
             return name;
         }
 
+        @Override
         public boolean match(String p) {
             if (p == null) {
                 throw new IllegalArgumentException("Property value must not be null!");
@@ -244,7 +246,7 @@
 
     @Override
     public String toString() {
-        List<String[]> pairs = new ArrayList<String[]>();
+        List<String[]> pairs = new ArrayList<>();
         for (int i = 0; i < map.length; i += 2) {
             if (map[i + 1] != null) {
                 pairs.add(new String[]{map[i], map[i + 1]});
@@ -252,6 +254,7 @@
         }
 
         Collections.sort(pairs, new Comparator<String[]>() {
+            @Override
             public int compare(String[] o1, String[] o2) {
                 assert o1.length == 2;
                 assert o2.length == 2;
@@ -294,7 +297,7 @@
         }
 
         public List<T> selectMultiple(PropertyMatcher matcher) {
-            List<T> result = new ArrayList<T>();
+            List<T> result = new ArrayList<>();
 
             for (T t : objects) {
                 Property p = t.getProperties().selectSingle(matcher);
@@ -358,6 +361,7 @@
 
         int index;
 
+        @Override
         public boolean hasNext() {
             while (index < map.length && map[index + 1] == null) {
                 index += 2;
@@ -365,6 +369,7 @@
             return index < map.length;
         }
 
+        @Override
         public Property next() {
             if (index < map.length) {
                 index += 2;
@@ -373,11 +378,13 @@
             return null;
         }
 
+        @Override
         public void remove() {
             throw new UnsupportedOperationException("Not supported yet.");
         }
     }
 
+    @Override
     public Iterator<Property> iterator() {
         return new PropertiesIterator();
     }
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Source.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Source.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,11 +23,7 @@
  */
 package com.sun.hotspot.igv.data;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 /**
  *
@@ -39,8 +35,8 @@
     private Set<Integer> set;
 
     public Source() {
-        sourceNodes = new ArrayList<InputNode>(1);
-        set = new LinkedHashSet<Integer>(1);
+        sourceNodes = new ArrayList<>(1);
+        set = new LinkedHashSet<>(1);
     }
 
     public List<InputNode> getSourceNodes() {
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,25 +23,18 @@
  */
 package com.sun.hotspot.igv.data.serialization;
 
-import com.sun.hotspot.igv.data.GraphDocument;
-import com.sun.hotspot.igv.data.Group;
-import com.sun.hotspot.igv.data.InputBlock;
-import com.sun.hotspot.igv.data.InputEdge;
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.data.InputMethod;
-import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.data.Pair;
-import com.sun.hotspot.igv.data.Properties;
-import com.sun.hotspot.igv.data.services.GroupCallback;
+import com.sun.hotspot.igv.data.*;
 import com.sun.hotspot.igv.data.serialization.XMLParser.ElementHandler;
 import com.sun.hotspot.igv.data.serialization.XMLParser.HandoverElementHandler;
 import com.sun.hotspot.igv.data.serialization.XMLParser.ParseMonitor;
 import com.sun.hotspot.igv.data.serialization.XMLParser.TopElementHandler;
+import com.sun.hotspot.igv.data.services.GroupCallback;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
+import java.util.Map;
+import javax.swing.SwingUtilities;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.Source;
@@ -98,12 +91,14 @@
     public static final String SUCCESSOR_ELEMENT = "successor";
     public static final String ASSEMBLY_ELEMENT = "assembly";
     public static final String DIFFERENCE_PROPERTY = "difference";
-    private TopElementHandler<GraphDocument> xmlDocument = new TopElementHandler<GraphDocument>();
-    private boolean difference;
+    private TopElementHandler<GraphDocument> xmlDocument = new TopElementHandler<>();
+    private Map<Group, Boolean> differenceEncoding = new HashMap<>();
+    private Map<Group, InputGraph> lastParsedGraph = new HashMap<>();
     private GroupCallback groupCallback;
-    private HashMap<String, Integer> idCache = new HashMap<String, Integer>();
-    private ArrayList<Pair<String, String>> blockConnections = new ArrayList<Pair<String, String>>();
+    private HashMap<String, Integer> idCache = new HashMap<>();
+    private ArrayList<Pair<String, String>> blockConnections = new ArrayList<>();
     private int maxId = 0;
+    private GraphDocument graphDocument;
 
     private int lookupID(String i) {
         try {
@@ -124,19 +119,19 @@
 
         @Override
         protected GraphDocument start() throws SAXException {
-            return new GraphDocument();
+            graphDocument = new GraphDocument();
+            return graphDocument;
         }
     };
     // <group>
-    private ElementHandler<Group, GraphDocument> groupHandler = new XMLParser.ElementHandler<Group, GraphDocument>(GROUP_ELEMENT) {
+    private ElementHandler<Group, Folder> groupHandler = new XMLParser.ElementHandler<Group, Folder>(GROUP_ELEMENT) {
 
         @Override
         protected Group start() throws SAXException {
-            Group group = new Group();
-            group.setComplete(false);
+            Group group = new Group(this.getParentObject());
             
             String differenceProperty = this.readAttribute(DIFFERENCE_PROPERTY);
-            Parser.this.difference = (differenceProperty != null && (differenceProperty.equals("1") || differenceProperty.equals("true")));
+            Parser.this.differenceEncoding.put(group, (differenceProperty != null && (differenceProperty.equals("1") || differenceProperty.equals("true"))));
 
             ParseMonitor monitor = getMonitor();
             if (monitor != null) {
@@ -148,20 +143,18 @@
 
         @Override
         protected void end(String text) throws SAXException {
-            Group group = getObject();
-            group.setComplete(true);
-            if (groupCallback == null) {
-                getParentObject().addGroup(group);
+            final Group group = getObject();
+            final Folder parent = getParentObject();
+            if (groupCallback == null || parent instanceof Group) {
+                SwingUtilities.invokeLater(new Runnable(){
+                    @Override
+                    public void run() {
+                        parent.addElement(group);
+                    }
+                });
             }
         }
     };
-    private HandoverElementHandler<Group> assemblyHandler = new XMLParser.HandoverElementHandler<Group>(ASSEMBLY_ELEMENT, true) {
-
-        @Override
-        protected void end(String text) throws SAXException {
-            getParentObject().setAssembly(text);
-        }
-    };
     // <method>
     private ElementHandler<InputMethod, Group> methodHandler = new XMLParser.ElementHandler<InputMethod, Group>(METHOD_ELEMENT) {
 
@@ -174,7 +167,7 @@
         }
     };
 
-    private InputMethod parseMethod(XMLParser.ElementHandler handler, Group group) throws SAXException {
+    private InputMethod parseMethod(XMLParser.ElementHandler<?,?> handler, Group group) throws SAXException {
         String s = handler.readRequiredAttribute(METHOD_BCI_PROPERTY);
         int bci = 0;
         try {
@@ -194,7 +187,7 @@
         }
     };
     // <inlined>
-    private HandoverElementHandler<InputMethod> inlinedHandler = new XMLParser.HandoverElementHandler<InputMethod>(INLINE_ELEMENT);
+    private HandoverElementHandler<InputMethod> inlinedHandler = new XMLParser.HandoverElementHandler<>(INLINE_ELEMENT);
     // <inlined><method>
     private ElementHandler<InputMethod, InputMethod> inlinedMethodHandler = new XMLParser.ElementHandler<InputMethod, InputMethod>(METHOD_ELEMENT) {
 
@@ -208,16 +201,14 @@
     // <graph>
     private ElementHandler<InputGraph, Group> graphHandler = new XMLParser.ElementHandler<InputGraph, Group>(GRAPH_ELEMENT) {
 
-        private InputGraph graph;
-
         @Override
         protected InputGraph start() throws SAXException {
             String name = readAttribute(GRAPH_NAME_PROPERTY);
-            InputGraph curGraph = InputGraph.createWithoutGroup(name, null);
-            if (difference) {
-                List<InputGraph> list = getParentObject().getGraphs();
-                if (list.size() > 0) {
-                    InputGraph previous = list.get(list.size() - 1);
+            InputGraph curGraph = new InputGraph(name);
+            if (differenceEncoding.get(getParentObject())) {
+                InputGraph previous = lastParsedGraph.get(getParentObject());
+                lastParsedGraph.put(getParentObject(), curGraph);
+                if (previous != null) {
                     for (InputNode n : previous.getNodes()) {
                         curGraph.addNode(n);
                     }
@@ -226,7 +217,6 @@
                     }
                 }
             }
-            this.graph = curGraph;
             return curGraph;
         }
 
@@ -239,6 +229,8 @@
             //       block to some artificial block below unless blocks are
             //       defined and nodes are assigned to them.
 
+            final InputGraph graph = getObject();
+            final Group parent = getParentObject();
             if (graph.getBlocks().size() > 0) {
                 boolean blocksContainNodes = false;
                 for (InputBlock b : graph.getBlocks()) {
@@ -279,14 +271,20 @@
             }
             blockConnections.clear();
             
-            // Add to group
-            getParentObject().addGraph(graph);
+            SwingUtilities.invokeLater(new Runnable(){
+
+                @Override
+                public void run() {
+                    // Add to group
+                    parent.addElement(graph);
+                }
+            });
         }
     };
     // <nodes>
-    private HandoverElementHandler<InputGraph> nodesHandler = new HandoverElementHandler<InputGraph>(NODES_ELEMENT);
+    private HandoverElementHandler<InputGraph> nodesHandler = new HandoverElementHandler<>(NODES_ELEMENT);
     // <controlFlow>
-    private HandoverElementHandler<InputGraph> controlFlowHandler = new HandoverElementHandler<InputGraph>(CONTROL_FLOW_ELEMENT);
+    private HandoverElementHandler<InputGraph> controlFlowHandler = new HandoverElementHandler<>(CONTROL_FLOW_ELEMENT);
     // <block>
     private ElementHandler<InputBlock, InputGraph> blockHandler = new ElementHandler<InputBlock, InputGraph>(BLOCK_ELEMENT) {
 
@@ -302,7 +300,7 @@
         }
     };
     // <nodes>
-    private HandoverElementHandler<InputBlock> blockNodesHandler = new HandoverElementHandler<InputBlock>(NODES_ELEMENT);
+    private HandoverElementHandler<InputBlock> blockNodesHandler = new HandoverElementHandler<>(NODES_ELEMENT);
     // <node>
     private ElementHandler<InputBlock, InputBlock> blockNodeHandler = new ElementHandler<InputBlock, InputBlock>(NODE_ELEMENT) {
 
@@ -321,14 +319,14 @@
         }
     };
     // <successors>
-    private HandoverElementHandler<InputBlock> successorsHandler = new HandoverElementHandler<InputBlock>(SUCCESSORS_ELEMENT);
+    private HandoverElementHandler<InputBlock> successorsHandler = new HandoverElementHandler<>(SUCCESSORS_ELEMENT);
     // <successor>
     private ElementHandler<InputBlock, InputBlock> successorHandler = new ElementHandler<InputBlock, InputBlock>(SUCCESSOR_ELEMENT) {
 
         @Override
         protected InputBlock start() throws SAXException {
             String name = readRequiredAttribute(BLOCK_NAME_PROPERTY);
-            blockConnections.add(new Pair<String, String>(getParentObject().getName(), name));
+            blockConnections.add(new Pair<>(getParentObject().getName(), name));
             return getParentObject();
         }
     };
@@ -365,7 +363,7 @@
         }
     };
     // <graph>
-    private HandoverElementHandler<InputGraph> edgesHandler = new HandoverElementHandler<InputGraph>(EDGES_ELEMENT);
+    private HandoverElementHandler<InputGraph> edgesHandler = new HandoverElementHandler<>(EDGES_ELEMENT);
 
     // Local class for edge elements
     private class EdgeElementHandler extends ElementHandler<InputEdge, InputGraph> {
@@ -431,14 +429,20 @@
         }
     };
     // <properties>
-    private HandoverElementHandler<Properties.Provider> propertiesHandler = new HandoverElementHandler<Properties.Provider>(PROPERTIES_ELEMENT);
+    private HandoverElementHandler<Properties.Provider> propertiesHandler = new HandoverElementHandler<>(PROPERTIES_ELEMENT);
     // <properties>
     private HandoverElementHandler<Group> groupPropertiesHandler = new HandoverElementHandler<Group>(PROPERTIES_ELEMENT) {
 
         @Override
         public void end(String text) throws SAXException {
-            if (groupCallback != null) {
-                groupCallback.started(getParentObject());
+            if (groupCallback != null && getParentObject().getParent() instanceof GraphDocument) {
+                final Group group = getParentObject();
+                SwingUtilities.invokeLater(new Runnable() {
+                    @Override
+                    public void run() {
+                        groupCallback.started(group);
+                    }
+                });
             }
         }
     };
@@ -469,8 +473,8 @@
         topHandler.addChild(groupHandler);
 
         groupHandler.addChild(methodHandler);
-        groupHandler.addChild(assemblyHandler);
         groupHandler.addChild(graphHandler);
+        groupHandler.addChild(groupHandler);
 
         methodHandler.addChild(inlinedHandler);
         methodHandler.addChild(bytecodesHandler);
@@ -506,7 +510,7 @@
     }
 
     // Returns a new GraphDocument object deserialized from an XML input source.
-    public synchronized GraphDocument parse(InputSource source, XMLParser.ParseMonitor monitor) throws SAXException {
+    public GraphDocument parse(InputSource source, XMLParser.ParseMonitor monitor) throws SAXException {
         XMLReader reader = createReader();
 
         reader.setContentHandler(new XMLParser(xmlDocument, monitor));
@@ -516,7 +520,7 @@
             throw new SAXException(ex);
         }
 
-        return topHandler.getObject();
+        return graphDocument;
     }
 
     private XMLReader createReader() throws SAXException {
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Printer.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Printer.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,16 +23,7 @@
  */
 package com.sun.hotspot.igv.data.serialization;
 
-import com.sun.hotspot.igv.data.GraphDocument;
-import com.sun.hotspot.igv.data.Group;
-import com.sun.hotspot.igv.data.InputBlock;
-import com.sun.hotspot.igv.data.InputBytecode;
-import com.sun.hotspot.igv.data.InputEdge;
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.data.InputMethod;
-import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.data.Properties;
-import com.sun.hotspot.igv.data.Property;
+import com.sun.hotspot.igv.data.*;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Writer;
@@ -68,8 +59,12 @@
     private void export(XMLWriter xmlWriter, GraphDocument document) throws IOException {
         xmlWriter.startTag(Parser.ROOT_ELEMENT);
         xmlWriter.writeProperties(document.getProperties());
-        for (Group g : document.getGroups()) {
-            export(xmlWriter, g);
+        for (FolderElement e : document.getElements()) {
+            if (e instanceof Group) {
+                export(xmlWriter, (Group) e);
+            } else if (e instanceof InputGraph) {
+                export(xmlWriter, (InputGraph)e, null, false);
+            }
         }
 
         xmlWriter.endTag();
@@ -96,9 +91,14 @@
             }
 
             InputGraph previous = null;
-            for (InputGraph graph : g.getGraphs()) {
-                export(writer, graph, previous, true);
-                previous = graph;
+            for (FolderElement e : g.getElements()) {
+                if (e instanceof InputGraph) {
+                    InputGraph graph = (InputGraph) e;
+                    export(writer, graph, previous, true);
+                    previous = graph;
+                } else if (e instanceof Group) {
+                    export(writer, (Group) e);
+                }
             }
         }
 
@@ -111,8 +111,8 @@
         writer.writeProperties(graph.getProperties());
         writer.startTag(Parser.NODES_ELEMENT);
 
-        Set<InputNode> removed = new HashSet<InputNode>();
-        Set<InputNode> equal = new HashSet<InputNode>();
+        Set<InputNode> removed = new HashSet<>();
+        Set<InputNode> equal = new HashSet<>();
 
         if (previous != null) {
             for (InputNode n : previous.getNodes()) {
@@ -143,8 +143,8 @@
         writer.endTag();
 
         writer.startTag(Parser.EDGES_ELEMENT);
-        Set<InputEdge> removedEdges = new HashSet<InputEdge>();
-        Set<InputEdge> equalEdges = new HashSet<InputEdge>();
+        Set<InputEdge> removedEdges = new HashSet<>();
+        Set<InputEdge> equalEdges = new HashSet<>();
 
         if (previous != null) {
             for (InputEdge e : previous.getEdges()) {
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLParser.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLParser.java	Thu Feb 02 16:07:52 2012 -0800
@@ -84,24 +84,25 @@
     public static class ElementHandler<T, P> {
 
         private String name;
-        private T object;
+        private Stack<T> object = new Stack<>();
         private Attributes attr;
         private StringBuilder currentText;
         private ParseMonitor monitor;
         private HashMap<String, ElementHandler<?, ? super T>> hashtable;
         private boolean needsText;
-        private ElementHandler<P, ?> parentElement;
+        private Stack<ElementHandler<P, ?>> parentElement = new Stack<>();
+        private Stack<P> parentObject = new Stack<>();
 
         public ElementHandler(String name) {
             this(name, false);
         }
 
         public ElementHandler<P, ?> getParentElement() {
-            return parentElement;
+            return parentElement.peek();
         }
 
         public P getParentObject() {
-            return getParentElement().getObject();
+            return parentObject.peek();
         }
 
         protected boolean needsText() {
@@ -109,7 +110,7 @@
         }
 
         public ElementHandler(String name, boolean needsText) {
-            this.hashtable = new HashMap<String, ElementHandler<?, ? super T>>();
+            this.hashtable = new HashMap<>();
             this.name = name;
             this.needsText = needsText;
         }
@@ -132,7 +133,7 @@
         }
 
         public T getObject() {
-            return object;
+            return object.size() == 0 ? null : object.peek();
         }
 
         public String readAttribute(String name) {
@@ -160,8 +161,9 @@
             this.currentText = new StringBuilder();
             this.attr = attr;
             this.monitor = monitor;
-            this.parentElement = parentElement;
-            object = start();
+            this.parentElement.push(parentElement);
+            parentObject.push(parentElement.getObject());
+            object.push(start());
         }
 
         protected T start() throws SAXException {
@@ -174,6 +176,9 @@
 
         public void endElement() throws SAXException {
             end(currentText.toString());
+            object.pop();
+            parentElement.pop();
+            parentObject.pop();
         }
 
         protected void text(char[] c, int start, int length) {
@@ -185,30 +190,36 @@
     private ParseMonitor monitor;
 
     public XMLParser(TopElementHandler rootHandler, ParseMonitor monitor) {
-        this.stack = new Stack<ElementHandler>();
+        this.stack = new Stack<>();
         this.monitor = monitor;
         this.stack.push(rootHandler);
     }
 
+    @Override
     public void setDocumentLocator(Locator locator) {
         if (monitor != null) {
             monitor.setState("Starting parsing");
         }
     }
 
+    @Override
     public void startDocument() throws SAXException {
     }
 
+    @Override
     public void endDocument() throws SAXException {
     }
 
+    @Override
     public void startPrefixMapping(String prefix, String uri) throws SAXException {
     }
 
+    @Override
     public void endPrefixMapping(String prefix) throws SAXException {
     }
 
     @SuppressWarnings("unchecked")
+    @Override
     public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
         assert !stack.isEmpty();
 
@@ -225,6 +236,7 @@
         stack.push(null);
     }
 
+    @Override
     public void endElement(String uri, String localName, String qName) throws SAXException {
         ElementHandler handler = stack.pop();
         if (handler != null) {
@@ -232,6 +244,7 @@
         }
     }
 
+    @Override
     public void characters(char[] ch, int start, int length) throws SAXException {
 
         assert !stack.isEmpty();
@@ -243,12 +256,15 @@
         }
     }
 
+    @Override
     public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
     }
 
+    @Override
     public void processingInstruction(String target, String data) throws SAXException {
     }
 
+    @Override
     public void skippedEntity(String name) throws SAXException {
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -41,7 +41,7 @@
 
     public XMLWriter(Writer inner) {
         this.inner = inner;
-        elementStack = new Stack<String>();
+        elementStack = new Stack<>();
     }
 
     @Override
@@ -49,6 +49,7 @@
         write(arr, 0, arr.length);
     }
 
+    @Override
     public void write(char[] cbuf, int off, int len) throws IOException {
         for (int i = off; i < off + len; i++) {
             char c = cbuf[i];
@@ -64,10 +65,12 @@
         }
     }
 
+    @Override
     public void flush() throws IOException {
         inner.flush();
     }
 
+    @Override
     public void close() throws IOException {
         inner.close();
     }
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/services/GroupOrganizer.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.data.services;
-
-import com.sun.hotspot.igv.data.Group;
-import com.sun.hotspot.igv.data.Pair;
-import java.util.List;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public interface GroupOrganizer {
-
-    public String getName();
-
-    public List<Pair<String, List<Group>>> organize(List<String> subFolders, List<Group> groups);
-}
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/services/GroupReceiver.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.data.services;
-
-import java.awt.Component;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public interface GroupReceiver {
-
-    public Component init(GroupCallback callback);
-}
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/ChangedEventTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/ChangedEventTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,12 +24,8 @@
 
 package com.sun.hotspot.igv.data;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import org.junit.*;
 
 /**
  *
@@ -62,10 +58,11 @@
     @Test
     public void testBase() {
 
-        ChangedEvent<Integer> e = new ChangedEvent<Integer>(5);
+        ChangedEvent<Integer> e = new ChangedEvent<>(5);
         final int[] fireCount = new int[1];
 
         e.addListener(new ChangedListener<Integer>() {
+            @Override
             public void changed(Integer s) {
                 assertEquals(s.intValue(), 5);
                 fireCount[0]++;
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/ControllableChangedListenerTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/ControllableChangedListenerTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,12 +24,8 @@
 
 package com.sun.hotspot.igv.data;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
 import static org.junit.Assert.*;
+import org.junit.*;
 
 /**
  *
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/GroupTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/GroupTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -26,12 +26,8 @@
 
 import java.util.Arrays;
 import java.util.HashSet;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import org.junit.*;
 
 /**
  *
@@ -64,9 +60,11 @@
      */
     @Test
     public void testGetAllNodes() {
-        final Group g = new Group();
-        final InputGraph graph1 = g.addGraph("1");
-        final InputGraph graph2 = g.addGraph("2");
+        final Group g = new Group(null);
+        final InputGraph graph1 = new InputGraph("1");
+        final InputGraph graph2 = new InputGraph("2");
+        g.addElement(graph1);
+        g.addElement(graph2);
         graph1.addNode(new InputNode(1));
         graph1.addNode(new InputNode(2));
         graph2.addNode(new InputNode(2));
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/InputGraphTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/InputGraphTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -27,12 +27,9 @@
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import org.junit.*;
 
 /**
  *
@@ -68,11 +65,13 @@
 
     @BeforeClass
     public static void setUpClass() throws Exception {
-        Group group = new Group();
+        Group group = new Group(null);
 
-        emptyGraph = group.addGraph("emptyGraph");
-
-        referenceGraph = group.addGraph("referenceGraph");
+        emptyGraph = new InputGraph("emptyGraph");
+        group.addElement(emptyGraph);
+        
+        referenceGraph = new InputGraph("referenceGraph");
+        group.addElement(referenceGraph);
         referenceGraph.addNode(N1);
         referenceGraph.addNode(N2);
         referenceGraph.addNode(N3);
@@ -104,13 +103,16 @@
     @Test
     public void testEquals() {
 
-        Group parentA = new Group();
-        InputGraph a = parentA.addGraph("graph");
+        Group parentA = new Group(null);
+        InputGraph a = new InputGraph("graph");
+        parentA.addElement(a);
 
-        Group parentB = new Group();
-        InputGraph b = parentB.addGraph("graph");
+        Group parentB = new Group(null);
+        InputGraph b = new InputGraph("graph");
+        parentB.addElement(b);
 
-        InputGraph c = parentB.addGraph("graph");
+        InputGraph c = new InputGraph("graph");
+        parentB.addElement(b);
 
         Util.assertGraphEquals(a, b);
         Util.assertGraphEquals(b, c);
@@ -127,7 +129,7 @@
      */
     @Test
     public void testFindRootNodes() {
-        assertTrue(emptyGraph.findRootNodes().size() == 0);
+        assertTrue(emptyGraph.findRootNodes().isEmpty());
 
         List<InputNode> result = referenceGraph.findRootNodes();
         assertTrue(result.size() == 2);
@@ -140,7 +142,7 @@
      */
     @Test
     public void testFindAllOutgoingEdges() {
-        assertTrue(emptyGraph.findAllOutgoingEdges().size() == 0);
+        assertTrue(emptyGraph.findAllOutgoingEdges().isEmpty());
 
         Map<InputNode, List<InputEdge>> result = referenceGraph.findAllOutgoingEdges();
         assertTrue(result.size() == 5);
@@ -156,7 +158,7 @@
      */
     @Test
     public void testFindAllIngoingEdges() {
-        assertTrue(emptyGraph.findAllIngoingEdges().size() == 0);
+        assertTrue(emptyGraph.findAllIngoingEdges().isEmpty());
 
         Map<InputNode, List<InputEdge>> result = referenceGraph.findAllIngoingEdges();
         assertTrue(result.size() == 5);
@@ -172,7 +174,7 @@
      */
     @Test
     public void testFindOutgoingEdges() {
-        assertTrue(emptyGraph.findOutgoingEdges(new InputNode(1)).size() == 0);
+        assertTrue(emptyGraph.findOutgoingEdges(new InputNode(1)).isEmpty());
 
         assertEquals(referenceGraph.findOutgoingEdges(N1), Arrays.asList(E12, E13));
         assertEquals(referenceGraph.findOutgoingEdges(N2), Arrays.asList(E24));
@@ -186,13 +188,16 @@
      */
     @Test
     public void testGetNextPrev() {
-        final Group group = new Group();
+        final Group group = new Group(null);
 
-        final InputGraph a = group.addGraph("a");
+        final InputGraph a = new InputGraph("a");
 
-        final InputGraph b = group.addGraph("b");
+        final InputGraph b = new InputGraph("b");
 
-        final InputGraph c = group.addGraph("c");
+        final InputGraph c = new InputGraph("c");
+        group.addElement(a);
+        group.addElement(b);
+        group.addElement(c);
 
         assertEquals(null, a.getPrev());
         assertEquals(b, a.getNext());
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/InputMethodTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/InputMethodTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,13 +24,10 @@
 
 package com.sun.hotspot.igv.data;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+import org.junit.*;
 
 /**
  *
@@ -72,7 +69,7 @@
                              "7 iconst_0\n" +
                              "8 ireturn";
 
-        final Group g = new Group();
+        final Group g = new Group(null);
         InputMethod m = new InputMethod(g, "name", "shortName", -1);
         m.setBytecodes(input);
 
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/PairTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/PairTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,12 +25,8 @@
 
 package com.sun.hotspot.igv.data;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
 import static org.junit.Assert.*;
+import org.junit.*;
 
 /**
  *
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/PropertiesTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/PropertiesTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -106,12 +106,14 @@
         
         PropertyMatcher matcher = new PropertyMatcher() {
 
+            @Override
             public String getName() {
                 assertFalse(called[0]);
                 called[0] = true;
                 return n;
             }
 
+            @Override
             public boolean match(String value) {
                 assertTrue(v.equals(value));
                 return true;
@@ -129,12 +131,14 @@
         called[0] = false;
         PropertyMatcher matcher2 = new PropertyMatcher() {
 
+            @Override
             public String getName() {
                 assertFalse(called[0]);
                 called[0] = true;
                 return n;
             }
 
+            @Override
             public boolean match(String value) {
                 return false;
             }
@@ -246,7 +250,7 @@
      * Test property selector
      */
     public void testPropertySelector() {
-        final Collection<Properties.Entity> c = new ArrayList<Properties.Entity>();
+        final Collection<Properties.Entity> c = new ArrayList<>();
 
         final Properties.Entity e1 = new Properties.Entity();
         e1.getProperties().setProperty("p1", "1");
@@ -264,7 +268,7 @@
         e3.getProperties().setProperty("p4", "4");
         c.add(e3);
 
-        final PropertySelector<Properties.Entity> sel = new PropertySelector<Properties.Entity>(c);
+        final PropertySelector<Properties.Entity> sel = new PropertySelector<>(c);
 
         final StringPropertyMatcher matcher1 = new StringPropertyMatcher("p2", "2");
         assertTrue(sel.selectMultiple(matcher1).size() == 2);
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/PropertyTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/PropertyTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,12 +25,8 @@
 
 package com.sun.hotspot.igv.data;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
 import static org.junit.Assert.*;
+import org.junit.*;
 
 /**
  *
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/SourceTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/SourceTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,19 +24,10 @@
 
 package com.sun.hotspot.igv.data;
 
-import java.lang.Integer;
 import java.util.Arrays;
-import java.util.HashSet;
 import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.*;
-import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertEquals;
+import org.junit.*;
 
 /**
  *
@@ -75,14 +66,14 @@
 
         s.addSourceNode(N1);
         assertEquals(s.getSourceNodes(), Arrays.asList(N1));
-        assertEquals(s.getSourceNodesAsSet(), new LinkedHashSet<Integer>(Arrays.asList(1)));
+        assertEquals(s.getSourceNodesAsSet(), new LinkedHashSet<>(Arrays.asList(1)));
 
         s.addSourceNode(N2);
         assertEquals(s.getSourceNodes(), Arrays.asList(N1, N2));
-        assertEquals(s.getSourceNodesAsSet(), new LinkedHashSet<Integer>(Arrays.asList(1, 2)));
+        assertEquals(s.getSourceNodesAsSet(), new LinkedHashSet<>(Arrays.asList(1, 2)));
 
         s.addSourceNode(N1);
         assertEquals(s.getSourceNodes(), Arrays.asList(N1, N2));
-        assertEquals(s.getSourceNodesAsSet(), new LinkedHashSet<Integer>(Arrays.asList(1, 2)));
+        assertEquals(s.getSourceNodesAsSet(), new LinkedHashSet<>(Arrays.asList(1, 2)));
     }
 }
\ No newline at end of file
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/Util.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/Util.java	Thu Feb 02 16:07:52 2012 -0800
@@ -45,16 +45,19 @@
 
     public static void assertGraphDocumentEquals(GraphDocument a, GraphDocument b) {
 
-        if (a.getGroups().size() != b.getGroups().size()) {
+        if (a.getElements().size() != b.getElements().size()) {
             fail();
         }
 
         int z = 0;
-        for (Group g : b.getGroups()) {
+        for (FolderElement e : b.getElements()) {
 
-            Group thisG = a.getGroups().get(z);
-            assertGroupEquals(thisG, g);
+            if (e instanceof Group) {
+                Group g = (Group) e;
+                Group thisG = (Group) a.getElements().get(z);
+                assertGroupEquals(thisG, g);
             z++;
+            }
         }
     }
 
@@ -90,16 +93,6 @@
                 fail();
             }
         }
-
-        if (a.getAssembly() == null || b.getAssembly() == null) {
-            if (a.getAssembly() != b.getAssembly()) {
-                fail();
-            }
-        } else {
-            if (!a.getAssembly().equals(b.getAssembly())) {
-                fail();
-            }
-        }
     }
 
     public static void assertGraphNotEquals(InputGraph a, InputGraph b) {
@@ -129,7 +122,5 @@
         for (InputNode n : a.getNodes()) {
             assertEquals(a.getBlock(n), b.getBlock(n));
         }
-
-        assertEquals(a.getSourceGraphs(), b.getSourceGraphs());
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/serialization/ParserTest.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/serialization/ParserTest.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,22 +25,12 @@
 
 package com.sun.hotspot.igv.data.serialization;
 
-import com.sun.hotspot.igv.data.GraphDocument;
-import com.sun.hotspot.igv.data.Group;
-import com.sun.hotspot.igv.data.InputBlock;
-import com.sun.hotspot.igv.data.InputEdge;
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.data.InputMethod;
-import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.data.Util;
+import com.sun.hotspot.igv.data.*;
 import java.io.CharArrayWriter;
 import java.io.StringReader;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import org.junit.*;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
@@ -104,15 +94,16 @@
 
         test(doc);
 
-        final Group group1 = new Group();
-        doc.addGroup(group1);
+        final Group group1 = new Group(doc);
+        doc.addElement(group1);
         test(doc);
 
-        final Group group2 = new Group();
-        doc.addGroup(group2);
+        final Group group2 = new Group(doc);
+        doc.addElement(group2);
         test(doc);
 
-        final InputGraph graph = group1.addGraph("");
+        final InputGraph graph = new InputGraph("");
+        group1.addElement(graph);
         test(doc);
 
         graph.addNode(new InputNode(0));
@@ -154,13 +145,13 @@
         final GraphDocument document2 = new GraphDocument();
         doc.addGraphDocument(document2);
         test(doc);
-        assertTrue(doc.getGroups().size() == 2);
+        assertTrue(doc.getElements().size() == 2);
 
-        final Group group3 = new Group();
-        document2.addGroup(group3);
+        final Group group3 = new Group(document2);
+        document2.addElement(group3);
         doc.addGraphDocument(document2);
-        assertTrue(doc.getGroups().size() == 3);
-        assertTrue(document2.getGroups().size() == 0);
+        assertTrue(doc.getElements().size() == 3);
+        assertTrue(document2.getElements().size() == 0);
 
         doc.clear();
         test(doc);
@@ -170,10 +161,11 @@
 	@Test
 	public void testSimpleExport() {
 		GraphDocument document = new GraphDocument();
-		Group g = new Group();
-		document.addGroup(g);
+		Group g = new Group(document);
+		document.addElement(g);
         
-		InputGraph graph = g.addGraph("TestGraph");
+		InputGraph graph = new InputGraph("TestGraph");
+                g.addElement(graph);
 		graph.getProperties().setProperty("testName", "testValue");
 
 		InputNode n1 = new InputNode(0);
@@ -192,10 +184,11 @@
 	public void testComplexExport() {
 
 		GraphDocument document = new GraphDocument();
-		Group g = new Group();
-		document.addGroup(g);
+		Group g = new Group(document);
+		document.addElement(g);
 
-		InputGraph graph = g.addGraph("TestGraph");
+		InputGraph graph = new InputGraph("TestGraph");
+                g.addElement(graph);
 		graph.getProperties().setProperty("testName", "testValue");
 
 		InputNode n1 = new InputNode(0);
@@ -207,7 +200,8 @@
 		graph.addEdge(e1);
 		graph.addEdge(e2);
 
-		InputGraph graph2 = g.addGraph("TestGraph2");
+		InputGraph graph2 = new InputGraph("TestGraph2");
+                g.addElement(graph2);
 		graph2.addNode(n1);
 		InputNode n3 = new InputNode(2);
 		graph2.addNode(n3);
--- a/src/share/tools/IdealGraphVisualizer/Difference/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Difference/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,21 +24,10 @@
  */
 package com.sun.hotspot.igv.difference;
 
-import com.sun.hotspot.igv.data.Group;
-import com.sun.hotspot.igv.data.InputBlock;
-import com.sun.hotspot.igv.data.InputBlockEdge;
-import com.sun.hotspot.igv.data.InputEdge;
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.data.Pair;
 import com.sun.hotspot.igv.data.Properties;
-import com.sun.hotspot.igv.data.Property;
+import com.sun.hotspot.igv.data.*;
 import com.sun.hotspot.igv.data.services.Scheduler;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import org.openide.util.Lookup;
 
 /**
@@ -66,14 +55,14 @@
     }
 
     private static InputGraph createDiffSameGroup(InputGraph a, InputGraph b) {
-        Map<Integer, InputNode> keyMapB = new HashMap<Integer, InputNode>(b.getNodes().size());
+        Map<Integer, InputNode> keyMapB = new HashMap<>(b.getNodes().size());
         for (InputNode n : b.getNodes()) {
             Integer key = n.getId();
             assert !keyMapB.containsKey(key);
             keyMapB.put(key, n);
         }
 
-        Set<NodePair> pairs = new HashSet<NodePair>();
+        Set<NodePair> pairs = new HashSet<>();
 
         for (InputNode n : a.getNodes()) {
             Integer key = n.getId();
@@ -101,9 +90,8 @@
         ensureScheduled(a);
         ensureScheduled(b);
 
-        Group g = new Group();
+        Group g = new Group(null);
         g.setMethod(a.getGroup().getMethod());
-        g.setAssembly(a.getGroup().getAssembly());
         if (a.getGroup() == b.getGroup()) {
             g.getProperties().add(a.getGroup().getProperties());
         } else {
@@ -117,9 +105,10 @@
             }
         }
         g.getProperties().setProperty("name", "Difference");
-        InputGraph graph = g.addGraph(a.getName() + ", " + b.getName(), new Pair<InputGraph, InputGraph>(a, b));
+        InputGraph graph = new InputGraph(a.getName() + ", " + b.getName());
+        g.addElement(graph);
 
-        Map<InputBlock, InputBlock> blocksMap = new HashMap<InputBlock, InputBlock>();
+        Map<InputBlock, InputBlock> blocksMap = new HashMap<>();
         for (InputBlock blk : a.getBlocks()) {
             InputBlock diffblk = graph.addBlock(blk.getName());
             blocksMap.put(blk, diffblk);
@@ -133,14 +122,14 @@
         }
 
         // Difference between block edges
-        Set<Pair<String, String>> aEdges = new HashSet<Pair<String, String>>();
+        Set<Pair<String, String>> aEdges = new HashSet<>();
         for (InputBlockEdge edge : a.getBlockEdges()) {
-            aEdges.add(new Pair<String, String>(edge.getFrom().getName(), edge.getTo().getName()));
+            aEdges.add(new Pair<>(edge.getFrom().getName(), edge.getTo().getName()));
         }
         for (InputBlockEdge bEdge : b.getBlockEdges()) {
             InputBlock from = bEdge.getFrom();
             InputBlock to = bEdge.getTo();
-            Pair<String, String> pair = new Pair<String, String>(from.getName(), to.getName());
+            Pair<String, String> pair = new Pair<>(from.getName(), to.getName());
             if (aEdges.contains(pair)) {
                 // same
                 graph.addBlockEdge(blocksMap.get(from), blocksMap.get(to));
@@ -159,10 +148,10 @@
             edge.setState(InputBlockEdge.State.DELETED);
         }
 
-        Set<InputNode> nodesA = new HashSet<InputNode>(a.getNodes());
-        Set<InputNode> nodesB = new HashSet<InputNode>(b.getNodes());
+        Set<InputNode> nodesA = new HashSet<>(a.getNodes());
+        Set<InputNode> nodesB = new HashSet<>(b.getNodes());
 
-        Map<InputNode, InputNode> inputNodeMap = new HashMap<InputNode, InputNode>(pairs.size());
+        Map<InputNode, InputNode> inputNodeMap = new HashMap<>(pairs.size());
         for (NodePair p : pairs) {
             InputNode n = p.getLeft();
             assert nodesA.contains(n);
@@ -209,7 +198,7 @@
         Collection<InputEdge> edgesA = a.getEdges();
         Collection<InputEdge> edgesB = b.getEdges();
 
-        Set<InputEdge> newEdges = new HashSet<InputEdge>();
+        Set<InputEdge> newEdges = new HashSet<>();
 
         for (InputEdge e : edgesA) {
             int from = e.getFrom();
@@ -291,9 +280,9 @@
 
     private static InputGraph createDiff(InputGraph a, InputGraph b) {
 
-        Set<InputNode> matched = new HashSet<InputNode>();
+        Set<InputNode> matched = new HashSet<>();
 
-        Set<NodePair> pairs = new HashSet<NodePair>();
+        Set<NodePair> pairs = new HashSet<>();
         for (InputNode n : a.getNodes()) {
             String s = n.getProperties().get(MAIN_PROPERTY);
             if (s == null) {
@@ -312,7 +301,7 @@
             }
         }
 
-        Set<NodePair> selectedPairs = new HashSet<NodePair>();
+        Set<NodePair> selectedPairs = new HashSet<>();
         while (pairs.size() > 0) {
 
             double min = Double.MAX_VALUE;
@@ -330,7 +319,7 @@
             } else {
                 selectedPairs.add(minPair);
 
-                Set<NodePair> toRemove = new HashSet<NodePair>();
+                Set<NodePair> toRemove = new HashSet<>();
                 for (NodePair p : pairs) {
                     if (p.getLeft() == minPair.getLeft() || p.getRight() == minPair.getRight()) {
                         toRemove.add(p);
--- a/src/share/tools/IdealGraphVisualizer/Filter/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/AbstractFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/AbstractFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -42,14 +42,17 @@
         properties = new Properties();
     }
 
+    @Override
     public Properties getProperties() {
         return properties;
     }
 
+    @Override
     public OpenCookie getEditor() {
         return null;
     }
 
+    @Override
     public ChangedEvent<Filter> getChangedEvent() {
         return changedEvent;
     }
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ColorFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ColorFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,13 +23,9 @@
  */
 package com.sun.hotspot.igv.filter;
 
-import com.sun.hotspot.igv.graph.Connection;
+import com.sun.hotspot.igv.data.Properties;
 import com.sun.hotspot.igv.graph.Connection.ConnectionStyle;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.graph.OutputSlot;
-import com.sun.hotspot.igv.graph.Selector;
-import com.sun.hotspot.igv.data.Properties;
+import com.sun.hotspot.igv.graph.*;
 import java.awt.Color;
 import java.util.ArrayList;
 import java.util.List;
@@ -45,16 +41,18 @@
 
     public ColorFilter(String name) {
         this.name = name;
-        colorRules = new ArrayList<ColorRule>();
+        colorRules = new ArrayList<>();
     }
 
+    @Override
     public String getName() {
         return name;
     }
 
+    @Override
     public void apply(Diagram diagram) {
 
-        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<Figure>(diagram.getFigures());
+        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<>(diagram.getFigures());
         for (ColorRule rule : colorRules) {
             if (rule.getSelector() != null) {
                 List<Figure> figures = rule.getSelector().selected(diagram);
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CombineFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CombineFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,13 +23,9 @@
  */
 package com.sun.hotspot.igv.filter;
 
-import com.sun.hotspot.igv.graph.Connection;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.graph.InputSlot;
-import com.sun.hotspot.igv.graph.OutputSlot;
 import com.sun.hotspot.igv.data.Properties;
 import com.sun.hotspot.igv.data.Properties.PropertyMatcher;
+import com.sun.hotspot.igv.graph.*;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -46,23 +42,25 @@
 
     public CombineFilter(String name) {
         this.name = name;
-        rules = new ArrayList<CombineRule>();
+        rules = new ArrayList<>();
     }
 
+    @Override
     public String getName() {
         return name;
     }
 
+    @Override
     public void apply(Diagram diagram) {
 
-        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<Figure>(diagram.getFigures());
+        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<>(diagram.getFigures());
         for (CombineRule r : rules) {
 
             List<Figure> list = selector.selectMultiple(r.getFirstMatcher());
-            Set<Figure> figuresToRemove = new HashSet<Figure>();
+            Set<Figure> figuresToRemove = new HashSet<>();
             for (Figure f : list) {
 
-                List<Figure> successors = new ArrayList<Figure>(f.getSuccessors());
+                List<Figure> successors = new ArrayList<>(f.getSuccessors());
                 if (r.isReversed()) {
                     if (successors.size() == 1) {
                         Figure succ = successors.get(0);
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ConnectionFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ConnectionFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,12 +23,8 @@
  */
 package com.sun.hotspot.igv.filter;
 
-import com.sun.hotspot.igv.graph.Connection;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.graph.OutputSlot;
-import com.sun.hotspot.igv.graph.Selector;
 import com.sun.hotspot.igv.data.Properties;
+import com.sun.hotspot.igv.graph.*;
 import java.awt.Color;
 import java.util.ArrayList;
 import java.util.List;
@@ -44,16 +40,18 @@
 
     public ConnectionFilter(String name) {
         this.name = name;
-        connectionStyleRules = new ArrayList<ConnectionStyleRule>();
+        connectionStyleRules = new ArrayList<>();
     }
 
+    @Override
     public String getName() {
         return name;
     }
 
+    @Override
     public void apply(Diagram diagram) {
 
-        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<Figure>(diagram.getFigures());
+        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<>(diagram.getFigures());
         for (ConnectionStyleRule rule : connectionStyleRules) {
             List<Figure> figures = null;
             if (rule.getSelector() != null) {
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -29,18 +29,13 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.util.Collection;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import org.openide.DialogDisplayer;
-import org.openide.NotifyDescriptor;
+import javax.script.*;
 import org.openide.cookies.OpenCookie;
-import org.openide.filesystems.Repository;
-import org.openide.filesystems.FileSystem;
 import org.openide.filesystems.FileObject;
 import org.openide.filesystems.FileUtil;
 import org.openide.util.Exceptions;
-import org.openide.util.Lookup;
 
 /**
  *
@@ -49,7 +44,6 @@
 public class CustomFilter extends AbstractFilter {
 
     public static final String JAVASCRIPT_HELPER_ID = "JavaScriptHelper";
-    private static ScriptEngineAbstraction engine;
     private String code;
     private String name;
 
@@ -59,6 +53,7 @@
         getProperties().setProperty("name", name);
     }
 
+    @Override
     public String getName() {
         return name;
     }
@@ -81,6 +76,7 @@
     public OpenCookie getEditor() {
         return new OpenCookie() {
 
+            @Override
             public void open() {
                 openInEditor();
             }
@@ -100,29 +96,6 @@
         return getName();
     }
 
-    public static ScriptEngineAbstraction getEngine() {
-        if (engine == null) {
-
-            Collection<? extends ScriptEngineAbstraction> list = Lookup.getDefault().lookupAll(ScriptEngineAbstraction.class);
-            ScriptEngineAbstraction chosen = null;
-            for (ScriptEngineAbstraction s : list) {
-                if (s.initialize(getJsHelperText())) {
-                    chosen = s;
-                }
-            }
-
-            if (chosen == null) {
-                NotifyDescriptor message = new NotifyDescriptor.Message("Could not find a scripting engine. Please make sure that the Rhino scripting engine is available. Otherwise filter cannot be used.", NotifyDescriptor.ERROR_MESSAGE);
-                DialogDisplayer.getDefault().notifyLater(message);
-                chosen = new NullScriptEngine();
-            }
-
-            engine = chosen;
-        }
-
-        return engine;
-    }
-
     private static String getJsHelperText() {
         InputStream is = null;
         StringBuilder sb = new StringBuilder("importPackage(Packages.com.sun.hotspot.igv.filter);importPackage(Packages.com.sun.hotspot.igv.graph);importPackage(Packages.com.sun.hotspot.igv.data);importPackage(Packages.com.sun.hotspot.igv.util);importPackage(java.awt);");
@@ -148,7 +121,18 @@
         return sb.toString();
     }
 
+    @Override
     public void apply(Diagram d) {
-        getEngine().execute(d, code);
+        try {
+            ScriptEngineManager sem = new ScriptEngineManager();
+            ScriptEngine e = sem.getEngineByName("ECMAScript");
+            e.eval(getJsHelperText());
+            Bindings b = e.getContext().getBindings(ScriptContext.ENGINE_SCOPE);
+            b.put("graph", d);
+            b.put("IO", System.out);
+            e.eval(code, b);
+        } catch (ScriptException ex) {
+            Exceptions.printStackTrace(ex);
+        }
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/EdgeColorIndexFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/EdgeColorIndexFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,12 +23,7 @@
  */
 package com.sun.hotspot.igv.filter;
 
-import com.sun.hotspot.igv.graph.Connection;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.graph.InputSlot;
-import com.sun.hotspot.igv.graph.OutputSlot;
-import com.sun.hotspot.igv.graph.Slot;
+import com.sun.hotspot.igv.graph.*;
 import java.awt.Color;
 import java.util.List;
 
@@ -48,10 +43,12 @@
         this.colors = color;
     }
 
+    @Override
     public String getName() {
         return "Edge Color Index Filter";
     }
 
+    @Override
     public void apply(Diagram d) {
         List<Figure> figures = d.getFigures();
         for (Figure f : figures) {
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/Filter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/Filter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -41,5 +41,6 @@
 
     OpenCookie getEditor();
 
+    @Override
     ChangedEvent<Filter> getChangedEvent();
 }
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/FilterChain.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/FilterChain.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,10 +23,10 @@
  */
 package com.sun.hotspot.igv.filter;
 
-import com.sun.hotspot.igv.graph.Diagram;
 import com.sun.hotspot.igv.data.ChangedEvent;
 import com.sun.hotspot.igv.data.ChangedEventProvider;
 import com.sun.hotspot.igv.data.ChangedListener;
+import com.sun.hotspot.igv.graph.Diagram;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -41,21 +41,23 @@
     private transient ChangedEvent<FilterChain> changedEvent;
     
     private ChangedListener<Filter> changedListener = new ChangedListener<Filter>() {
+        @Override
         public void changed(Filter source) {
             changedEvent.fire();
         }
     };
 
     public FilterChain() {
-        filters = new ArrayList<Filter>();
-        changedEvent = new ChangedEvent<FilterChain>(this);
+        filters = new ArrayList<>();
+        changedEvent = new ChangedEvent<>(this);
     }
 
     public FilterChain(FilterChain f) {
-        this.filters = new ArrayList<Filter>(f.filters);
-        changedEvent = new ChangedEvent<FilterChain>(this);
+        this.filters = new ArrayList<>(f.filters);
+        changedEvent = new ChangedEvent<>(this);
     }
 
+    @Override
     public ChangedEvent<FilterChain> getChangedEvent() {
         return changedEvent;
     }
@@ -72,7 +74,7 @@
     }
 
     public void apply(Diagram d, FilterChain sequence) {
-        List<Filter> applied = new ArrayList<Filter>();
+        List<Filter> applied = new ArrayList<>();
         for (Filter f : sequence.getFilters()) {
             if (filters.contains(f)) {
                 f.apply(d);
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/FilterSetting.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/FilterSetting.java	Thu Feb 02 16:07:52 2012 -0800
@@ -42,7 +42,7 @@
 
     public FilterSetting(String name) {
         this.name = name;
-        filters = new HashSet<Filter>();
+        filters = new HashSet<>();
     }
 
     public Set<Filter> getFilters() {
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/GradientColorFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/GradientColorFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,11 +25,7 @@
 
 import com.sun.hotspot.igv.graph.Diagram;
 import com.sun.hotspot.igv.graph.Figure;
-import java.awt.Color;
-import java.awt.LinearGradientPaint;
-import java.awt.PaintContext;
-import java.awt.Rectangle;
-import java.awt.RenderingHints;
+import java.awt.*;
 import java.awt.geom.AffineTransform;
 import java.awt.image.Raster;
 import java.util.List;
@@ -53,10 +49,12 @@
     private int shadeCount = 8;
     private String mode = LINEAR;
 
+    @Override
     public String getName() {
         return "Gradient Color Filter";
     }
 
+    @Override
     public void apply(Diagram d) {
         boolean logarithmic = mode.equalsIgnoreCase(LOGARITHMIC);
         if (!logarithmic && !mode.equalsIgnoreCase(LINEAR)) {
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/NullScriptEngine.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.filter;
-
-import com.sun.hotspot.igv.graph.Diagram;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class NullScriptEngine implements ScriptEngineAbstraction {
-
-    public boolean initialize(String jsHelperText) {
-        return true;
-    }
-
-    public void execute(Diagram d, String code) {
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -42,17 +42,19 @@
 
     public RemoveFilter(String name) {
         this.name = name;
-        rules = new ArrayList<RemoveRule>();
+        rules = new ArrayList<>();
     }
 
+    @Override
     public String getName() {
         return name;
     }
 
+    @Override
     public void apply(Diagram diagram) {
         for (RemoveRule r : rules) {
             List<Figure> selected = r.getSelector().selected(diagram);
-            Set<Figure> toRemove = new HashSet<Figure>(selected);
+            Set<Figure> toRemove = new HashSet<>(selected);
 
             if (r.getRemoveOrphans()) {
                 boolean changed;
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveInputsFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveInputsFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,12 +23,7 @@
  */
 package com.sun.hotspot.igv.filter;
 
-import com.sun.hotspot.igv.graph.Connection;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.graph.InputSlot;
-import com.sun.hotspot.igv.graph.OutputSlot;
-import com.sun.hotspot.igv.graph.Selector;
+import com.sun.hotspot.igv.graph.*;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -43,13 +38,15 @@
 
     public RemoveInputsFilter(String name) {
         this.name = name;
-        rules = new ArrayList<RemoveInputsRule>();
+        rules = new ArrayList<>();
     }
 
+    @Override
     public String getName() {
         return name;
     }
 
+    @Override
     public void apply(Diagram diagram) {
 
         for (RemoveInputsRule r : rules) {
@@ -57,7 +54,7 @@
             List<Figure> list = r.getSelector().selected(diagram);
             for (Figure f : list) {
                 int z = 0;
-                List<InputSlot> last = new ArrayList<InputSlot>();
+                List<InputSlot> last = new ArrayList<>();
                 for (InputSlot is : f.getInputSlots()) {
                     if (z >= r.getStartingIndex() && z <= r.getEndIndex() && is.getConnections().size() > 0) {
                         StringBuilder sb = new StringBuilder();
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveSelfLoopsFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveSelfLoopsFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,11 +23,7 @@
  */
 package com.sun.hotspot.igv.filter;
 
-import com.sun.hotspot.igv.graph.Connection;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.graph.InputSlot;
-import com.sun.hotspot.igv.graph.OutputSlot;
+import com.sun.hotspot.igv.graph.*;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -44,17 +40,19 @@
         this.name = name;
     }
 
+    @Override
     public String getName() {
         return name;
     }
 
+    @Override
     public void apply(Diagram d) {
 
         for (Figure f : d.getFigures()) {
 
             for (InputSlot is : f.getInputSlots()) {
 
-                List<Connection> toRemove = new ArrayList<Connection>();
+                List<Connection> toRemove = new ArrayList<>();
                 for (Connection c : is.getConnections()) {
 
                     if (c.getOutputSlot().getFigure() == f) {
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ScriptEngineAbstraction.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.sun.hotspot.igv.filter;
-
-import com.sun.hotspot.igv.graph.Diagram;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public interface ScriptEngineAbstraction {
-
-    public boolean initialize(String jsHelperText);
-
-    public void execute(Diagram d, String code);
-}
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/SplitFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/SplitFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,12 +23,7 @@
  */
 package com.sun.hotspot.igv.filter;
 
-import com.sun.hotspot.igv.graph.Connection;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.graph.InputSlot;
-import com.sun.hotspot.igv.graph.OutputSlot;
-import com.sun.hotspot.igv.graph.Selector;
+import com.sun.hotspot.igv.graph.*;
 import java.util.List;
 
 /**
@@ -47,10 +42,12 @@
         this.propertyName = propertyName;
     }
 
+    @Override
     public String getName() {
         return name;
     }
     
+    @Override
     public void apply(Diagram d) {
         List<Figure> list = selector.selected(d);
 
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/UnconnectedSlotFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/UnconnectedSlotFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,11 +23,7 @@
  */
 package com.sun.hotspot.igv.filter;
 
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.graph.InputSlot;
-import com.sun.hotspot.igv.graph.OutputSlot;
-import com.sun.hotspot.igv.graph.Slot;
+import com.sun.hotspot.igv.graph.*;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -44,10 +40,12 @@
         this.removeOutputs = outputs;
     }
 
+    @Override
     public String getName() {
         return "Unconnected Slot Filter";
     }
 
+    @Override
     public void apply(Diagram d) {
         if (!removeInputs && !removeOutputs) {
             return;
@@ -55,7 +53,7 @@
 
         List<Figure> figures = d.getFigures();
         for (Figure f : figures) {
-            List<Slot> remove = new ArrayList<Slot>();
+            List<Slot> remove = new ArrayList<>();
             if (removeInputs) {
                 for (InputSlot is : f.getInputSlots()) {
                     if (is.getConnections().isEmpty()) {
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/CheckListView.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/CheckListView.java	Thu Feb 02 16:07:52 2012 -0800
@@ -44,8 +44,8 @@
     }
 
     @Override
-    protected JList createList() {
-        JList tmpList = super.createList();
+    protected JList<Object> createList() {
+        JList<Object> tmpList = super.createList();
         tmpList.setCellRenderer(new CheckRenderer(tmpList));
         return tmpList;
     }
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/CheckNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/CheckNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -40,7 +40,7 @@
 
     public CheckNode(Children c, Lookup lookup) {
         super(c, lookup);
-        selectionChangedEvent = new ChangedEvent<CheckNode>(this);
+        selectionChangedEvent = new ChangedEvent<>(this);
         selected = false;
         enabled = true;
     }
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/CheckRenderer.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/CheckRenderer.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,11 +23,7 @@
  */
 package com.sun.hotspot.igv.filterwindow;
 
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Point;
-import java.awt.Rectangle;
+import java.awt.*;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import javax.swing.JCheckBox;
@@ -37,12 +33,12 @@
 /**
  * @author Thomas Wuerthinger
  */
-public class CheckRenderer extends JCheckBox implements ListCellRenderer {
+public class CheckRenderer extends JCheckBox implements ListCellRenderer<Object> {
 
-    private JList list;
+    private JList<Object> list;
     private Color startBackground;
 
-    public CheckRenderer(final JList list) {
+    public CheckRenderer(final JList<Object> list) {
         this.list = list;
         list.addMouseListener(
                 new MouseAdapter() {
@@ -65,7 +61,8 @@
         startBackground = this.getBackground();
     }
 
-    public Component getListCellRendererComponent(final JList list, Object value, final int index, boolean isSelected, boolean cellHasFocus) {
+    @Override
+    public Component getListCellRendererComponent(final JList<? extends Object> list, Object value, final int index, boolean isSelected, boolean cellHasFocus) {
         setText(value.toString());
         CheckNode node = ((CheckNodeListModel) list.getModel()).getCheckNodeAt(index);
         this.setSelected(node.isSelected());
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterChainProviderImplementation.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterChainProviderImplementation.java	Thu Feb 02 16:07:52 2012 -0800
@@ -32,10 +32,12 @@
  */
 public class FilterChainProviderImplementation implements FilterChainProvider {
 
+    @Override
     public FilterChain getFilterChain() {
         return FilterTopComponent.findInstance().getFilterChain();
     }
 
+    @Override
     public FilterChain getSequence() {
         return FilterTopComponent.findInstance().getSequence();
     }
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterNode.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,12 +23,12 @@
  */
 package com.sun.hotspot.igv.filterwindow;
 
+import com.sun.hotspot.igv.data.ChangedListener;
+import com.sun.hotspot.igv.filter.Filter;
+import com.sun.hotspot.igv.filter.FilterChain;
 import com.sun.hotspot.igv.filterwindow.actions.MoveFilterDownAction;
 import com.sun.hotspot.igv.filterwindow.actions.MoveFilterUpAction;
 import com.sun.hotspot.igv.filterwindow.actions.RemoveFilterAction;
-import com.sun.hotspot.igv.filter.Filter;
-import com.sun.hotspot.igv.filter.FilterChain;
-import com.sun.hotspot.igv.data.ChangedListener;
 import com.sun.hotspot.igv.util.PropertiesSheet;
 import javax.swing.Action;
 import org.openide.actions.OpenAction;
@@ -48,7 +48,7 @@
 public class FilterNode extends CheckNode implements LookupListener, ChangedListener<FilterTopComponent> {
 
     private Filter filter;
-    private Lookup.Result result;
+    private Lookup.Result<FilterChain> result;
 
     public FilterNode(Filter filter) {
         this(filter, new InstanceContent());
@@ -62,6 +62,7 @@
         this.filter = filter;
         filter.getChangedEvent().addListener(new ChangedListener<Filter>() {
 
+            @Override
             public void changed(Filter source) {
                 update();
             }
@@ -69,7 +70,7 @@
 
         update();
 
-        Lookup.Template<FilterChain> tpl = new Lookup.Template<FilterChain>(FilterChain.class);
+        Lookup.Template<FilterChain> tpl = new Lookup.Template<>(FilterChain.class);
         result = Utilities.actionsGlobalContext().lookup(tpl);
         result.addLookupListener(this);
 
@@ -104,10 +105,12 @@
         return OpenAction.get(OpenAction.class).createContextAwareInstance(Utilities.actionsGlobalContext());
     }
 
+    @Override
     public void resultChanged(LookupEvent lookupEvent) {
         changed(FilterTopComponent.findInstance());
     }
 
+    @Override
     public void changed(FilterTopComponent source) {
         setSelected(source.getFilterChain().containsFilter(filter));
     }
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterTopComponent.form	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterTopComponent.form	Thu Feb 02 16:07:52 2012 -0800
@@ -4,6 +4,7 @@
   <AuxValues>
     <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
     <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
     <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
     <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
     <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterTopComponent.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterTopComponent.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,66 +23,38 @@
  */
 package com.sun.hotspot.igv.filterwindow;
 
-import com.sun.hotspot.igv.filterwindow.actions.MoveFilterDownAction;
-import com.sun.hotspot.igv.filterwindow.actions.MoveFilterUpAction;
-import com.sun.hotspot.igv.filterwindow.actions.NewFilterAction;
-import com.sun.hotspot.igv.filterwindow.actions.RemoveFilterAction;
-import com.sun.hotspot.igv.filterwindow.actions.RemoveFilterSettingsAction;
-import com.sun.hotspot.igv.filterwindow.actions.SaveFilterSettingsAction;
+import com.sun.hotspot.igv.data.ChangedEvent;
+import com.sun.hotspot.igv.data.ChangedListener;
 import com.sun.hotspot.igv.filter.CustomFilter;
 import com.sun.hotspot.igv.filter.Filter;
 import com.sun.hotspot.igv.filter.FilterChain;
 import com.sun.hotspot.igv.filter.FilterSetting;
-import com.sun.hotspot.igv.data.ChangedEvent;
-import com.sun.hotspot.igv.data.ChangedListener;
+import com.sun.hotspot.igv.filterwindow.actions.*;
 import java.awt.BorderLayout;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Serializable;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.io.*;
+import java.util.*;
 import javax.swing.JComboBox;
 import javax.swing.UIManager;
 import javax.swing.border.Border;
 import org.openide.DialogDisplayer;
 import org.openide.ErrorManager;
 import org.openide.NotifyDescriptor;
+import org.openide.awt.Toolbar;
 import org.openide.awt.ToolbarPool;
 import org.openide.explorer.ExplorerManager;
 import org.openide.explorer.ExplorerUtils;
+import org.openide.filesystems.FileLock;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
 import org.openide.nodes.AbstractNode;
 import org.openide.nodes.Children;
 import org.openide.nodes.Node;
-import org.openide.util.Exceptions;
-import org.openide.util.Lookup;
-import org.openide.util.LookupEvent;
-import org.openide.util.LookupListener;
-import org.openide.util.NbBundle;
-import org.openide.util.Utilities;
-import org.openide.awt.Toolbar;
-import org.openide.filesystems.FileLock;
+import org.openide.util.*;
 import org.openide.util.actions.SystemAction;
 import org.openide.windows.TopComponent;
 import org.openide.windows.WindowManager;
-import org.openide.filesystems.Repository;
-import org.openide.filesystems.FileSystem;
-import org.openide.filesystems.FileObject;
-import org.openide.filesystems.FileUtil;
 
 /**
  * 
@@ -99,13 +71,14 @@
     private ExplorerManager manager;
     private FilterChain filterChain;
     private FilterChain sequence;
-    private Lookup.Result result;
+    private Lookup.Result<FilterChain> result;
     private JComboBox comboBox;
     private List<FilterSetting> filterSettings;
     private FilterSetting customFilterSetting = new FilterSetting("-- Custom --");
     private ChangedEvent<FilterTopComponent> filterSettingsChangedEvent;
     private ActionListener comboBoxActionListener = new ActionListener() {
 
+        @Override
         public void actionPerformed(ActionEvent e) {
             comboBoxSelectionChanged();
         }
@@ -141,7 +114,7 @@
         if (s != customFilterSetting) {
             FilterChain chain = getFilterChain();
             chain.getChangedEvent().beginAtomic();
-            List<Filter> toRemove = new ArrayList<Filter>();
+            List<Filter> toRemove = new ArrayList<>();
             for (Filter f : chain.getFilters()) {
                 if (!s.containsFilter(f)) {
                     toRemove.add(f);
@@ -204,6 +177,7 @@
             // Sort alphabetically
             Collections.sort(filterSettings, new Comparator<FilterSetting>() {
 
+                @Override
                 public int compare(FilterSetting o1, FilterSetting o2) {
                     return o1.getName().compareTo(o2.getName());
                 }
@@ -270,8 +244,9 @@
 
     private class FilterChildren extends Children.Keys<Filter> implements ChangedListener<CheckNode> {
 
-        private HashMap<Filter, Node> nodeHash = new HashMap<Filter, Node>();
+        private HashMap<Filter, Node> nodeHash = new HashMap<>();
 
+        @Override
         protected Node[] createNodes(Filter filter) {
             if (nodeHash.containsKey(filter)) {
                 return new Node[]{nodeHash.get(filter)};
@@ -286,6 +261,7 @@
         public FilterChildren() {
             sequence.getChangedEvent().addListener(new ChangedListener<FilterChain>() {
 
+                @Override
                 public void changed(FilterChain source) {
                     addNotify();
                 }
@@ -300,6 +276,7 @@
             updateSelection();
         }
 
+        @Override
         public void changed(CheckNode source) {
             FilterNode node = (FilterNode) source;
             Filter f = node.getFilter();
@@ -324,7 +301,7 @@
     }
 
     private FilterTopComponent() {
-        filterSettingsChangedEvent = new ChangedEvent<FilterTopComponent>(this);
+        filterSettingsChangedEvent = new ChangedEvent<>(this);
         initComponents();
         setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
         setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
@@ -354,7 +331,7 @@
         toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
         this.add(view, BorderLayout.CENTER);
 
-        filterSettings = new ArrayList<FilterSetting>();
+        filterSettings = new ArrayList<>();
         updateComboBox();
 
         comboBox.addActionListener(comboBoxActionListener);
@@ -394,6 +371,7 @@
             filter = cf;
         }
 
+        @Override
         public void changed(Filter source) {
             try {
                 if (!fileObject.getName().equals(filter.getName())) {
@@ -402,15 +380,14 @@
                     lock.releaseLock();
                     FileObject newFileObject = fileObject.getParent().getFileObject(filter.getName());
                     fileObject = newFileObject;
-
                 }
 
                 FileLock lock = fileObject.lock();
                 OutputStream os = fileObject.getOutputStream(lock);
-                Writer w = new OutputStreamWriter(os);
-                String s = filter.getCode();
-                w.write(s);
-                w.close();
+                try (Writer w = new OutputStreamWriter(os)) {
+                    String s = filter.getCode();
+                    w.write(s);
+                }
                 lock.releaseLock();
 
             } catch (IOException ex) {
@@ -423,10 +400,10 @@
         FileObject folder = FileUtil.getConfigRoot().getFileObject(FOLDER_ID);
         FileObject[] children = folder.getChildren();
 
-        List<CustomFilter> customFilters = new ArrayList<CustomFilter>();
-        HashMap<CustomFilter, String> afterMap = new HashMap<CustomFilter, String>();
-        Set<CustomFilter> enabledSet = new HashSet<CustomFilter>();
-        HashMap<String, CustomFilter> map = new HashMap<String, CustomFilter>();
+        List<CustomFilter> customFilters = new ArrayList<>();
+        HashMap<CustomFilter, String> afterMap = new HashMap<>();
+        Set<CustomFilter> enabledSet = new HashSet<>();
+        HashMap<String, CustomFilter> map = new HashMap<>();
 
         for (final FileObject fo : children) {
             InputStream is = null;
@@ -478,7 +455,7 @@
 
         for (int j = 0; j < customFilters.size(); j++) {
             for (int i = 0; i < customFilters.size(); i++) {
-                List<CustomFilter> copiedList = new ArrayList<CustomFilter>(customFilters);
+                List<CustomFilter> copiedList = new ArrayList<>(customFilters);
                 for (CustomFilter cf : copiedList) {
 
                     String after = afterMap.get(cf);
@@ -556,13 +533,14 @@
         return PREFERRED_ID;
     }
 
+    @Override
     public ExplorerManager getExplorerManager() {
         return manager;
     }
 
     @Override
     public void componentOpened() {
-        Lookup.Template<FilterChain> tpl = new Lookup.Template<FilterChain>(FilterChain.class);
+        Lookup.Template<FilterChain> tpl = new Lookup.Template<>(FilterChain.class);
         result = Utilities.actionsGlobalContext().lookup(tpl);
         result.addLookupListener(this);
     }
@@ -573,6 +551,7 @@
         result = null;
     }
 
+    @Override
     public void resultChanged(LookupEvent lookupEvent) {
         setChain(Utilities.actionsGlobalContext().lookup(FilterChain.class));
     }
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/FilterAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/FilterAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,7 +23,7 @@
  */
 package com.sun.hotspot.igv.filterwindow.actions;
 
-import com.sun.hotspot.igv.filterwindow.*;
+import com.sun.hotspot.igv.filterwindow.FilterTopComponent;
 import java.awt.event.ActionEvent;
 import javax.swing.AbstractAction;
 import org.openide.util.NbBundle;
@@ -39,6 +39,7 @@
         super(NbBundle.getMessage(FilterAction.class, "CTL_FilterAction"));
     }
 
+    @Override
     public void actionPerformed(ActionEvent evt) {
         TopComponent win = FilterTopComponent.findInstance();
         win.open();
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/MoveFilterDownAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/MoveFilterDownAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,8 +23,8 @@
  */
 package com.sun.hotspot.igv.filterwindow.actions;
 
+import com.sun.hotspot.igv.filter.Filter;
 import com.sun.hotspot.igv.filterwindow.FilterTopComponent;
-import com.sun.hotspot.igv.filter.Filter;
 import javax.swing.Action;
 import org.openide.nodes.Node;
 import org.openide.util.HelpCtx;
@@ -37,6 +37,7 @@
  */
 public final class MoveFilterDownAction extends CookieAction {
 
+    @Override
     protected void performAction(Node[] activatedNodes) {
         for (Node n : activatedNodes) {
             Filter c = n.getLookup().lookup(Filter.class);
@@ -44,6 +45,7 @@
         }
     }
 
+    @Override
     protected int mode() {
         return CookieAction.MODE_EXACTLY_ONE;
     }
@@ -53,10 +55,12 @@
         putValue(Action.SHORT_DESCRIPTION, "Move selected filter downwards");
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(MoveFilterUpAction.class, "CTL_MoveFilterDownAction");
     }
 
+    @Override
     protected Class[] cookieClasses() {
         return new Class[]{
             Filter.class
@@ -74,6 +78,7 @@
         putValue("noIconInMenu", Boolean.TRUE);
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/MoveFilterUpAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/MoveFilterUpAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,8 +23,8 @@
  */
 package com.sun.hotspot.igv.filterwindow.actions;
 
+import com.sun.hotspot.igv.filter.Filter;
 import com.sun.hotspot.igv.filterwindow.FilterTopComponent;
-import com.sun.hotspot.igv.filter.Filter;
 import javax.swing.Action;
 import org.openide.nodes.Node;
 import org.openide.util.HelpCtx;
@@ -37,6 +37,7 @@
  */
 public final class MoveFilterUpAction extends CookieAction {
 
+    @Override
     protected void performAction(Node[] activatedNodes) {
         for (Node n : activatedNodes) {
             Filter c = n.getLookup().lookup(Filter.class);
@@ -44,6 +45,7 @@
         }
     }
 
+    @Override
     protected int mode() {
         return CookieAction.MODE_EXACTLY_ONE;
     }
@@ -52,10 +54,12 @@
         putValue(Action.SHORT_DESCRIPTION, "Move selected filter upwards");
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(MoveFilterUpAction.class, "CTL_MoveFilterUpAction");
     }
 
+    @Override
     protected Class[] cookieClasses() {
         return new Class[]{
             Filter.class
@@ -73,6 +77,7 @@
         putValue("noIconInMenu", Boolean.TRUE);
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/NewFilterAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/NewFilterAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -39,10 +39,12 @@
         putValue(Action.SHORT_DESCRIPTION, "Create new filter");
     }
 
+    @Override
     public void performAction() {
         FilterTopComponent.findInstance().newFilter();
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(SaveFilterSettingsAction.class, "CTL_NewFilterAction");
     }
@@ -52,6 +54,7 @@
         super.initialize();
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/RemoveFilterAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/RemoveFilterAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,8 +23,8 @@
  */
 package com.sun.hotspot.igv.filterwindow.actions;
 
+import com.sun.hotspot.igv.filter.Filter;
 import com.sun.hotspot.igv.filterwindow.FilterTopComponent;
-import com.sun.hotspot.igv.filter.Filter;
 import javax.swing.Action;
 import javax.swing.JOptionPane;
 import org.openide.nodes.Node;
@@ -39,6 +39,7 @@
  */
 public final class RemoveFilterAction extends CookieAction {
 
+    @Override
     protected void performAction(Node[] activatedNodes) {
         Object[] options = {"Yes",
             "No",
@@ -59,10 +60,12 @@
         }
     }
 
+    @Override
     protected int mode() {
         return CookieAction.MODE_ALL;
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(RemoveFilterAction.class, "CTL_RemoveFilterAction");
     }
@@ -71,6 +74,7 @@
         putValue(Action.SHORT_DESCRIPTION, "Remove selected filter");
     }
 
+    @Override
     protected Class[] cookieClasses() {
         return new Class[]{
             Filter.class
@@ -88,6 +92,7 @@
         return "com/sun/hotspot/igv/filterwindow/images/minus.png";
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/RemoveFilterSettingsAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/RemoveFilterSettingsAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -35,10 +35,12 @@
  */
 public final class RemoveFilterSettingsAction extends CallableSystemAction {
 
+    @Override
     public void performAction() {
         FilterTopComponent.findInstance().removeFilterSetting();
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(RemoveFilterSettingsAction.class, "CTL_RemoveFilterSettingsAction");
     }
@@ -52,6 +54,7 @@
         super.initialize();
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/SaveFilterSettingsAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/SaveFilterSettingsAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -35,10 +35,12 @@
  */
 public final class SaveFilterSettingsAction extends CallableSystemAction {
 
+    @Override
     public void performAction() {
         FilterTopComponent.findInstance().addFilterSetting();
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(SaveFilterSettingsAction.class, "CTL_SaveFilterSettingsAction");
     }
@@ -52,6 +54,7 @@
         putValue(Action.SHORT_DESCRIPTION, "Save filter configuration as profile...");
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/Graal/build.xml	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graal/build.xml	Thu Feb 02 16:07:52 2012 -0800
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
-<!-- for some information on what you could do (e.g. targets to override). -->
-<!-- If you delete this file and reopen the project it will be recreated. -->
-<project name="com.sun.hotspot.igv.graal" default="netbeans" basedir=".">
-    <description>Builds, tests, and runs the project com.sun.hotspot.igv.graal.</description>
-    <import file="nbproject/build-impl.xml"/>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
+<!-- for some information on what you could do (e.g. targets to override). -->
+<!-- If you delete this file and reopen the project it will be recreated. -->
+<project name="com.sun.hotspot.igv.graal" default="netbeans" basedir=".">
+    <description>Builds, tests, and runs the project com.sun.hotspot.igv.graal.</description>
+    <import file="nbproject/build-impl.xml"/>
+</project>
--- a/src/share/tools/IdealGraphVisualizer/Graal/nbproject/build-impl.xml	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/build-impl.xml	Thu Feb 02 16:07:52 2012 -0800
@@ -1,45 +1,45 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-*** GENERATED FROM project.xml - DO NOT EDIT  ***
-***         EDIT ../build.xml INSTEAD         ***
--->
-<project name="com.sun.hotspot.igv.graal-impl" basedir="..">
-    <fail message="Please build using Ant 1.7.1 or higher.">
-        <condition>
-            <not>
-                <antversion atleast="1.7.1"/>
-            </not>
-        </condition>
-    </fail>
-    <property file="nbproject/private/suite-private.properties"/>
-    <property file="nbproject/suite.properties"/>
-    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
-    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
-    <property file="${suite.dir}/nbproject/platform.properties"/>
-    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="name"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{name}" value="${@{value}}"/>
-        </sequential>
-    </macrodef>
-    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="property"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{property}" value="@{value}"/>
-        </sequential>
-    </macrodef>
-    <property file="${user.properties.file}"/>
-    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
-        <condition>
-            <not>
-                <contains string="${cluster.path.evaluated}" substring="platform"/>
-            </not>
-        </condition>
-    </fail>
-    <import file="${harness.dir}/build.xml"/>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT  ***
+***         EDIT ../build.xml INSTEAD         ***
+-->
+<project name="com.sun.hotspot.igv.graal-impl" basedir="..">
+    <fail message="Please build using Ant 1.7.1 or higher.">
+        <condition>
+            <not>
+                <antversion atleast="1.7.1"/>
+            </not>
+        </condition>
+    </fail>
+    <property file="nbproject/private/suite-private.properties"/>
+    <property file="nbproject/suite.properties"/>
+    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
+    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
+    <property file="${suite.dir}/nbproject/platform.properties"/>
+    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
+        <attribute name="name"/>
+        <attribute name="value"/>
+        <sequential>
+            <property name="@{name}" value="${@{value}}"/>
+        </sequential>
+    </macrodef>
+    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
+        <attribute name="property"/>
+        <attribute name="value"/>
+        <sequential>
+            <property name="@{property}" value="@{value}"/>
+        </sequential>
+    </macrodef>
+    <property file="${user.properties.file}"/>
+    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
+        <condition>
+            <not>
+                <contains string="${cluster.path.evaluated}" substring="platform"/>
+            </not>
+        </condition>
+    </fail>
+    <import file="${harness.dir}/build.xml"/>
+</project>
--- a/src/share/tools/IdealGraphVisualizer/Graal/nbproject/genfiles.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/genfiles.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=2bb741e3
-build.xml.script.CRC32=3534d355
-build.xml.stylesheet.CRC32=a56c6a5b@1.45.1
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=2bb741e3
-nbproject/build-impl.xml.script.CRC32=2867f2d5
-nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1
+build.xml.data.CRC32=79002a09
+build.xml.script.CRC32=3534d355
+build.xml.stylesheet.CRC32=a56c6a5b@2.47.1
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=79002a09
+nbproject/build-impl.xml.script.CRC32=2867f2d5
+nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.47.1
--- a/src/share/tools/IdealGraphVisualizer/Graal/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/Graal/nbproject/project.xml	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/project.xml	Thu Feb 02 16:07:52 2012 -0800
@@ -1,53 +1,37 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
-    <type>org.netbeans.modules.apisupport.project</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
-            <code-name-base>com.sun.hotspot.igv.graal</code-name-base>
-            <suite-component/>
-            <module-dependencies>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.data</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.filter</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.graph</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.graphtotext</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.structuredtext</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-            </module-dependencies>
-            <public-packages/>
-        </data>
-    </configuration>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.apisupport.project</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+            <code-name-base>com.sun.hotspot.igv.graal</code-name-base>
+            <suite-component/>
+            <module-dependencies>
+                <dependency>
+                    <code-name-base>com.sun.hotspot.igv.data</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>1.0</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>com.sun.hotspot.igv.filter</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>1.0</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>com.sun.hotspot.igv.graph</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>1.0</specification-version>
+                    </run-dependency>
+                </dependency>
+            </module-dependencies>
+            <public-packages/>
+        </data>
+    </configuration>
+</project>
--- a/src/share/tools/IdealGraphVisualizer/Graal/src/META-INF/services/com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.hotspot.igv.graal.GraalGraphToTextConverter
\ No newline at end of file
--- a/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/GraalGraphToTextConverter.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.sun.hotspot.igv.graal;
-
-import com.sun.hotspot.igv.data.InputBlock;
-import com.sun.hotspot.igv.data.InputEdge;
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.data.Properties;
-import com.sun.hotspot.igv.data.Properties.PropertyMatcher;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter;
-import com.sun.hotspot.igv.structuredtext.Element;
-import com.sun.hotspot.igv.structuredtext.MultiElement;
-import com.sun.hotspot.igv.structuredtext.SimpleElement;
-import com.sun.hotspot.igv.structuredtext.StructuredText;
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.swing.text.Style;
-import javax.swing.text.StyleConstants;
-import javax.swing.text.StyleContext;
-
-/**
- * @author Peter Hofer
- * @author Thomas Wuerthinger
- */
-public class GraalGraphToTextConverter implements GraphToTextConverter {
-
-    private Map<InputNode, Set<Figure>> map;
-    private Map<InputNode, List<InputEdge>> incomingEdges;
-    private Map<InputNode, List<InputEdge>> outgoingEdges;
-    private InputGraph graph;
-
-    private Collection<InputNode> sortNodes(Collection<InputNode> nodes) {
-        List<InputNode> result = new ArrayList<InputNode>(nodes);
-        Collections.sort(result, InputNode.getPropertyComparator("idx"));
-        return result;
-    }
-
-    public StructuredText convert(InputGraph graph, Diagram diagram) {
-
-        this.graph = graph;
-        map = diagram.calcSourceToFigureRelation();
-
-        incomingEdges = graph.findAllIngoingEdges();
-        outgoingEdges = graph.findAllOutgoingEdges();
-
-        final StructuredText result = new StructuredText(graph.getName());
-
-        for (InputBlock b : graph.getBlocks()) {
-            result.addChild(new SimpleElement("Block " + b.getName() + "\n"));
-            for (InputNode n : sortNodes(b.getNodes())) {
-                result.addChild(getNodeElement(n));
-            }
-        }
-
-        boolean first = true;
-        for (InputNode n : sortNodes(graph.getNodes())) {
-            if (graph.getBlock(n) == null) {
-                if (first) {
-                    first = false;
-                    result.addChild(new SimpleElement("No block: \n"));
-                }
-                result.addChild(getNodeElement(n));
-            }
-        }
-
-        return result;
-    }
-
-    private Element getNodeNameElement(InputNode n) {
-
-        final SimpleElement name = new SimpleElement(n.getProperties().get("idx") + " " + n.getProperties().get("name"), calcStyle(n));
-        name.addSource(n.getId());
-        return name;
-    }
-
-    private Element getNodeShortElement(InputNode n) {
-        final SimpleElement id = new SimpleElement(n.getProperties().get("idx"), calcStyle(n));
-        id.addSource(n.getId());
-        return id;
-    }
-
-    private Element getNodeElement(InputNode n) {
-
-        final MultiElement result = new MultiElement();
-
-        result.print("\t");
-        result.addChild(getNodeNameElement(n));
-
-        result.print(" :::");
-
-        // NOTE: lists in ingoingEdges/outgoingEdges are sorted by from/to slot
-        //       and for slots that are connected with multiple edges, by
-        //       from/to node
-
-        InputEdge[] outgoing = outgoingEdges.get(n).toArray(new InputEdge[0]);
-        int succCount = outgoing.length - Integer.parseInt(n.getProperties().get("usageCount"));
-
-        int i = 0;
-        if (outgoing.length > 0 && outgoing[0].getFromIndex() < succCount) {
-            // Node has successors (each connected to a different slot)
-            result.print("  Succ = [");
-            while (i < outgoing.length && outgoing[i].getFromIndex() < succCount) {
-                result.print(" ");
-                result.addChild(getNodeShortElement(graph.getNode(outgoing[i].getTo())));
-                result.print(" ");
-                i++;
-            }
-            result.print("]");
-        }
-        if (i < outgoing.length) {
-            // Node has usages (all connected to a single slot)
-            result.print("  Usages = [");
-            while (i < outgoing.length) {
-                result.print(" ");
-                result.addChild(getNodeShortElement(graph.getNode(outgoing[i].getTo())));
-                result.print(" ");
-                i++;
-            }
-            result.print("]");
-        }
-
-        int predCount = Integer.parseInt(n.getProperties().get("predecessorCount"));
-        InputEdge[] incoming = incomingEdges.get(n).toArray(new InputEdge[0]);
-
-        int j = 0;
-        if (incoming.length > 0 && incoming[0].getToIndex() < predCount) {
-            // Node has predecessors (each connected to a different slot)
-            result.print("  Pred = [");
-            while (j < incoming.length && incoming[j].getToIndex() < predCount) {
-                result.print(" ");
-                result.addChild(getNodeShortElement(graph.getNode(incoming[j].getFrom())));
-                result.print(" ");
-                j++;
-            }
-            result.print("]");
-        }
-        if (j < incoming.length) {
-            // Node has inputs (each connected to a different slot)
-            result.print("  Inputs = [");
-            while (j < incoming.length) {
-                result.print(" ");
-                result.addChild(getNodeShortElement(graph.getNode(incoming[j].getFrom())));
-                result.print(" ");
-                j++;
-            }
-            result.print("]");
-        }
-
-        result.print("\n");
-        return result;
-    }
-    private static final PropertyMatcher MATCHER = new Properties.StringPropertyMatcher("origin", "Graal");
-
-    public boolean canConvert(InputGraph graph) {
-        return graph.getGroup().getProperties().selectSingle(MATCHER) != null;
-    }
-
-    private Color calcColor(InputNode node) {
-        Set<Figure> figureSet = this.map.get(node);
-        if (figureSet != null && figureSet.size() == 1) {
-            return figureSet.iterator().next().getColor();
-        } else {
-            return Color.WHITE;
-        }
-    }
-
-    private Color lessColor(Color c) {
-        return new Color(255 - (255 - c.getRed()) / 4, 255 - (255 - c.getGreen()) / 4, 255 - (255 - c.getBlue()) / 4);
-    }
-
-    private Style calcStyle(InputNode node) {
-        Color c = calcColor(node);
-        Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
-        Style newStyle = StyleContext.getDefaultStyleContext().addStyle(null, defaultStyle);
-
-        StyleConstants.setBackground(newStyle, lessColor(c));
-        return newStyle;
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -34,13 +34,15 @@
 
 public class GraalCFGFilter extends AbstractFilter {
     
+    @Override
     public String getName() {
         return "Graal CFG Filter";
     }
 
+    @Override
     public void apply(Diagram d) {
-        Set<Figure> figuresToRemove = new HashSet<Figure>();
-        Set<Connection> connectionsToRemove = new HashSet<Connection>();
+        Set<Figure> figuresToRemove = new HashSet<>();
+        Set<Connection> connectionsToRemove = new HashSet<>();
         for (Figure f : d.getFigures()) {
             final String prop = f.getProperties().get("probability");
             
--- a/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalColoringFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalColoringFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -38,10 +38,12 @@
         this.colorName = colorName;
     }
 
+    @Override
     public String getName() {
         return "Graal Coloring Filter (" + colorName + ")";
     }
 
+    @Override
     public void apply(Diagram d) {
         List<Figure> figures = d.getFigures();
         int colors = 0;
--- a/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalEdgeColorFilter.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalEdgeColorFilter.java	Thu Feb 02 16:07:52 2012 -0800
@@ -26,6 +26,7 @@
 import com.sun.hotspot.igv.data.Properties;
 import com.sun.hotspot.igv.filter.AbstractFilter;
 import com.sun.hotspot.igv.graph.Connection;
+import com.sun.hotspot.igv.graph.Connection.ConnectionStyle;
 import com.sun.hotspot.igv.graph.Diagram;
 import com.sun.hotspot.igv.graph.Figure;
 import com.sun.hotspot.igv.graph.InputSlot;
@@ -46,10 +47,12 @@
     public GraalEdgeColorFilter() {
     }
 
+    @Override
     public String getName() {
         return "Graal Edge Color Filter";
     }
 
+    @Override
     public void apply(Diagram d) {
         List<Figure> figures = d.getFigures();
         for (Figure f : figures) {
@@ -62,8 +65,10 @@
             }
             for (InputSlot is : f.getInputSlots()) {
                 Color color;
+                ConnectionStyle style = ConnectionStyle.NORMAL;
                 if (is.getPosition() < predCount) {
                     color = successorColor;
+                    style = ConnectionStyle.BOLD;
                 } else {
                     color = usageColor;
                 }
@@ -72,9 +77,11 @@
                 for (Connection c : is.getConnections()) {
                     if (c.getLabel() == null || !c.getLabel().endsWith("#NDF")) {
                         c.setColor(color);
+                        c.setStyle(style);
                     } else if ("EndNode".equals(c.getOutputSlot().getFigure().getProperties().get("class"))
                             || "EndNode".equals(c.getOutputSlot().getProperties().get("class"))) {
                         c.setColor(successorColor);
+                        c.setStyle(ConnectionStyle.BOLD);
                     }
                 }
             }
--- a/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/callgraph.filter	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/callgraph.filter	Thu Feb 02 16:07:52 2012 -0800
@@ -1,3 +1,4 @@
 colorize("name", "<init>.*", yellow);
 colorize("name", "<clinit>.*", pink);
-colorize("leaf", "1", red);
+colorize("leaf", "1", lightGray);
+colorize("cutoff", "1", red);
--- a/src/share/tools/IdealGraphVisualizer/Graph/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/AndSelector.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/AndSelector.java	Thu Feb 02 16:07:52 2012 -0800
@@ -40,10 +40,11 @@
         this.selector2 = s2;
     }
 
+    @Override
     public List<Figure> selected(Diagram d) {
         List<Figure> l1 = selector1.selected(d);
         List<Figure> l2 = selector2.selected(d);
-        List<Figure> result = new ArrayList<Figure>();
+        List<Figure> result = new ArrayList<>();
         for (Figure f : l2) {
             if (l1.contains(f)) {
                 result.add(f);
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Block.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.graph;
-
-import com.sun.hotspot.igv.data.InputBlock;
-import com.sun.hotspot.igv.layout.Cluster;
-import java.awt.Rectangle;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class Block implements Cluster {
-
-    private InputBlock inputBlock;
-    private Rectangle bounds;
-    private Diagram diagram;
-
-    public Block(InputBlock inputBlock, Diagram diagram) {
-        this.inputBlock = inputBlock;
-        this.diagram = diagram;
-    }
-
-    public Cluster getOuter() {
-        return null;
-    }
-
-    public InputBlock getInputBlock() {
-        return inputBlock;
-    }
-
-    public Set<? extends Cluster> getSuccessors() {
-        Set<Block> succs = new HashSet<Block>();
-        for (InputBlock b : inputBlock.getSuccessors()) {
-            succs.add(diagram.getBlock(b));
-        }
-        return succs;
-    }
-
-    public void setBounds(Rectangle r) {
-        this.bounds = r;
-    }
-
-    public Rectangle getBounds() {
-        return bounds;
-    }
-
-    public int compareTo(Cluster o) {
-        return toString().compareTo(o.toString());
-    }
-
-    @Override
-    public String toString() {
-        return inputBlock.getName();
-    }
-}
-    
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Connection.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Connection.java	Thu Feb 02 16:07:52 2012 -0800
@@ -37,6 +37,11 @@
  */
 public class Connection implements Source.Provider, Link {
 
+    @Override
+    public boolean isVIP() {
+        return style == ConnectionStyle.BOLD;
+    }
+
     public enum ConnectionStyle {
 
         NORMAL,
@@ -57,7 +62,7 @@
         this.label = label;
         this.inputSlot.connections.add(this);
         this.outputSlot.connections.add(this);
-        controlPoints = new ArrayList<Point>();
+        controlPoints = new ArrayList<>();
         Figure sourceFigure = this.outputSlot.getFigure();
         Figure destFigure = this.inputSlot.getFigure();
         sourceFigure.addSuccessor(destFigure);
@@ -92,6 +97,7 @@
         style = s;
     }
 
+    @Override
     public Source getSource() {
         return source;
     }
@@ -125,18 +131,22 @@
         return "Connection('" + label + "', " + getFrom().getVertex() + " to " + getTo().getVertex() + ")";
     }
 
+    @Override
     public Port getFrom() {
         return outputSlot;
     }
 
+    @Override
     public Port getTo() {
         return inputSlot;
     }
 
+    @Override
     public List<Point> getControlPoints() {
         return controlPoints;
     }
 
+    @Override
     public void setControlPoints(List<Point> list) {
         controlPoints = list;
     }
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,24 +23,13 @@
  */
 package com.sun.hotspot.igv.graph;
 
-import com.sun.hotspot.igv.data.InputBlock;
 import com.sun.hotspot.igv.data.InputEdge;
 import com.sun.hotspot.igv.data.InputGraph;
 import com.sun.hotspot.igv.data.InputNode;
 import com.sun.hotspot.igv.data.Properties;
 import com.sun.hotspot.igv.data.Properties.StringPropertyMatcher;
 import java.awt.Font;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  *
@@ -49,7 +38,6 @@
 public class Diagram {
 
     private List<Figure> figures;
-    private Map<InputBlock, Block> blocks;
     private InputGraph graph;
     private int curId;
     private String nodeText;
@@ -65,38 +53,20 @@
     }
     
     private Diagram() {
-        figures = new ArrayList<Figure>();
-        blocks = new LinkedHashMap<InputBlock, Block>(8);
+        figures = new ArrayList<>();
         this.nodeText = "";
         this.font = new Font("Arial", Font.PLAIN, 13);
         this.slotFont = new Font("Arial", Font.PLAIN, 10);
     }
 
-    public Block getBlock(InputBlock b) {
-        assert blocks.containsKey(b);
-        return blocks.get(b);
-    }
-
     public String getNodeText() {
         return nodeText;
     }
 
-    public void updateBlocks() {
-        blocks.clear();
-        for (InputBlock b : graph.getBlocks()) {
-            Block curBlock = new Block(b, this);
-            blocks.put(b, curBlock);
-        }
-    }
-
     public Diagram getNext() {
         return Diagram.createDiagram(graph.getNext(), nodeText);
     }
 
-    public Collection<Block> getBlocks() {
-        return Collections.unmodifiableCollection(blocks.values());
-    }
-
     public Diagram getPrev() {
         return Diagram.createDiagram(graph.getPrev(), nodeText);
     }
@@ -119,7 +89,7 @@
     }
     
     public Map<InputNode, Set<Figure>> calcSourceToFigureRelation() {
-        Map<InputNode, Set<Figure>> map = new HashMap<InputNode, Set<Figure>>();
+        Map<InputNode, Set<Figure>> map = new HashMap<>();
         
         for(InputNode node : this.getGraph().getNodes()) {
             map.put(node, new HashSet<Figure>());
@@ -143,10 +113,8 @@
         d.graph = graph;
         d.nodeText = nodeText;
 
-        d.updateBlocks();
-
         Collection<InputNode> nodes = graph.getNodes();
-        Hashtable<Integer, Figure> figureHash = new Hashtable<Integer, Figure>();
+        Hashtable<Integer, Figure> figureHash = new Hashtable<>();
         for (InputNode n : nodes) {
             Figure f = d.createFigure();
             f.getSource().addSourceNode(n);
@@ -194,7 +162,7 @@
             freeFigure(f);
         }
 
-        ArrayList<Figure> newFigures = new ArrayList<Figure>();
+        ArrayList<Figure> newFigures = new ArrayList<>();
         for (Figure f : this.figures) {
             if (!figuresToRemove.contains(f)) {
                 newFigures.add(f);
@@ -205,12 +173,12 @@
 
     private void freeFigure(Figure succ) {
 
-        List<InputSlot> inputSlots = new ArrayList<InputSlot>(succ.getInputSlots());
+        List<InputSlot> inputSlots = new ArrayList<>(succ.getInputSlots());
         for (InputSlot s : inputSlots) {
             succ.removeInputSlot(s);
         }
 
-        List<OutputSlot> outputSlots = new ArrayList<OutputSlot>(succ.getOutputSlots());
+        List<OutputSlot> outputSlots = new ArrayList<>(succ.getOutputSlots());
         for (OutputSlot s : outputSlots) {
             succ.removeOutputSlot(s);
         }
@@ -239,7 +207,7 @@
 
     public Set<Connection> getConnections() {
 
-        Set<Connection> connections = new HashSet<Connection>();
+        Set<Connection> connections = new HashSet<>();
         for (Figure f : figures) {
 
             for (InputSlot s : f.getInputSlots()) {
@@ -251,7 +219,7 @@
     }
 
     public Figure getRootFigure() {
-        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<Figure>(figures);
+        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<>(figures);
         Figure root = selector.selectSingle(new StringPropertyMatcher("name", "Root"));
         if (root == null) {
             root = selector.selectSingle(new StringPropertyMatcher("name", "Start"));
@@ -278,9 +246,10 @@
         System.out.println("Number of figures: " + tmpFigures.size());
         System.out.println("Number of connections: " + connections.size());
 
-        List<Figure> figuresSorted = new ArrayList<Figure>(tmpFigures);
+        List<Figure> figuresSorted = new ArrayList<>(tmpFigures);
         Collections.sort(figuresSorted, new Comparator<Figure>() {
 
+            @Override
             public int compare(Figure a, Figure b) {
                 return b.getPredecessors().size() + b.getSuccessors().size() - a.getPredecessors().size() - a.getSuccessors().size();
             }
@@ -303,7 +272,7 @@
     }
 
     public List<Figure> getRootFigures() {
-        ArrayList<Figure> rootFigures = new ArrayList<Figure>();
+        ArrayList<Figure> rootFigures = new ArrayList<>();
         for (Figure f : figures) {
             if (f.getPredecessors().size() == 0) {
                 rootFigures.add(f);
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,25 +23,14 @@
  */
 package com.sun.hotspot.igv.graph;
 
-import com.sun.hotspot.igv.data.InputBlock;
-import com.sun.hotspot.igv.data.Source;
 import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.layout.Cluster;
-import com.sun.hotspot.igv.layout.Vertex;
 import com.sun.hotspot.igv.data.Properties;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.Point;
+import com.sun.hotspot.igv.data.Source;
+import com.sun.hotspot.igv.layout.Vertex;
+import java.awt.*;
 import java.awt.image.BufferedImage;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 /**
  *
@@ -82,7 +71,7 @@
     }
     
     public static <T> List<T> getAllBefore(List<T> inputList, T tIn) {
-        List<T> result = new ArrayList<T>();
+        List<T> result = new ArrayList<>();
         for(T t : inputList) {
             if(t.equals(tIn)) {
                 break;
@@ -123,10 +112,10 @@
     protected Figure(Diagram diagram, int id) {
         this.diagram = diagram;
         this.source = new Source();
-        inputSlots = new ArrayList<InputSlot>(5);
-        outputSlots = new ArrayList<OutputSlot>(1);
-        predecessors = new ArrayList<Figure>(6);
-        successors = new ArrayList<Figure>(6);
+        inputSlots = new ArrayList<>(5);
+        outputSlots = new ArrayList<>(1);
+        predecessors = new ArrayList<>(6);
+        successors = new ArrayList<>(6);
         this.id = id;
         idString = Integer.toString(id);
 
@@ -151,7 +140,7 @@
     }
 
     public Set<Figure> getPredecessorSet() {
-        Set<Figure> result = new HashSet<Figure>();
+        Set<Figure> result = new HashSet<>();
         for (Figure f : getPredecessors()) {
             result.add(f);
         }
@@ -159,7 +148,7 @@
     }
 
     public Set<Figure> getSuccessorSet() {
-        Set<Figure> result = new HashSet<Figure>();
+        Set<Figure> result = new HashSet<>();
         for (Figure f : getSuccessors()) {
             result.add(f);
         }
@@ -188,10 +177,12 @@
         successors.remove(f);
     }
 
+    @Override
     public void setPosition(Point p) {
         this.position = p;
     }
 
+    @Override
     public Point getPosition() {
         return position;
     }
@@ -200,6 +191,7 @@
         return diagram;
     }
 
+    @Override
     public Source getSource() {
         return source;
     }
@@ -221,7 +213,7 @@
 
         assert inputSlots.contains(s) || outputSlots.contains(s);
 
-        List<Connection> connections = new ArrayList<Connection>(s.getConnections());
+        List<Connection> connections = new ArrayList<>(s.getConnections());
         for (Connection c : connections) {
             c.remove();
         }
@@ -251,7 +243,7 @@
     }
     
     public Set<Slot> getSlots() {
-        Set<Slot> result = new HashSet<Slot>();
+        Set<Slot> result = new HashSet<>();
         result.addAll(getInputSlots());
         result.addAll(getOutputSlots());
         return result;
@@ -321,6 +313,7 @@
         return sb.toString();
     }
 
+    @Override
     public Dimension getSize() {
         if (VERTICAL_LAYOUT) {
             int width = Math.max(getWidth(), Figure.SLOT_WIDTH * (Math.max(inputSlots.size(), outputSlots.size()) + 1));
@@ -340,19 +333,7 @@
         return idString;
     }
 
-    public Cluster getCluster() {
-        if (getSource().getSourceNodes().size() == 0) {
-            assert false : "Should never reach here, every figure must have at least one source node!";
-            return null;
-        } else {
-            final InputBlock inputBlock = diagram.getGraph().getBlock(getSource().getSourceNodes().get(0));
-            assert inputBlock != null;
-            Cluster result = diagram.getBlock(inputBlock);
-            assert result != null;
-            return result;
-        }
-    }
-
+    @Override
     public boolean isRoot() {
   
         List<InputNode> sourceNodes = source.getSourceNodes();
@@ -363,7 +344,12 @@
         }
     }
 
+    @Override
     public int compareTo(Vertex f) {
         return toString().compareTo(f.toString());
     }
+
+    public Rectangle getBounds() {
+        return new Rectangle(this.getPosition(), new Dimension(this.getWidth(), this.getHeight()));
+    }
 }
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/InputSlot.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/InputSlot.java	Thu Feb 02 16:07:52 2012 -0800
@@ -36,15 +36,18 @@
         super(figure, wantedIndex);
     }
 
+    @Override
     public int getPosition() {
         return getFigure().getInputSlots().indexOf(this);
     }
 
+    @Override
     public void setPosition(int position) {
         List<InputSlot> inputSlots = getFigure().inputSlots;
         InputSlot s = inputSlots.remove(position);
         inputSlots.add(position, s);
     }
+    @Override
     public Point getRelativePosition() {
         int gap = getFigure().getWidth() - Figure.getSlotsWidth(getFigure().getInputSlots());
         double gapRatio = (double)gap / (double)(getFigure().getInputSlots().size() + 1);
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/InvertSelector.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/InvertSelector.java	Thu Feb 02 16:07:52 2012 -0800
@@ -38,9 +38,10 @@
         this.selector = selector;
     }
 
+    @Override
     public List<Figure> selected(Diagram d) {
 
-        List<Figure> result = new ArrayList<Figure>();
+        List<Figure> result = new ArrayList<>();
         List<Figure> otherResult = selector.selected(d);
         for (Figure f : d.getFigures()) {
             if (!otherResult.contains(f)) {
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/MatcherSelector.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/MatcherSelector.java	Thu Feb 02 16:07:52 2012 -0800
@@ -39,8 +39,9 @@
         this.matcher = matcher;
     }
 
+    @Override
     public List<Figure> selected(Diagram d) {
-        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<Figure>(d.getFigures());
+        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<>(d.getFigures());
         List<Figure> list = selector.selectMultiple(matcher);
         return list;
     }
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/OrSelector.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/OrSelector.java	Thu Feb 02 16:07:52 2012 -0800
@@ -40,6 +40,7 @@
         this.selector2 = s2;
     }
 
+    @Override
     public List<Figure> selected(Diagram d) {
 
         List<Figure> l1 = selector1.selected(d);
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/OutputSlot.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/OutputSlot.java	Thu Feb 02 16:07:52 2012 -0800
@@ -35,15 +35,18 @@
         super(figure, wantedIndex);
     }
 
+    @Override
     public int getPosition() {
         return getFigure().getOutputSlots().indexOf(this);
     }
 
+    @Override
     public void setPosition(int position) {
         OutputSlot s = getFigure().outputSlots.remove(position);
         getFigure().outputSlots.add(position, s);
     }
 
+    @Override
     public Point getRelativePosition() {
         int gap = getFigure().getWidth() - Figure.getSlotsWidth(getFigure().getOutputSlots());
         if(gap < 0) {
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/PredecessorSelector.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/PredecessorSelector.java	Thu Feb 02 16:07:52 2012 -0800
@@ -38,9 +38,10 @@
         this.innerSelector = innerSelector;
     }
 
+    @Override
     public List<Figure> selected(Diagram d) {
         List<Figure> inner = innerSelector.selected(d);
-        List<Figure> result = new ArrayList<Figure>();
+        List<Figure> result = new ArrayList<>();
         for (Figure f : d.getFigures()) {
             boolean saved = false;
             for (Figure f2 : f.getSuccessors()) {
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Slot.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Slot.java	Thu Feb 02 16:07:52 2012 -0800
@@ -35,8 +35,8 @@
 import java.awt.image.BufferedImage;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
-import java.util.Comparator;
 
 /**
  * 
@@ -55,7 +55,7 @@
 
 	protected Slot(Figure figure, int wantedIndex) {
 		this.figure = figure;
-		connections = new ArrayList<Connection>(2);
+		connections = new ArrayList<>(2);
 		source = new Source();
 		this.wantedIndex = wantedIndex;
 		text = "";
@@ -63,6 +63,7 @@
 		assert figure != null;
 	}
 
+    @Override
 	public Properties getProperties() {
 		Properties p = new Properties();
 		if (source.getSourceNodes().size() > 0) {
@@ -78,12 +79,14 @@
 	}
 	public static final Comparator<Slot> slotIndexComparator = new Comparator<Slot>() {
 
+        @Override
 		public int compare(Slot o1, Slot o2) {
 			return o1.wantedIndex - o2.wantedIndex;
 		}
 	};
 	public static final Comparator<Slot> slotFigureComparator = new Comparator<Slot>() {
 
+        @Override
 		public int compare(Slot o1, Slot o2) {
 			return o1.figure.getId() - o2.figure.getId();
 		}
@@ -113,6 +116,7 @@
 		return wantedIndex;
 	}
 
+    @Override
 	public Source getSource() {
 		return source;
 	}
@@ -173,12 +177,13 @@
 	}
 
 	public void removeAllConnections() {
-		List<Connection> connectionsCopy = new ArrayList<Connection>(this.connections);
+		List<Connection> connectionsCopy = new ArrayList<>(this.connections);
 		for (Connection c : connectionsCopy) {
 			c.remove();
 		}
 	}
 
+    @Override
 	public Vertex getVertex() {
 		return figure;
 	}
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/SuccessorSelector.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/SuccessorSelector.java	Thu Feb 02 16:07:52 2012 -0800
@@ -38,9 +38,10 @@
         this.innerSelector = innerSelector;
     }
 
+    @Override
     public List<Figure> selected(Diagram d) {
         List<Figure> inner = innerSelector.selected(d);
-        List<Figure> result = new ArrayList<Figure>();
+        List<Figure> result = new ArrayList<>();
         for (Figure f : d.getFigures()) {
             boolean saved = false;
             for (Figure f2 : f.getPredecessors()) {
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/build.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
-<!-- for some information on what you could do (e.g. targets to override). -->
-<!-- If you delete this file and reopen the project it will be recreated. -->
-<project name="com.sun.hotspot.igv.graphtexteditor" default="netbeans" basedir=".">
-    <description>Builds, tests, and runs the project com.sun.hotspot.igv.graphtexteditor.</description>
-    <import file="nbproject/build-impl.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/manifest.mf	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-OpenIDE-Module: com.sun.hotspot.igv.graphtexteditor
-OpenIDE-Module-Layer: com/sun/hotspot/igv/graphtexteditor/layer.xml
-OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/graphtexteditor/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.0
-
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/nbproject/build-impl.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-*** GENERATED FROM project.xml - DO NOT EDIT  ***
-***         EDIT ../build.xml INSTEAD         ***
--->
-<project name="com.sun.hotspot.igv.graphtexteditor-impl" basedir="..">
-    <fail message="Please build using Ant 1.7.1 or higher.">
-        <condition>
-            <not>
-                <antversion atleast="1.7.1"/>
-            </not>
-        </condition>
-    </fail>
-    <property file="nbproject/private/suite-private.properties"/>
-    <property file="nbproject/suite.properties"/>
-    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
-    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
-    <property file="${suite.dir}/nbproject/platform.properties"/>
-    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="name"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{name}" value="${@{value}}"/>
-        </sequential>
-    </macrodef>
-    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="property"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{property}" value="@{value}"/>
-        </sequential>
-    </macrodef>
-    <property file="${user.properties.file}"/>
-    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
-        <condition>
-            <not>
-                <contains string="${cluster.path.evaluated}" substring="platform"/>
-            </not>
-        </condition>
-    </fail>
-    <import file="${harness.dir}/build.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/nbproject/genfiles.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=f0880ef0
-nbproject/build-impl.xml.script.CRC32=9388e04e
-nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/nbproject/project.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
-    <type>org.netbeans.modules.apisupport.project</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
-            <code-name-base>com.sun.hotspot.igv.graphtexteditor</code-name-base>
-            <suite-component/>
-            <module-dependencies>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.data</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.graph</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.graphtotext</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.selectioncoordinator</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.structuredtext</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.texteditor</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.util</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.netbeans.modules.diff</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <release-version>1</release-version>
-                        <specification-version>1.32.1.42.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.util</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>7.12.0.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.util.lookup</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>8.6.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.windows</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>6.20</specification-version>
-                    </run-dependency>
-                </dependency>
-            </module-dependencies>
-            <public-packages/>
-        </data>
-    </configuration>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/nbproject/suite.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-suite.dir=${basedir}/..
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/Bundle.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-CTL_TextAction=Text
-CTL_TextTopComponent=Text
-HINT_TextTopComponent=Shows a textual representation of the graph.
-OpenIDE-Module-Name=GraphTextEditor
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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.sun.hotspot.igv.graphtexteditor;
-
-import java.awt.event.ActionEvent;
-import javax.swing.AbstractAction;
-import org.openide.util.NbBundle;
-import org.openide.windows.TopComponent;
-
-/**
- * Action which shows Text component.
- */
-public class TextAction extends AbstractAction {
-
-    public TextAction() {
-        super(NbBundle.getMessage(TextAction.class, "CTL_TextAction"));
-    }
-
-    public void actionPerformed(ActionEvent evt) {
-        TopComponent win = TextTopComponent.findInstance();
-        win.open();
-        win.requestActive();
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextTopComponent.form	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<?xml version="1.1" encoding="UTF-8" ?>
-
-<Form version="1.4" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
-  <AuxValues>
-    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
-    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
-    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
-    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
-    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
-    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
-    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
-    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
-    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
-    <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
-  </AuxValues>
-
-  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
-</Form>
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextTopComponent.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,440 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.graphtexteditor;
-
-import com.sun.hotspot.igv.data.ChangedListener;
-import com.sun.hotspot.igv.data.Properties;
-import com.sun.hotspot.igv.texteditor.*;
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.data.Pair;
-import com.sun.hotspot.igv.data.Property;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.services.DiagramProvider;
-import com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter;
-import com.sun.hotspot.igv.selectioncoordinator.SelectionCoordinator;
-import com.sun.hotspot.igv.structuredtext.MultiElement;
-import com.sun.hotspot.igv.structuredtext.StructuredText;
-import com.sun.hotspot.igv.util.LookupHistory;
-import java.awt.BorderLayout;
-import java.awt.CardLayout;
-import java.awt.Color;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.io.IOException;
-import java.io.Serializable;
-import java.io.StringReader;
-import java.util.Collection;
-import java.util.logging.Logger;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JSplitPane;
-import javax.swing.JToolBar;
-import org.netbeans.api.diff.Diff;
-import org.netbeans.api.diff.DiffView;
-import org.netbeans.api.diff.StreamSource;
-import org.openide.util.Lookup;
-import org.openide.util.LookupEvent;
-import org.openide.util.LookupListener;
-import org.openide.util.NbBundle;
-import org.openide.util.Utilities;
-import org.openide.windows.TopComponent;
-import org.openide.windows.WindowManager;
-
-/**
- * @author Thomas Wuerthinger
- * @author Peter Hofer
- */
-final class TextTopComponent extends TopComponent implements LookupListener {
-
-    private static TextTopComponent instance;
-    private Lookup.Result result = null;
-    private static final String PREFERRED_ID = "TextTopComponent";
-    private Diagram lastDiagram;
-    private TextEditor leftEditor;
-    private TextEditor rightEditor;
-    private TextEditor singleEditor;
-    private JSplitPane splitPane;
-    private CardLayout cardLayout;
-    private JPanel cardLayoutPanel;
-    private JComboBox sourceCombo;
-    private boolean firstTimeSplitter = true;
-    private JPanel textDiffPanel;
-
-    private static final String TWO_GRAPHS_TEXT_DIFF = "twoGraphsTextDiff";
-    private static final String TWO_GRAPHS = "twoGraphs";
-    private static final String ONE_GRAPH = "oneGraph";
-    private static final String NO_GRAPH = "noGraph";
-
-    private static final String GRAPH_TEXT_REPRESENTATION = "< Graph Text Representation >";
-
-    private DiagramProvider currentDiagramProvider;
-
-    private TextTopComponent() {
-        initComponents();
-        setName(NbBundle.getMessage(TextTopComponent.class, "CTL_TextTopComponent"));
-        setToolTipText(NbBundle.getMessage(TextTopComponent.class, "HINT_TextTopComponent"));
-
-        setLayout(new BorderLayout());
-
-        // Selector for displayed data
-        JToolBar sourceSelectBar = new JToolBar();
-        sourceSelectBar.setLayout(new BorderLayout());
-        sourceSelectBar.setFloatable(false);
-        sourceSelectBar.add(new JLabel("Show: "), BorderLayout.WEST);
-        sourceCombo = new JComboBox();
-        sourceCombo.addItem(GRAPH_TEXT_REPRESENTATION);
-        sourceCombo.addItemListener(sourceSelectionListener);
-        sourceSelectBar.add(sourceCombo, BorderLayout.CENTER);
-        add(sourceSelectBar, BorderLayout.NORTH);
-
-        // Card layout for three different views.
-        cardLayout = new CardLayout();
-        cardLayoutPanel = new JPanel(cardLayout);
-        add(cardLayoutPanel, BorderLayout.CENTER);
-
-        // No graph selected.
-        JLabel noGraphLabel = new JLabel("No graph open.", JLabel.CENTER);
-        noGraphLabel.setOpaque(true);
-        noGraphLabel.setBackground(Color.WHITE);
-        cardLayoutPanel.add(noGraphLabel, NO_GRAPH);
-
-        // Single graph selected.
-        singleEditor = new TextEditor();
-        cardLayoutPanel.add(singleEditor.getComponent(), ONE_GRAPH);
-
-        // Graph difference => show split pane with two graphs.
-        splitPane = new JSplitPane();
-        leftEditor = new TextEditor();
-        rightEditor = new TextEditor();
-        // Work around a problem with JSplitPane and the NetBeans editor:
-        // setDividerLocation() doesn't work when the split pane has not been
-        // layouted and painted yet. JSplitPane then initially uses a tiny width
-        // for the left editor component, which causes the editor to calculate
-        // invalid offsets and constantly throw exceptions, particularly on
-        // mouse events. Thus, defer adding the two components and setting the
-        // divider's location.
-        splitPane.addComponentListener(new ComponentAdapter() {
-            @Override
-            public void componentResized(ComponentEvent e) {
-                if (firstTimeSplitter && splitPane.getWidth() > 0) {
-                    splitPane.setLeftComponent(leftEditor.getComponent());
-                    splitPane.setRightComponent(rightEditor.getComponent());
-                    splitPane.setDividerLocation(0.5);
-                    firstTimeSplitter = false;
-                }
-            }
-        });
-        cardLayoutPanel.add(splitPane, TWO_GRAPHS);
-        
-        // Text difference => NetBeans diff view
-        // Diff component is created and added on demand
-        textDiffPanel = new JPanel(new BorderLayout());
-        cardLayoutPanel.add(textDiffPanel, TWO_GRAPHS_TEXT_DIFF);
-    }
-
-
-    private StructuredText convert(InputGraph graph, Diagram diagram) {
-        Collection<? extends GraphToTextConverter> converters = Lookup.getDefault().lookupAll(GraphToTextConverter.class);
-        StructuredText text = null;
-        if (converters.size() == 0) {
-            text = new StructuredText(graph.getName());
-            text.println("No graph-to-text converter exists!");
-            return text;
-        }
-
-        for (GraphToTextConverter converter : converters) {
-            if (converter.canConvert(graph)) {
-                text = converter.convert(graph, diagram);
-                if (text == null) {
-                    text = new StructuredText(graph.getName());
-                    text.println("Class " + converter.getClass().getName() + " misbehaved and returned null on graph-to-text conversion!");
-                }
-                return text;
-            }
-        }
-
-        text = new StructuredText(graph.getName());
-        text.println("No appropriate graph-to-text converter found!");
-        return text;
-    }
-
-    private StructuredText createStructuredPlainText(String name, String text) {
-        StructuredText structured = new StructuredText(name);
-        MultiElement multi = new MultiElement();
-        multi.print(text);
-        structured.addChild(multi);
-        return structured;
-    }
-
-    private ItemListener sourceSelectionListener = new ItemListener() {
-        public void itemStateChanged(ItemEvent e) {
-            if (e.getStateChange() == ItemEvent.SELECTED) {
-                if (e.getItem() == GRAPH_TEXT_REPRESENTATION) {
-                    displayDiagram(lastDiagram);
-                } else {
-                    displayGroupProperty(lastDiagram, (String) e.getItem());
-                }
-            }
-        }
-    };
-
-    private void setDiagram(Diagram diagram) {
-        if (diagram == lastDiagram) {
-            // No change => return.
-            return;
-        }
-        lastDiagram = diagram;
-
-        // Rebuild combobox choices
-        Object selection = sourceCombo.getSelectedItem();
-        sourceCombo.removeAllItems();
-        // NOTE: addItem() makes the first inserted item the selected item,
-        //       so use insertItemAt() instead
-        sourceCombo.insertItemAt(GRAPH_TEXT_REPRESENTATION, 0);
-        if (diagram != null) {
-            if (diagram.getGraph().getSourceGraphs() != null) {
-                // Diff graph with source graphs with possibly different groups:
-                // show properties from both graphs
-                Pair<InputGraph, InputGraph> sourceGraphs = diagram.getGraph().getSourceGraphs();
-                Properties props = new Properties(sourceGraphs.getLeft().getGroup().getProperties());
-                if (sourceGraphs.getLeft().getGroup() != sourceGraphs.getRight().getGroup()) {
-                    props.add(sourceGraphs.getRight().getGroup().getProperties());
-                }
-                for (Property p : props) {
-                    sourceCombo.addItem(p.getName());
-                }
-            } else {
-                // Single graph
-                for (Property p : diagram.getGraph().getGroup().getProperties()) {
-                    sourceCombo.addItem(p.getName());
-                }
-            }
-        }
-        // NOTE: The following triggers a display update.
-        sourceCombo.setSelectedItem(selection);
-        if (sourceCombo.getSelectedItem() == null) {
-            // previously selected property doesn't exist in new graph's group:
-            // default to show graph representation
-            sourceCombo.setSelectedItem(GRAPH_TEXT_REPRESENTATION);
-        }
-    }
-
-    private void displayGroupProperty(Diagram diagram, String property) {
-        if (diagram == null) {
-            showCard(NO_GRAPH);
-        } else if (diagram.getGraph().getSourceGraphs() != null) {
-            showCard(TWO_GRAPHS_TEXT_DIFF);
-            textDiffPanel.removeAll();
-            try {
-                Pair<InputGraph, InputGraph> sourceGraphs = diagram.getGraph().getSourceGraphs();
-
-                String ltext = sourceGraphs.getLeft().getGroup().getProperties().get(property);
-                if (ltext == null) {
-                    ltext = "";
-                }
-                StreamSource leftsrc = StreamSource.createSource("left", sourceGraphs.getLeft().getName(), "text/plain", new StringReader(ltext));
-
-                String rtext = sourceGraphs.getRight().getGroup().getProperties().get(property);
-                if (rtext == null) {
-                    rtext = "";
-                }
-                StreamSource rightsrc = StreamSource.createSource("right", sourceGraphs.getRight().getName(), "text/plain", new StringReader(rtext));
-
-                DiffView view = Diff.getDefault().createDiff(leftsrc, rightsrc);
-                textDiffPanel.add(view.getComponent(), BorderLayout.CENTER);
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
-            textDiffPanel.revalidate(); // required when card was visible before
-        } else {
-            showCard(ONE_GRAPH);
-            String text = diagram.getGraph().getGroup().getProperties().get(property);
-            singleEditor.setStructuredText(createStructuredPlainText(diagram.getGraph().getName(), text));
-        }
-    }
-
-    private void displayDiagram(Diagram diagram) {
-        if (diagram == null) {
-            showCard(NO_GRAPH);
-        } /* This side-by-side view of the source graphs for diff graphs doesn't
-           * work properly because nodes that exist only in graph B (the 'new'
-           * graph) are in most cases assigned different ids.
-
-            else if (diagram.getGraph().getSourceGraphs() != null) {
-            showCard(TWO_GRAPHS);
-            Pair<InputGraph, InputGraph> graphs = diagram.getGraph().getSourceGraphs();
-            leftEditor.setStructuredText(convert(graphs.getLeft(), diagram));
-            rightEditor.setStructuredText(convert(graphs.getRight(), diagram));
-
-            // TODO: Hack to update view - remove
-            SelectionCoordinator.getInstance().getHighlightedChangedEvent().fire();
-        } */
-        else {
-            showCard(ONE_GRAPH);
-            StructuredText text = convert(diagram.getGraph(), diagram);
-            singleEditor.setStructuredText(text);
-
-            // TODO: Hack to update view - remove
-            SelectionCoordinator.getInstance().getHighlightedChangedEvent().fire();
-        }
-    }
-
-    private ChangedListener<DiagramProvider> diagramChangedListener = new ChangedListener<DiagramProvider>() {
-
-        public void changed(DiagramProvider source) {
-            setDiagram(source.getDiagram());
-        }
-        
-    };
-
-    private void setDiagramProvider(DiagramProvider provider) {
-        if (provider == currentDiagramProvider) {
-            return;
-        }
-
-        if (currentDiagramProvider != null) {
-            currentDiagramProvider.getChangedEvent().removeListener(diagramChangedListener);
-        }
-
-        currentDiagramProvider = provider;
-
-        if (currentDiagramProvider != null) {
-            currentDiagramProvider.getChangedEvent().addListener(diagramChangedListener);
-            setDiagram(currentDiagramProvider.getDiagram());
-        } else {
-            setDiagram(null);
-        }
-    }
-
-    private void showCard(final String card) {
-        cardLayout.show(cardLayoutPanel, card);
-    }
-
-    public void resultChanged(LookupEvent lookupEvent) {
-        DiagramProvider p = Utilities.actionsGlobalContext().lookup(DiagramProvider.class);
-
-        if (p == null) {
-            p = LookupHistory.getLast(DiagramProvider.class);
-        }
-
-        setDiagramProvider(p);
-    }
-
-    /** This method is called from within the constructor to
-     * initialize the form.
-     * WARNING: Do NOT modify this code. The content of this method is
-     * always regenerated by the Form Editor.
-     */
-    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
-    private void initComponents() {
-
-        setLayout(new java.awt.BorderLayout());
-    }// </editor-fold>//GEN-END:initComponents
-
-
-    // Variables declaration - do not modify//GEN-BEGIN:variables
-    // End of variables declaration//GEN-END:variables
-    /**
-     * Gets default instance. Do not use directly: reserved for *.settings files only,
-     * i.e. deserialization routines; otherwise you could get a non-deserialized instance.
-     * To obtain the singleton instance, use {@link findInstance}.
-     */
-    public static synchronized TextTopComponent getDefault() {
-        if (instance == null) {
-            instance = new TextTopComponent();
-        }
-        return instance;
-    }
-
-    /**
-     * Obtain the TextTopComponent instance. Never call {@link #getDefault} directly!
-     */
-    public static synchronized TextTopComponent findInstance() {
-        TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
-        if (win == null) {
-            Logger.getLogger(TextTopComponent.class.getName()).warning(
-                    "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
-            return getDefault();
-        }
-        if (win instanceof TextTopComponent) {
-            return (TextTopComponent) win;
-        }
-        Logger.getLogger(TextTopComponent.class.getName()).warning(
-                "There seem to be multiple components with the '" + PREFERRED_ID +
-                "' ID. That is a potential source of errors and unexpected behavior.");
-        return getDefault();
-    }
-
-    @Override
-    public int getPersistenceType() {
-        return TopComponent.PERSISTENCE_ALWAYS;
-    }
-
-    @Override
-    public void componentOpened() {
-
-        DiagramProvider p = LookupHistory.getLast(DiagramProvider.class);
-        setDiagramProvider(p);
-
-        Lookup.Template<DiagramProvider> tpl = new Lookup.Template<DiagramProvider>(DiagramProvider.class);
-        result = Utilities.actionsGlobalContext().lookup(tpl);
-        result.addLookupListener(this);
-    }
-
-    @Override
-    public void componentClosed() {
-        result.removeLookupListener(this);
-        result = null;
-        setDiagramProvider(null);
-    }
-
-    /** replaces this in object stream */
-    @Override
-    public Object writeReplace() {
-        return new ResolvableHelper();
-    }
-
-    @Override
-    protected String preferredID() {
-        return PREFERRED_ID;
-    }
-
-    @Override
-    public void requestActive() {
-        super.requestActive();
-        cardLayoutPanel.requestFocus();
-    }
-
-    final static class ResolvableHelper implements Serializable {
-
-        private static final long serialVersionUID = 1L;
-
-        public Object readResolve() {
-            return TextTopComponent.getDefault();
-        }
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextTopComponentSettings.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-To change this template, choose Tools | Templates
-and open the template in the editor.
--->
-<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
-<settings version="1.0">
-    <module name="com.sun.hotspot.igv.graphtexteditor" spec="1.0"/>
-    <instanceof class="org.openide.windows.TopComponent"/>
-    <instanceof class="com.sun.hotspot.igv.graphtexteditor.TextTopComponent"/>
-    <instance class="com.sun.hotspot.igv.graphtexteditor.TextTopComponent" method="getDefault"/>
-</settings>
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextTopComponentWstcref.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-To change this template, choose Tools | Templates
-and open the template in the editor.
--->
-<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd">
-<tc-ref version="2.0" >
-    <module name="com.sun.hotspot.igv.graphtexteditor" spec="1.0"/>
-    <tc-id id="TextTopComponent"/>
-    <state opened="true"/>
-</tc-ref>
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/layer.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
-<filesystem>
-    <folder name="Actions">
-        <folder name="Window">
-            <file name="com-sun-hotspot-igv-graphtexteditor-TextAction.instance"/>
-        </folder>
-    </folder>
-    <folder name="Menu">
-        <folder name="Window">
-            <file name="TextAction.shadow">
-                <attr name="originalFile" stringvalue="Actions/Window/com-sun-hotspot-igv-graphtexteditor-TextAction.instance"/>
-            </file>
-        </folder>
-    </folder>
-    <folder name="Windows2">
-        <folder name="Components">
-            <file name="TextTopComponent.settings" url="TextTopComponentSettings.xml"/>
-        </folder>
-        <folder name="Modes">
-            <folder name="customRightTopMode">
-                <file name="TextTopComponent.wstcref" url="TextTopComponentWstcref.xml"/>
-            </folder>
-        </folder>
-    </folder>
-    
-</filesystem>
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/build.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
-<!-- for some information on what you could do (e.g. targets to override). -->
-<!-- If you delete this file and reopen the project it will be recreated. -->
-<project name="com.sun.hotspot.igv.graphtotext" default="netbeans" basedir=".">
-    <description>Builds, tests, and runs the project com.sun.hotspot.igv.graphtotext.</description>
-    <import file="nbproject/build-impl.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/manifest.mf	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-OpenIDE-Module: com.sun.hotspot.igv.graphtotext
-OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/graphtotext/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.0
-
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/nbproject/build-impl.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-*** GENERATED FROM project.xml - DO NOT EDIT  ***
-***         EDIT ../build.xml INSTEAD         ***
--->
-<project name="com.sun.hotspot.igv.graphtotext-impl" basedir="..">
-    <fail message="Please build using Ant 1.7.1 or higher.">
-        <condition>
-            <not>
-                <antversion atleast="1.7.1"/>
-            </not>
-        </condition>
-    </fail>
-    <property file="nbproject/private/suite-private.properties"/>
-    <property file="nbproject/suite.properties"/>
-    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
-    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
-    <property file="${suite.dir}/nbproject/platform.properties"/>
-    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="name"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{name}" value="${@{value}}"/>
-        </sequential>
-    </macrodef>
-    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="property"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{property}" value="@{value}"/>
-        </sequential>
-    </macrodef>
-    <property file="${user.properties.file}"/>
-    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
-        <condition>
-            <not>
-                <contains string="${cluster.path.evaluated}" substring="platform"/>
-            </not>
-        </condition>
-    </fail>
-    <import file="${harness.dir}/build.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/nbproject/genfiles.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=10eff8f6
-nbproject/build-impl.xml.script.CRC32=b176ca1a
-nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/nbproject/platform.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-cluster.path=\
-    ${nbplatform.active.dir}/ide:\
-    ${nbplatform.active.dir}/platform
-disabled.modules=\
-    org.apache.xml.resolver,\
-    org.mozilla.rhino.patched,\
-    org.netbeans.api.debugger,\
-    org.netbeans.api.java.classpath,\
-    org.netbeans.api.xml,\
-    org.netbeans.core.browser,\
-    org.netbeans.core.execution,\
-    org.netbeans.core.ide,\
-    org.netbeans.core.multiview,\
-    org.netbeans.lib.cvsclient,\
-    org.netbeans.lib.terminalemulator,\
-    org.netbeans.libs.antlr3.runtime,\
-    org.netbeans.libs.bugtracking,\
-    org.netbeans.libs.bugzilla,\
-    org.netbeans.libs.bytelist,\
-    org.netbeans.libs.commons_codec,\
-    org.netbeans.libs.commons_logging,\
-    org.netbeans.libs.commons_net,\
-    org.netbeans.libs.freemarker,\
-    org.netbeans.libs.ini4j,\
-    org.netbeans.libs.jakarta_oro,\
-    org.netbeans.libs.jaxb,\
-    org.netbeans.libs.jsch,\
-    org.netbeans.libs.jsr223,\
-    org.netbeans.libs.jvyamlb,\
-    org.netbeans.libs.jzlib,\
-    org.netbeans.libs.lucene,\
-    org.netbeans.libs.smack,\
-    org.netbeans.libs.svnClientAdapter,\
-    org.netbeans.libs.svnClientAdapter.javahl,\
-    org.netbeans.libs.svnClientAdapter.svnkit,\
-    org.netbeans.libs.swingx,\
-    org.netbeans.libs.xerces,\
-    org.netbeans.modules.autoupdate.services,\
-    org.netbeans.modules.autoupdate.ui,\
-    org.netbeans.modules.bugtracking,\
-    org.netbeans.modules.bugtracking.bridge,\
-    org.netbeans.modules.bugzilla,\
-    org.netbeans.modules.core.kit,\
-    org.netbeans.modules.csl.api,\
-    org.netbeans.modules.css.editor,\
-    org.netbeans.modules.css.visual,\
-    org.netbeans.modules.db,\
-    org.netbeans.modules.db.core,\
-    org.netbeans.modules.db.dataview,\
-    org.netbeans.modules.db.drivers,\
-    org.netbeans.modules.db.kit,\
-    org.netbeans.modules.db.metadata.model,\
-    org.netbeans.modules.db.mysql,\
-    org.netbeans.modules.db.sql.editor,\
-    org.netbeans.modules.db.sql.visualeditor,\
-    org.netbeans.modules.dbapi,\
-    org.netbeans.modules.defaults,\
-    org.netbeans.modules.derby,\
-    org.netbeans.modules.diff,\
-    org.netbeans.modules.dlight.nativeexecution,\
-    org.netbeans.modules.dlight.terminal,\
-    org.netbeans.modules.editor.bookmarks,\
-    org.netbeans.modules.editor.bracesmatching,\
-    org.netbeans.modules.editor.codetemplates,\
-    org.netbeans.modules.editor.completion,\
-    org.netbeans.modules.editor.errorstripe,\
-    org.netbeans.modules.editor.errorstripe.api,\
-    org.netbeans.modules.editor.guards,\
-    org.netbeans.modules.editor.indent.project,\
-    org.netbeans.modules.editor.kit,\
-    org.netbeans.modules.editor.macros,\
-    org.netbeans.modules.editor.plain,\
-    org.netbeans.modules.editor.plain.lib,\
-    org.netbeans.modules.editor.structure,\
-    org.netbeans.modules.extbrowser,\
-    org.netbeans.modules.extexecution,\
-    org.netbeans.modules.extexecution.destroy,\
-    org.netbeans.modules.favorites,\
-    org.netbeans.modules.glassfish.common,\
-    org.netbeans.modules.gototest,\
-    org.netbeans.modules.gsf.codecoverage,\
-    org.netbeans.modules.gsf.testrunner,\
-    org.netbeans.modules.html,\
-    org.netbeans.modules.html.editor,\
-    org.netbeans.modules.html.editor.lib,\
-    org.netbeans.modules.html.lexer,\
-    org.netbeans.modules.html.parser,\
-    org.netbeans.modules.html.validation,\
-    org.netbeans.modules.httpserver,\
-    org.netbeans.modules.hudson,\
-    org.netbeans.modules.hudson.mercurial,\
-    org.netbeans.modules.hudson.subversion,\
-    org.netbeans.modules.ide.kit,\
-    org.netbeans.modules.image,\
-    org.netbeans.modules.javascript.editing,\
-    org.netbeans.modules.javascript.hints,\
-    org.netbeans.modules.javascript.kit,\
-    org.netbeans.modules.javascript.refactoring,\
-    org.netbeans.modules.jellytools.ide,\
-    org.netbeans.modules.jumpto,\
-    org.netbeans.modules.languages,\
-    org.netbeans.modules.languages.diff,\
-    org.netbeans.modules.languages.manifest,\
-    org.netbeans.modules.languages.yaml,\
-    org.netbeans.modules.lexer.nbbridge,\
-    org.netbeans.modules.localhistory,\
-    org.netbeans.modules.mercurial,\
-    org.netbeans.modules.options.editor,\
-    org.netbeans.modules.parsing.api,\
-    org.netbeans.modules.parsing.lucene,\
-    org.netbeans.modules.print.editor,\
-    org.netbeans.modules.project.ant,\
-    org.netbeans.modules.project.libraries,\
-    org.netbeans.modules.projectapi,\
-    org.netbeans.modules.projectui,\
-    org.netbeans.modules.projectui.buildmenu,\
-    org.netbeans.modules.projectuiapi,\
-    org.netbeans.modules.properties,\
-    org.netbeans.modules.properties.syntax,\
-    org.netbeans.modules.refactoring.api,\
-    org.netbeans.modules.schema2beans,\
-    org.netbeans.modules.server,\
-    org.netbeans.modules.servletapi,\
-    org.netbeans.modules.spellchecker,\
-    org.netbeans.modules.spellchecker.apimodule,\
-    org.netbeans.modules.spellchecker.bindings.htmlxml,\
-    org.netbeans.modules.spellchecker.bindings.properties,\
-    org.netbeans.modules.spellchecker.dictionary_en,\
-    org.netbeans.modules.spellchecker.kit,\
-    org.netbeans.modules.subversion,\
-    org.netbeans.modules.swing.validation,\
-    org.netbeans.modules.target.iterator,\
-    org.netbeans.modules.tasklist.kit,\
-    org.netbeans.modules.tasklist.projectint,\
-    org.netbeans.modules.tasklist.todo,\
-    org.netbeans.modules.tasklist.ui,\
-    org.netbeans.modules.terminal,\
-    org.netbeans.modules.usersguide,\
-    org.netbeans.modules.utilities,\
-    org.netbeans.modules.utilities.project,\
-    org.netbeans.modules.versioning,\
-    org.netbeans.modules.versioning.indexingbridge,\
-    org.netbeans.modules.versioning.system.cvss,\
-    org.netbeans.modules.versioning.util,\
-    org.netbeans.modules.web.client.tools.api,\
-    org.netbeans.modules.web.common,\
-    org.netbeans.modules.xml,\
-    org.netbeans.modules.xml.axi,\
-    org.netbeans.modules.xml.catalog,\
-    org.netbeans.modules.xml.core,\
-    org.netbeans.modules.xml.jaxb.api,\
-    org.netbeans.modules.xml.lexer,\
-    org.netbeans.modules.xml.multiview,\
-    org.netbeans.modules.xml.retriever,\
-    org.netbeans.modules.xml.schema.completion,\
-    org.netbeans.modules.xml.schema.model,\
-    org.netbeans.modules.xml.tax,\
-    org.netbeans.modules.xml.text,\
-    org.netbeans.modules.xml.tools,\
-    org.netbeans.modules.xml.wsdl.model,\
-    org.netbeans.modules.xml.xam,\
-    org.netbeans.modules.xml.xdm,\
-    org.netbeans.modules.xsl,\
-    org.netbeans.spi.debugger.ui,\
-    org.netbeans.spi.editor.hints,\
-    org.netbeans.spi.navigator,\
-    org.netbeans.spi.palette,\
-    org.netbeans.spi.tasklist,\
-    org.netbeans.spi.viewmodel,\
-    org.netbeans.swing.dirchooser,\
-    org.openide.compat,\
-    org.openide.execution,\
-    org.openide.options,\
-    org.openide.util.enumerations
-nbplatform.active=default
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/nbproject/project.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
-    <type>org.netbeans.modules.apisupport.project</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
-            <code-name-base>com.sun.hotspot.igv.graphtotext</code-name-base>
-            <suite-component/>
-            <module-dependencies>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.data</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.graph</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.structuredtext</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-            </module-dependencies>
-            <public-packages>
-                <package>com.sun.hotspot.igv.graphtotext</package>
-                <package>com.sun.hotspot.igv.graphtotext.services</package>
-            </public-packages>
-        </data>
-    </configuration>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/nbproject/suite.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-suite.dir=${basedir}/..
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/src/com/sun/hotspot/igv/graphtotext/BFSGraphToTextConverter.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +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.sun.hotspot.igv.graphtotext;
-
-import com.sun.hotspot.igv.data.InputEdge;
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.data.Pair;
-import com.sun.hotspot.igv.data.Properties;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graphtotext.services.GraphToTextVisitor;
-import com.sun.hotspot.igv.structuredtext.Element;
-import com.sun.hotspot.igv.structuredtext.StructuredText;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-import java.util.Set;
-
-/**
- *
- * @author Thomas
- */
-public class BFSGraphToTextConverter {
-    
-    private GraphToTextVisitor visitor;
-    private Map<Properties.PropertyMatcher, GraphToTextVisitor> visitorMap;
-    private InputGraph graph;
-    private Diagram diagram;
-    
-    public BFSGraphToTextConverter(GraphToTextVisitor visitor) {
-        this.visitor = visitor;
-        visitorMap = new HashMap<Properties.PropertyMatcher, GraphToTextVisitor>();
-    }
-    
-    public void registerVisitor(GraphToTextVisitor visitor, Properties.PropertyMatcher matcher) {
-        visitorMap.put(matcher, visitor);
-    }
-    
-    private GraphToTextVisitor chooseVisitor(GraphToTextVisitor defaultVisitor, InputNode node) {
-        for(Properties.PropertyMatcher matcher : visitorMap.keySet()) {
-            if(node.getProperties().selectSingle(matcher) != null) {
-                return visitorMap.get(matcher);
-            }
-        }
-        
-        return defaultVisitor;
-    }
-
-    private Element cyclicVisit(GraphToTextVisitor visitor, InputNode node, List<InputEdge> path) {
-        return chooseVisitor(visitor, node).cyclicVisit(node, path);
-    }
-    
-    private Element visit(GraphToTextVisitor visitor, InputNode node, List<InputEdge> path, List<Pair<InputEdge, Element>> children) {
-        return chooseVisitor(visitor, node).visit(node, path, children);
-    }
-    
-    protected Diagram getDiagram() {
-        return diagram;
-    }
-    
-    public StructuredText convert(InputGraph graph, Diagram diagram) {
-        
-        this.graph = graph;
-        this.diagram = diagram;
-        StructuredText text = new StructuredText(graph.getName());
-        
-        Map<InputNode, List<InputEdge>> outgoing = graph.findAllOutgoingEdges();
-        Map<InputNode, List<InputEdge>> pathMap = new HashMap<InputNode, List<InputEdge>>();
-        Queue<InputNode> queue = new LinkedList<InputNode>();
-        List<InputNode> rootNodes = graph.findRootNodes();
-        queue.addAll(rootNodes);
-        for(InputNode node : rootNodes) {
-            pathMap.put(node, new ArrayList<InputEdge>());
-        }
-        
-        Set<InputNode> visited = new HashSet<InputNode>();
-        visited.addAll(rootNodes);
-        
-        Set<InputEdge> fullEdges = new HashSet<InputEdge>();
-        List<InputNode> visitOrder = new ArrayList<InputNode>();
-        while(!queue.isEmpty()) {
-            
-            InputNode current = queue.remove();
-            visitOrder.add(current);
-            List<InputEdge> path = pathMap.get(current);
-            
-            List<InputEdge> edges = outgoing.get(current);
-            for(InputEdge e : edges) {
-                InputNode dest = graph.getNode(e.getTo());
-                if(!visited.contains(dest)) {
-                    queue.add(dest);
-                    visited.add(dest);
-                    List<InputEdge> curPath = new ArrayList<InputEdge>(path);
-                    curPath.add(e);
-                    pathMap.put(dest, curPath);
-                    fullEdges.add(e);
-                }
-            }
-        }
-        
-        
-        
-        Map<InputNode, Element> fullVisitCache = new HashMap<InputNode, Element>();
-        for(int i=visitOrder.size() - 1; i>=0; i--) {
-            InputNode current = visitOrder.get(i);
-            List<InputEdge> path = pathMap.get(current);
-            List<InputEdge> edges = outgoing.get(current);
-            List<Pair<InputEdge, Element>> list = new ArrayList<Pair<InputEdge, Element>>();
-            for(InputEdge e : edges) {
-                if(fullEdges.contains(e)) {
-                    assert fullVisitCache.containsKey(graph.getNode(e.getTo()));
-                    list.add(new Pair<InputEdge, Element>(e, fullVisitCache.get(graph.getNode(e.getTo()))));
-                } else {
-//                    assert fullVisitCache.containsKey(graph.getNode(e.getTo()));
-                    List<InputEdge> curPath = new ArrayList<InputEdge>(path);
-                    curPath.add(e);
-                    list.add(new Pair<InputEdge, Element>(e, cyclicVisit(visitor, graph.getNode(e.getTo()), curPath)));
-                }
-            }
-            
-            Element e = visit(visitor, current, pathMap.get(current), list);
-            fullVisitCache.put(current, e);
-        }
-        
-        for(InputNode node : rootNodes) {
-            text.addChild(fullVisitCache.get(node));
-        }
-        
-        return text;
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/src/com/sun/hotspot/igv/graphtotext/Bundle.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-OpenIDE-Module-Name=GraphToText
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/src/com/sun/hotspot/igv/graphtotext/services/AbstractGraphToTextVisitor.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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.sun.hotspot.igv.graphtotext.services;
-
-import com.sun.hotspot.igv.data.InputEdge;
-import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.data.Pair;
-import com.sun.hotspot.igv.structuredtext.Element;
-import com.sun.hotspot.igv.structuredtext.SimpleElement;
-import java.util.List;
-
-/**
- *
- * @author Thomas
- */
-public class AbstractGraphToTextVisitor implements GraphToTextVisitor {
-
-    public Element cyclicVisit(InputNode node, List<InputEdge> path) {
-        return SimpleElement.EMPTY;
-    }
-
-    public Element visit(InputNode node, List<InputEdge> path, List<Pair<InputEdge, Element>> children) {
-        return cyclicVisit(node, path);
-    }
-
-}
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/src/com/sun/hotspot/igv/graphtotext/services/GraphToTextConverter.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.graphtotext.services;
-
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.structuredtext.StructuredText;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public interface GraphToTextConverter {
-    StructuredText convert(InputGraph graph, Diagram diagram);
-    boolean canConvert(InputGraph graph);
-}
--- a/src/share/tools/IdealGraphVisualizer/GraphToText/src/com/sun/hotspot/igv/graphtotext/services/GraphToTextVisitor.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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.sun.hotspot.igv.graphtotext.services;
-
-import com.sun.hotspot.igv.data.InputEdge;
-import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.data.Pair;
-import com.sun.hotspot.igv.structuredtext.Element;
-import java.util.List;
-
-/**
- *
- * @author Thomas
- */
-public interface GraphToTextVisitor {
-
-    Element cyclicVisit(InputNode node, List<InputEdge> path);
-    Element visit(InputNode node, List<InputEdge> path, List<Pair<InputEdge, Element>> children);
-}
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterEdge.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.hierarchicallayout;
-
-import com.sun.hotspot.igv.layout.Link;
-import com.sun.hotspot.igv.layout.Port;
-import java.awt.Point;
-import java.util.List;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class ClusterEdge implements Link {
-
-    private ClusterNode from;
-    private ClusterNode to;
-    private List<Point> points;
-
-    public ClusterEdge(ClusterNode from, ClusterNode to) {
-        assert from != null;
-        assert to != null;
-        this.from = from;
-        this.to = to;
-    }
-
-    public Port getTo() {
-        return to.getInputSlot();
-    }
-
-    public Port getFrom() {
-        return from.getInputSlot();
-    }
-
-    public void setControlPoints(List<Point> p) {
-        this.points = p;
-    }
-
-    public List<Point> getControlPoints() {
-        return points;
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterIngoingConnection.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.hierarchicallayout;
-
-import com.sun.hotspot.igv.layout.Link;
-import com.sun.hotspot.igv.layout.Port;
-import java.awt.Point;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class ClusterIngoingConnection implements Link {
-
-    private List<Point> controlPoints;
-    private ClusterInputSlotNode inputSlotNode;
-    private Link connection;
-    private Port inputSlot;
-    private Port outputSlot;
-
-    public ClusterIngoingConnection(ClusterInputSlotNode inputSlotNode, Link c) {
-        this.inputSlotNode = inputSlotNode;
-        this.connection = c;
-        this.controlPoints = new ArrayList<Point>();
-
-        inputSlot = c.getTo();
-        outputSlot = inputSlotNode.getOutputSlot();
-    }
-
-    public Link getConnection() {
-        return connection;
-    }
-
-    public ClusterInputSlotNode getInputSlotNode() {
-        return inputSlotNode;
-    }
-
-    public Port getTo() {
-        return inputSlot;
-    }
-
-    public Port getFrom() {
-        return outputSlot;
-    }
-
-    public void setControlPoints(List<Point> p) {
-        this.controlPoints = p;
-    }
-
-    public List<Point> getControlPoints() {
-        return controlPoints;
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterInputSlotNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.hierarchicallayout;
-
-import com.sun.hotspot.igv.layout.Cluster;
-import com.sun.hotspot.igv.layout.Port;
-import com.sun.hotspot.igv.layout.Vertex;
-import java.awt.Dimension;
-import java.awt.Point;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class ClusterInputSlotNode implements Vertex {
-
-    private final int SIZE = 0;
-    private Point position;
-    private Port inputSlot;
-    private Port outputSlot;
-    private ClusterNode blockNode;
-    private InterClusterConnection interBlockConnection;
-    private Cluster cluster;
-    private ClusterIngoingConnection conn;
-
-    public void setIngoingConnection(ClusterIngoingConnection c) {
-        conn = c;
-    }
-
-    public ClusterIngoingConnection getIngoingConnection() {
-        return conn;
-    }
-    private String id;
-
-    @Override
-    public String toString() {
-        return id;
-    }
-
-    public ClusterInputSlotNode(ClusterNode n, String id) {
-        this.blockNode = n;
-        this.id = id;
-
-        n.addSubNode(this);
-
-        final Vertex thisNode = this;
-        final ClusterNode thisBlockNode = blockNode;
-
-        outputSlot = new Port() {
-
-            public Point getRelativePosition() {
-                return new Point(0, 0);
-            }
-
-            public Vertex getVertex() {
-                return thisNode;
-            }
-
-            @Override
-            public String toString() {
-                return "OutPort of " + thisNode.toString();
-            }
-        };
-
-        inputSlot = new Port() {
-
-            public Point getRelativePosition() {
-                Point p = new Point(thisNode.getPosition());
-                p.x += ClusterNode.BORDER;
-                p.y = 0;
-                return p;
-            }
-
-            public Vertex getVertex() {
-                return thisBlockNode;
-            }
-
-            @Override
-            public String toString() {
-                return "InPort of " + thisNode.toString();
-            }
-        };
-    }
-
-    public Port getInputSlot() {
-        return inputSlot;
-    }
-
-    public InterClusterConnection getInterBlockConnection() {
-        return interBlockConnection;
-    }
-
-    public Port getOutputSlot() {
-        return outputSlot;
-    }
-
-    public Dimension getSize() {
-        return new Dimension(SIZE, SIZE);
-    }
-
-    public void setPosition(Point p) {
-        this.position = p;
-    }
-
-    public Point getPosition() {
-        return position;
-    }
-
-    public void setInterBlockConnection(InterClusterConnection interBlockConnection) {
-        this.interBlockConnection = interBlockConnection;
-    }
-
-    public Cluster getCluster() {
-        return cluster;
-    }
-
-    public boolean isRoot() {
-        return true;
-    }
-
-    public int compareTo(Vertex o) {
-        return toString().compareTo(o.toString());
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.hierarchicallayout;
-
-import com.sun.hotspot.igv.layout.Cluster;
-import com.sun.hotspot.igv.layout.Link;
-import com.sun.hotspot.igv.layout.Port;
-import com.sun.hotspot.igv.layout.Vertex;
-import java.awt.Dimension;
-import java.awt.Point;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class ClusterNode implements Vertex {
-
-    private Cluster cluster;
-    private Port inputSlot;
-    private Port outputSlot;
-    private Set<Vertex> subNodes;
-    private Dimension size;
-    private Point position;
-    private Set<Link> subEdges;
-    private boolean dirty;
-    private boolean root;
-    private String name;
-    public static final int BORDER = 20;
-
-    public ClusterNode(Cluster cluster, String name) {
-        this.subNodes = new HashSet<Vertex>();
-        this.subEdges = new HashSet<Link>();
-        this.cluster = cluster;
-        position = new Point(0, 0);
-        this.name = name;
-    }
-
-    public void addSubNode(Vertex v) {
-        subNodes.add(v);
-    }
-
-    public void addSubEdge(Link l) {
-        subEdges.add(l);
-    }
-
-    public Set<Link> getSubEdges() {
-        return Collections.unmodifiableSet(subEdges);
-    }
-
-    public void updateSize() {
-
-
-        calculateSize();
-
-        final ClusterNode widget = this;
-        inputSlot = new Port() {
-
-            public Point getRelativePosition() {
-                return new Point(size.width / 2, 0);
-            }
-
-            public Vertex getVertex() {
-                return widget;
-            }
-        };
-
-        outputSlot = new Port() {
-
-            public Point getRelativePosition() {
-                return new Point(size.width / 2, 0);//size.height);
-            }
-
-            public Vertex getVertex() {
-                return widget;
-            }
-        };
-    }
-
-    private void calculateSize() {
-
-        if (subNodes.size() == 0) {
-            size = new Dimension(0, 0);
-        }
-
-        int minX = Integer.MAX_VALUE;
-        int maxX = Integer.MIN_VALUE;
-        int minY = Integer.MAX_VALUE;
-        int maxY = Integer.MIN_VALUE;
-
-
-        for (Vertex n : subNodes) {
-            Point p = n.getPosition();
-            minX = Math.min(minX, p.x);
-            minY = Math.min(minY, p.y);
-            maxX = Math.max(maxX, p.x + n.getSize().width);
-            maxY = Math.max(maxY, p.y + n.getSize().height);
-        }
-
-        for (Link l : subEdges) {
-            List<Point> points = l.getControlPoints();
-            for (Point p : points) {
-                if (p != null) {
-                    minX = Math.min(minX, p.x);
-                    maxX = Math.max(maxX, p.x);
-                    minY = Math.min(minY, p.y);
-                    maxY = Math.max(maxY, p.y);
-                }
-            }
-        }
-
-        size = new Dimension(maxX - minX, maxY - minY);
-
-        // Normalize coordinates
-        for (Vertex n : subNodes) {
-            n.setPosition(new Point(n.getPosition().x - minX, n.getPosition().y - minY));
-        }
-
-        for (Link l : subEdges) {
-            List<Point> points = new ArrayList<Point>(l.getControlPoints());
-            for (Point p : points) {
-                p.x -= minX;
-                p.y -= minY;
-            }
-            l.setControlPoints(points);
-
-        }
-
-        size.width += 2 * BORDER;
-        size.height += 2 * BORDER;
-    }
-
-    public Port getInputSlot() {
-        return inputSlot;
-
-    }
-
-    public Port getOutputSlot() {
-        return outputSlot;
-    }
-
-    public Dimension getSize() {
-        return size;
-    }
-
-    public Point getPosition() {
-        return position;
-    }
-
-    public void setPosition(Point pos) {
-
-        this.position = pos;
-        for (Vertex n : subNodes) {
-            Point cur = new Point(n.getPosition());
-            cur.translate(pos.x + BORDER, pos.y + BORDER);
-            n.setPosition(cur);
-        }
-
-        for (Link e : subEdges) {
-            List<Point> arr = e.getControlPoints();
-            ArrayList<Point> newArr = new ArrayList<Point>(arr.size());
-            for (Point p : arr) {
-                if (p != null) {
-                    Point p2 = new Point(p);
-                    p2.translate(pos.x + BORDER, pos.y + BORDER);
-                    newArr.add(p2);
-                } else {
-                    newArr.add(null);
-                }
-            }
-
-            e.setControlPoints(newArr);
-        }
-    }
-
-    public Cluster getCluster() {
-        return cluster;
-    }
-
-    public void setCluster(Cluster c) {
-        cluster = c;
-    }
-
-    public void setDirty(boolean b) {
-        dirty = b;
-    }
-
-    public void setRoot(boolean b) {
-        root = b;
-    }
-
-    public boolean isRoot() {
-        return root;
-    }
-
-    public int compareTo(Vertex o) {
-        return toString().compareTo(o.toString());
-    }
-
-    @Override
-    public String toString() {
-        return name;
-    }
-
-    public Set<? extends Vertex> getSubNodes() {
-        return subNodes;
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterOutgoingConnection.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.hierarchicallayout;
-
-import com.sun.hotspot.igv.layout.Link;
-import com.sun.hotspot.igv.layout.Port;
-import java.awt.Point;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class ClusterOutgoingConnection implements Link {
-
-    private List<Point> intermediatePoints;
-    private ClusterOutputSlotNode outputSlotNode;
-    private Link connection;
-    private Port inputSlot;
-    private Port outputSlot;
-
-    public ClusterOutgoingConnection(ClusterOutputSlotNode outputSlotNode, Link c) {
-        this.outputSlotNode = outputSlotNode;
-        this.connection = c;
-        this.intermediatePoints = new ArrayList<Point>();
-
-        outputSlot = c.getFrom();
-        inputSlot = outputSlotNode.getInputSlot();
-    }
-
-    public Port getTo() {
-        return inputSlot;
-    }
-
-    public Port getFrom() {
-        return outputSlot;
-    }
-
-    public void setControlPoints(List<Point> p) {
-        this.intermediatePoints = p;
-    }
-
-    public List<Point> getControlPoints() {
-        return intermediatePoints;
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterOutputSlotNode.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.hierarchicallayout;
-
-import com.sun.hotspot.igv.layout.Cluster;
-import com.sun.hotspot.igv.layout.Port;
-import com.sun.hotspot.igv.layout.Vertex;
-import java.awt.Dimension;
-import java.awt.Point;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class ClusterOutputSlotNode implements Vertex {
-
-    private final int SIZE = 0;
-    private Point position;
-    private Port inputSlot;
-    private Port outputSlot;
-    private ClusterNode blockNode;
-    private boolean root;
-    private Cluster cluster;
-    private ClusterOutgoingConnection conn;
-    private String id;
-
-    public void setOutgoingConnection(ClusterOutgoingConnection c) {
-        this.conn = c;
-    }
-
-    public ClusterOutgoingConnection getOutgoingConnection() {
-        return conn;
-    }
-
-    @Override
-    public String toString() {
-        return id;
-    }
-
-    public ClusterOutputSlotNode(ClusterNode n, String id) {
-        this.blockNode = n;
-        this.id = id;
-
-        n.addSubNode(this);
-
-        final Vertex thisNode = this;
-        final ClusterNode thisBlockNode = blockNode;
-
-        inputSlot = new Port() {
-
-            public Point getRelativePosition() {
-                return new Point(0, 0);
-            }
-
-            public Vertex getVertex() {
-                return thisNode;
-            }
-
-            @Override
-            public String toString() {
-                return "InPort of " + thisNode.toString();
-            }
-        };
-
-        outputSlot = new Port() {
-
-            public Point getRelativePosition() {
-                Point p = new Point(thisNode.getPosition());
-                p.x += ClusterNode.BORDER;
-                p.y = 0;//thisBlockNode.getSize().height;
-                return p;
-            }
-
-            public Vertex getVertex() {
-                return thisBlockNode;
-            }
-
-            @Override
-            public String toString() {
-                return "OutPort of " + thisNode.toString();
-            }
-        };
-    }
-
-    public Dimension getSize() {
-        return new Dimension(SIZE, SIZE);
-    }
-
-    public void setPosition(Point p) {
-        this.position = p;
-    }
-
-    public Point getPosition() {
-        return position;
-    }
-
-    public Port getInputSlot() {
-        return inputSlot;
-    }
-
-    public Port getOutputSlot() {
-        return outputSlot;
-    }
-
-    public void setCluster(Cluster c) {
-        cluster = c;
-    }
-
-    public void setRoot(boolean b) {
-        root = b;
-    }
-
-    public Cluster getCluster() {
-        return cluster;
-    }
-
-    public boolean isRoot() {
-        return root;
-    }
-
-    public int compareTo(Vertex o) {
-        return toString().compareTo(o.toString());
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Edge.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Edge.java	Thu Feb 02 16:07:52 2012 -0800
@@ -83,6 +83,7 @@
         dest.addInEdge(this);
     }
 
+    @Override
     public String toString() {
         return "Edge (" + source + " -- " + dest + "): " + data;
     }
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Graph.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Graph.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,13 +23,7 @@
  */
 package com.sun.hotspot.igv.hierarchicallayout;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Queue;
+import java.util.*;
 
 /**
  *
@@ -42,13 +36,13 @@
     private List<Node<N, E>> nodeList;
 
     public Graph() {
-        nodes = new HashMap<Object, Node<N, E>>();
-        edges = new HashMap<Object, Edge<N, E>>();
-        nodeList = new ArrayList<Node<N, E>>();
+        nodes = new HashMap<>();
+        edges = new HashMap<>();
+        nodeList = new ArrayList<>();
     }
 
     public Node<N, E> createNode(N data, Object key) {
-        Node<N, E> n = new Node<N, E>(this, data);
+        Node<N, E> n = new Node<>(this, data);
         assert key == null || !nodes.containsKey(key);
         if (key != null) {
             nodes.put(key, n);
@@ -58,7 +52,7 @@
     }
 
     public Edge<N, E> createEdge(Node<N, E> source, Node<N, E> dest, E data, Object key) {
-        Edge<N, E> e = new Edge<N, E>(this, source, dest, data);
+        Edge<N, E> e = new Edge<>(this, source, dest, data);
         source.addOutEdge(e);
         dest.addInEdge(e);
         if (key != null) {
@@ -114,7 +108,7 @@
 
     public List<Node<N, E>> getNodesWithInDegree(int x, boolean countSelfLoops) {
 
-        List<Node<N, E>> result = new ArrayList<Node<N, E>>();
+        List<Node<N, E>> result = new ArrayList<>();
         for (Node<N, E> n : getNodes()) {
             if (n.getInDegree(countSelfLoops) == x) {
                 result.add(n);
@@ -126,7 +120,7 @@
     }
 
     private void markReachable(Node<N, E> startingNode) {
-        ArrayList<Node<N, E>> arr = new ArrayList<Node<N, E>>();
+        ArrayList<Node<N, E>> arr = new ArrayList<>();
         arr.add(startingNode);
         for (Node<N, E> n : getNodes()) {
             n.setReachable(false);
@@ -151,7 +145,7 @@
             n.setActive(false);
         }
 
-        Queue<Node<N, E>> queue = new LinkedList<Node<N, E>>();
+        Queue<Node<N, E>> queue = new LinkedList<>();
         queue.add(startingNode);
         startingNode.setVisited(true);
         int layer = 0;
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.hierarchicallayout;
-
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Set;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.TreeSet;
-import com.sun.hotspot.igv.layout.Cluster;
-import com.sun.hotspot.igv.layout.LayoutGraph;
-import com.sun.hotspot.igv.layout.LayoutManager;
-import com.sun.hotspot.igv.layout.Link;
-import com.sun.hotspot.igv.layout.Port;
-import com.sun.hotspot.igv.layout.Vertex;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class HierarchicalClusterLayoutManager implements LayoutManager {
-
-    private OldHierarchicalLayoutManager.Combine combine;
-    private LayoutManager subManager = new OldHierarchicalLayoutManager(combine);
-    private LayoutManager manager = new OldHierarchicalLayoutManager(combine, 150);
-    private static final boolean TRACE = false;
-
-    public HierarchicalClusterLayoutManager(OldHierarchicalLayoutManager.Combine combine) {
-        this.combine = combine;
-    }
-
-    public void doLayout(LayoutGraph graph) {
-        doLayout(graph, new HashSet<Vertex>(), new HashSet<Vertex>(), new HashSet<Link>());
-    }
-
-    public void setSubManager(LayoutManager manager) {
-        this.subManager = manager;
-    }
-
-    public void setManager(LayoutManager manager) {
-        this.manager = manager;
-    }
-
-    public void doLayout(LayoutGraph graph, Set<? extends Vertex> firstLayerHint, Set<? extends Vertex> lastLayerHint, Set<? extends Link> importantLinks) {
-
-        assert graph.verify();
-
-        HashMap<Cluster, List<Vertex>> lists = new HashMap<Cluster, List<Vertex>>();
-        HashMap<Cluster, List<Link>> listsConnection = new HashMap<Cluster, List<Link>>();
-        HashMap<Cluster, HashMap<Port, ClusterInputSlotNode>> clusterInputSlotHash = new HashMap<Cluster, HashMap<Port, ClusterInputSlotNode>>();
-        HashMap<Cluster, HashMap<Port, ClusterOutputSlotNode>> clusterOutputSlotHash = new HashMap<Cluster, HashMap<Port, ClusterOutputSlotNode>>();
-
-        HashMap<Cluster, ClusterNode> clusterNodes = new HashMap<Cluster, ClusterNode>();
-        HashMap<Cluster, Set<ClusterInputSlotNode>> clusterInputSlotSet = new HashMap<Cluster, Set<ClusterInputSlotNode>>();
-        HashMap<Cluster, Set<ClusterOutputSlotNode>> clusterOutputSlotSet = new HashMap<Cluster, Set<ClusterOutputSlotNode>>();
-        Set<Link> clusterEdges = new HashSet<Link>();
-        Set<Link> interClusterEdges = new HashSet<Link>();
-        HashMap<Link, ClusterOutgoingConnection> linkClusterOutgoingConnection = new HashMap<Link, ClusterOutgoingConnection>();
-        HashMap<Link, InterClusterConnection> linkInterClusterConnection = new HashMap<Link, InterClusterConnection>();
-        HashMap<Link, ClusterIngoingConnection> linkClusterIngoingConnection = new HashMap<Link, ClusterIngoingConnection>();
-        Set<ClusterNode> clusterNodeSet = new HashSet<ClusterNode>();
-
-        Set<Cluster> cluster = graph.getClusters();
-        int z = 0;
-        for (Cluster c : cluster) {
-            lists.put(c, new ArrayList<Vertex>());
-            listsConnection.put(c, new ArrayList<Link>());
-            clusterInputSlotHash.put(c, new HashMap<Port, ClusterInputSlotNode>());
-            clusterOutputSlotHash.put(c, new HashMap<Port, ClusterOutputSlotNode>());
-            clusterOutputSlotSet.put(c, new TreeSet<ClusterOutputSlotNode>());
-            clusterInputSlotSet.put(c, new TreeSet<ClusterInputSlotNode>());
-            ClusterNode cn = new ClusterNode(c, "" + z);
-            clusterNodes.put(c, cn);
-            clusterNodeSet.add(cn);
-            z++;
-        }
-
-        // Add cluster edges
-        for (Cluster c : cluster) {
-
-            ClusterNode start = clusterNodes.get(c);
-
-            for (Cluster succ : c.getSuccessors()) {
-                ClusterNode end = clusterNodes.get(succ);
-                if (end != null && start != end) {
-                    ClusterEdge e = new ClusterEdge(start, end);
-                    clusterEdges.add(e);
-                    interClusterEdges.add(e);
-                }
-            }
-        }
-
-        for (Vertex v : graph.getVertices()) {
-            Cluster c = v.getCluster();
-            assert c != null : "Cluster of vertex " + v + " is null!";
-            clusterNodes.get(c).addSubNode(v);
-        }
-
-        for (Link l : graph.getLinks()) {
-
-            Port fromPort = l.getFrom();
-            Port toPort = l.getTo();
-            Vertex fromVertex = fromPort.getVertex();
-            Vertex toVertex = toPort.getVertex();
-            Cluster fromCluster = fromVertex.getCluster();
-            Cluster toCluster = toVertex.getCluster();
-
-            Port samePort = null;
-            if (combine == OldHierarchicalLayoutManager.Combine.SAME_INPUTS) {
-                samePort = toPort;
-            } else if (combine == OldHierarchicalLayoutManager.Combine.SAME_OUTPUTS) {
-                samePort = fromPort;
-            }
-
-            assert listsConnection.containsKey(fromCluster);
-            assert listsConnection.containsKey(toCluster);
-
-            if (fromCluster == toCluster) {
-                listsConnection.get(fromCluster).add(l);
-                clusterNodes.get(fromCluster).addSubEdge(l);
-            } else {
-                ClusterInputSlotNode inputSlotNode = null;
-                ClusterOutputSlotNode outputSlotNode = null;
-
-                if (samePort != null) {
-                    outputSlotNode = clusterOutputSlotHash.get(fromCluster).get(samePort);
-                    inputSlotNode = clusterInputSlotHash.get(toCluster).get(samePort);
-                }
-
-                if (outputSlotNode == null) {
-                    outputSlotNode = new ClusterOutputSlotNode(clusterNodes.get(fromCluster), "Out " + fromCluster.toString() + " " + samePort.toString());
-                    clusterOutputSlotSet.get(fromCluster).add(outputSlotNode);
-                    ClusterOutgoingConnection conn = new ClusterOutgoingConnection(outputSlotNode, l);
-                    outputSlotNode.setOutgoingConnection(conn);
-                    clusterNodes.get(fromCluster).addSubEdge(conn);
-                    if (samePort != null) {
-                        clusterOutputSlotHash.get(fromCluster).put(samePort, outputSlotNode);
-                    }
-
-                    linkClusterOutgoingConnection.put(l, conn);
-                } else {
-                    linkClusterOutgoingConnection.put(l, outputSlotNode.getOutgoingConnection());
-                }
-
-                if (inputSlotNode == null) {
-                    inputSlotNode = new ClusterInputSlotNode(clusterNodes.get(toCluster), "In " + toCluster.toString() + " " + samePort.toString());
-                    clusterInputSlotSet.get(toCluster).add(inputSlotNode);
-                }
-
-                ClusterIngoingConnection conn = new ClusterIngoingConnection(inputSlotNode, l);
-                inputSlotNode.setIngoingConnection(conn);
-                clusterNodes.get(toCluster).addSubEdge(conn);
-                if (samePort != null) {
-                    clusterInputSlotHash.get(toCluster).put(samePort, inputSlotNode);
-                }
-
-                linkClusterIngoingConnection.put(l, conn);
-
-
-                InterClusterConnection interConn = new InterClusterConnection(outputSlotNode, inputSlotNode);
-                linkInterClusterConnection.put(l, interConn);
-                clusterEdges.add(interConn);
-            }
-        }
-
-        Timing t = null;
-
-        if (TRACE) {
-            new Timing("Child timing");
-            t.start();
-        }
-
-        for (Cluster c : cluster) {
-            ClusterNode n = clusterNodes.get(c);
-            subManager.doLayout(new LayoutGraph(n.getSubEdges(), n.getSubNodes()), clusterInputSlotSet.get(c), clusterOutputSlotSet.get(c), new HashSet<Link>());
-            n.updateSize();
-        }
-
-        Set<Vertex> roots = new LayoutGraph(interClusterEdges).findRootVertices();
-        for (Vertex v : roots) {
-            assert v instanceof ClusterNode;
-            ((ClusterNode) v).setRoot(true);
-        }
-
-        manager.doLayout(new LayoutGraph(clusterEdges, clusterNodeSet), new HashSet<Vertex>(), new HashSet<Vertex>(), interClusterEdges);
-
-        for (Cluster c : cluster) {
-            ClusterNode n = clusterNodes.get(c);
-            c.setBounds(new Rectangle(n.getPosition(), n.getSize()));
-        }
-
-        // TODO: handle case where blocks are not fully connected
-
-        if (TRACE) {
-            t.stop();
-            t.print();
-        }
-
-        for (Link l : graph.getLinks()) {
-
-            if (linkInterClusterConnection.containsKey(l)) {
-                ClusterOutgoingConnection conn1 = linkClusterOutgoingConnection.get(l);
-                InterClusterConnection conn2 = linkInterClusterConnection.get(l);
-                ClusterIngoingConnection conn3 = linkClusterIngoingConnection.get(l);
-
-                assert conn1 != null;
-                assert conn2 != null;
-                assert conn3 != null;
-
-                List<Point> points = new ArrayList<Point>();
-
-                points.addAll(conn1.getControlPoints());
-                points.addAll(conn2.getControlPoints());
-                points.addAll(conn3.getControlPoints());
-
-                l.setControlPoints(points);
-            }
-        }
-    }
-
-    public void doRouting(LayoutGraph graph) {
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java	Thu Feb 02 16:07:52 2012 -0800
@@ -29,19 +29,7 @@
 import com.sun.hotspot.igv.layout.Vertex;
 import java.awt.Dimension;
 import java.awt.Point;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Queue;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.Stack;
-import java.util.TreeSet;
+import java.util.*;
 
 /**
  *
@@ -59,6 +47,7 @@
     public static final int LAYER_OFFSET = 30;
     public static final int MAX_LAYER_LENGTH = -1;
     public static final int MIN_LAYER_DIFFERENCE = 1;
+    public static final int VIP_BONUS = 10;
 
     public enum Combine {
 
@@ -103,10 +92,10 @@
         public int bottomYOffset;
         public Vertex vertex; // Only used for non-dummy nodes, otherwise null
 
-        public List<LayoutEdge> preds = new ArrayList<LayoutEdge>();
-        public List<LayoutEdge> succs = new ArrayList<LayoutEdge>();
-        public HashMap<Integer, Integer> outOffsets = new HashMap<Integer, Integer>();
-        public HashMap<Integer, Integer> inOffsets = new HashMap<Integer, Integer>();
+        public List<LayoutEdge> preds = new ArrayList<>();
+        public List<LayoutEdge> succs = new ArrayList<>();
+        public HashMap<Integer, Integer> outOffsets = new HashMap<>();
+        public HashMap<Integer, Integer> inOffsets = new HashMap<>();
         public int pos = -1; // Position within layer
 
         public int crossingNumber;
@@ -124,6 +113,7 @@
         public int relativeFrom;
         public int relativeTo;
         public Link link;
+        public boolean vip;
     }
 
     private abstract class AlgorithmPart {
@@ -174,7 +164,7 @@
         this.layerOffset = LAYER_OFFSET;
         this.maxLayerLength = MAX_LAYER_LENGTH;
         this.minLayerDifference = MIN_LAYER_DIFFERENCE;
-        this.linksToFollow = new HashSet<Link>();
+        this.linksToFollow = new HashSet<>();
     }
 
     public int getMaxLayerLength() {
@@ -189,11 +179,13 @@
         minLayerDifference = v;
     }
 
+    @Override
     public void doLayout(LayoutGraph graph) {
         doLayout(graph, new HashSet<Vertex>(), new HashSet<Vertex>(), new HashSet<Link>());
 
     }
 
+    @Override
     public void doLayout(LayoutGraph graph, Set<? extends Vertex> firstLayerHint, Set<? extends Vertex> lastLayerHint, Set<? extends Link> importantLinks) {
 
         this.importantLinks = importantLinks;
@@ -201,14 +193,14 @@
         this.firstLayerHint = firstLayerHint;
         this.lastLayerHint = lastLayerHint;
 
-        vertexToLayoutNode = new HashMap<Vertex, LayoutNode>();
-        reversedLinks = new HashSet<Link>();
-        reversedLinkStartPoints = new HashMap<Link, List<Point>>();
-        reversedLinkEndPoints = new HashMap<Link, List<Point>>();
-        bottomEdgeHash = new HashMap<LayoutEdge, LayoutEdge>();
-        nodes = new ArrayList<LayoutNode>();
-        splitStartPoints = new HashMap<Link, List<Point>>();
-        splitEndPoints = new HashMap<Link, List<Point>>();
+        vertexToLayoutNode = new HashMap<>();
+        reversedLinks = new HashSet<>();
+        reversedLinkStartPoints = new HashMap<>();
+        reversedLinkEndPoints = new HashMap<>();
+        bottomEdgeHash = new HashMap<>();
+        nodes = new ArrayList<>();
+        splitStartPoints = new HashMap<>();
+        splitEndPoints = new HashMap<>();
 
         // #############################################################
         // Step 1: Build up data structure
@@ -219,7 +211,7 @@
         new ReverseEdges().start();
 
         for (LayoutNode n : nodes) {
-            ArrayList<LayoutEdge> tmpArr = new ArrayList<LayoutEdge>();
+            ArrayList<LayoutEdge> tmpArr = new ArrayList<>();
             for (LayoutEdge e : n.succs) {
                 if (importantLinks.contains(e.link)) {
                     tmpArr.add(e);
@@ -247,8 +239,7 @@
 
         // #############################################################
         // STEP 7: Assign X coordinates
-        //new AssignXCoordinates().start();
-        new AssignXCoordinates2().start();
+        new AssignXCoordinates().start();
 
         // #############################################################
         // STEP 6: Assign Y coordinates
@@ -263,10 +254,11 @@
 
         private int pointCount;
 
+        @Override
         protected void run() {
 
-            HashMap<Vertex, Point> vertexPositions = new HashMap<Vertex, Point>();
-            HashMap<Link, List<Point>> linkPositions = new HashMap<Link, List<Point>>();
+            HashMap<Vertex, Point> vertexPositions = new HashMap<>();
+            HashMap<Link, List<Point>> linkPositions = new HashMap<>();
             for (Vertex v : graph.getVertices()) {
                 LayoutNode n = vertexToLayoutNode.get(v);
                 assert !vertexPositions.containsKey(v);
@@ -277,7 +269,7 @@
 
                 for (LayoutEdge e : n.preds) {
                     if (e.link != null) {
-                        ArrayList<Point> points = new ArrayList<Point>();
+                        ArrayList<Point> points = new ArrayList<>();
 
                         Point p = new Point(e.to.x + e.relativeTo, e.to.y + e.to.yOffset + e.link.getTo().getRelativePosition().y);
                         points.add(p);
@@ -362,7 +354,7 @@
 
                 for (LayoutEdge e : n.succs) {
                     if (e.link != null) {
-                        ArrayList<Point> points = new ArrayList<Point>();
+                        ArrayList<Point> points = new ArrayList<>();
                         Point p = new Point(e.from.x + e.relativeFrom, e.from.y + e.from.height - e.from.bottomYOffset + e.link.getFrom().getRelativePosition().y);
                         points.add(p);
                         if (e.from.outOffsets.containsKey(e.relativeFrom)) {
@@ -498,13 +490,14 @@
 
         public float d;
         public int orderNumber = -1;
-        public ArrayList<LayoutNode> nodes = new ArrayList<LayoutNode>();
-        public HashSet<Segment> succs = new HashSet<Segment>();
-        public HashSet<Segment> preds = new HashSet<Segment>();
+        public ArrayList<LayoutNode> nodes = new ArrayList<>();
+        public HashSet<Segment> succs = new HashSet<>();
+        public HashSet<Segment> preds = new HashSet<>();
         public Region region;
     }
     private static final Comparator<Segment> segmentComparator = new Comparator<Segment>() {
 
+        @Override
         public int compare(Segment s1, Segment s2) {
             return s1.orderNumber - s2.orderNumber;
         }
@@ -514,23 +507,26 @@
 
         public float d;
         public int minOrderNumber;
-        public SortedSet<Segment> segments = new TreeSet<Segment>(segmentComparator);
-        public HashSet<Region> succs = new HashSet<Region>(4);
-        public HashSet<Region> preds = new HashSet<Region>(4);
+        public SortedSet<Segment> segments = new TreeSet<>(segmentComparator);
+        public HashSet<Region> succs = new HashSet<>(4);
+        public HashSet<Region> preds = new HashSet<>(4);
     }
     private static final Comparator<Region> regionComparator = new Comparator<Region>() {
 
+        @Override
         public int compare(Region r1, Region r2) {
             return r1.minOrderNumber - r2.minOrderNumber;
         }
     };
     private static final Comparator<LayoutNode> nodePositionComparator = new Comparator<LayoutNode>() {
 
+        @Override
         public int compare(LayoutNode n1, LayoutNode n2) {
             return n1.pos - n2.pos;
         }
     };
     private static final Comparator<LayoutNode> nodeProcessingDownComparator = new Comparator<LayoutNode>() {
+        @Override
         public int compare(LayoutNode n1, LayoutNode n2) {
             if (n1.vertex == null) {
                 if (n2.vertex == null) {
@@ -546,6 +542,7 @@
     };
     private static final Comparator<LayoutNode> nodeProcessingUpComparator = new Comparator<LayoutNode>() {
 
+        @Override
         public int compare(LayoutNode n1, LayoutNode n2) {
             if (n1.vertex == null) {
                 if (n2.vertex == null) {
@@ -560,7 +557,7 @@
         }
     };
 
-    private class AssignXCoordinates2 extends AlgorithmPart {
+    private class AssignXCoordinates extends AlgorithmPart {
 
         private ArrayList<Integer>[] space;
         private ArrayList<LayoutNode>[] downProcessingOrder;
@@ -579,13 +576,14 @@
             upProcessingOrder = new ArrayList[layers.length];
         }
 
+        @Override
         protected void run() {
             createArrays();
 
             for (int i = 0; i < layers.length; i++) {
-                space[i] = new ArrayList<Integer>();
-                downProcessingOrder[i] = new ArrayList<LayoutNode>();
-                upProcessingOrder[i] = new ArrayList<LayoutNode>();
+                space[i] = new ArrayList<>();
+                downProcessingOrder[i] = new ArrayList<>();
+                upProcessingOrder[i] = new ArrayList<>();
 
                 int curX = 0;
                 for (LayoutNode n : layers[i]) {
@@ -604,10 +602,11 @@
                 sweepDown();
                 sweepUp();
             }
-
-            for (int i = 0; i < SWEEP_ITERATIONS; i++) {
-                doubleSweep();
-            }            
+ 
+            sweepDown();
+            //for (int i = 0; i < SWEEP_ITERATIONS; i++) {
+            //    doubleSweep();
+            //}            
         }
 
         private int calculateOptimalDown(LayoutNode n) {
@@ -619,6 +618,9 @@
             for (int i = 0; i < size; i++) {
                 LayoutEdge e = n.preds.get(i);
                 values[i] = e.from.x + e.relativeFrom - e.relativeTo;
+                if (e.vip) {
+                    return values[i];
+                }
             }
             return median(values);
         }
@@ -649,11 +651,15 @@
             if (size == 0) {
                 return n.x;
             }
-            long sum = 0;
-            for (LayoutEdge e : n.succs) {
-                sum += e.to.x + e.relativeTo - e.relativeFrom;
+            int[] values = new int[size];
+            for (int i = 0; i < size; i++) {
+                LayoutEdge e = n.succs.get(i);
+                values[i] = e.to.x + e.relativeTo - e.relativeFrom;
+                if (e.vip) {
+                    return values[i];
+                }
             }
-            return (int) (sum / size); // why not the median?
+            return median(values);
         }
 
         private int median(int[] values) {
@@ -673,14 +679,6 @@
                     r.insert(n, optimal);
                 }
             }
-        /*
-        for(int i=0; i<layers.length; i++) {
-        NodeRow r = new NodeRow(space[i]);
-        for(LayoutNode n : upProcessingOrder[i]) {
-        int optimal = calculateOptimalUp(n);
-        r.insert(n, optimal);
-        }
-        }*/
         }
 
         private void doubleSweep() {
@@ -710,7 +708,7 @@
         private ArrayList<Integer> space;
 
         public NodeRow(ArrayList<Integer> space) {
-            treeSet = new TreeSet<LayoutNode>(nodePositionComparator);
+            treeSet = new TreeSet<>(nodePositionComparator);
             this.space = space;
         }
 
@@ -755,351 +753,9 @@
             treeSet.add(n);
         }
     }
-
-    private class AssignXCoordinates extends AlgorithmPart {
-
-        HashMap<LayoutNode, Segment> hashMap = new HashMap<LayoutNode, Segment>();
-        ArrayList<Segment> segments = new ArrayList<Segment>();
-
-        private void generateSegments() {
-
-            for (int i = 0; i < layerCount; i++) {
-                for (LayoutNode n : layers[i]) {
-                    if (!hashMap.containsKey(n)) {
-                        Segment s = new Segment();
-                        segments.add(s);
-                        LayoutNode curNode = n;
-
-                        int maxLength = 0;
-                        while (curNode.succs.size() == 1 && curNode.preds.size() == 1) {
-                            s.nodes.add(curNode);
-                            assert !hashMap.containsKey(curNode);
-                            hashMap.put(curNode, s);
-                            curNode = curNode.succs.get(0).to;
-                            maxLength++;
-                        //if(maxLength > 10) break;
-                        }
-
-                        if (s.nodes.size() > 0 && curNode.preds.size() == 1 && curNode.vertex == null) {
-                            s.nodes.add(curNode);
-                            assert !hashMap.containsKey(curNode);
-                            hashMap.put(curNode, s);
-                        }
-
-                        if (s.nodes.size() == 0) {
-                            // Simple segment with a single node
-                            s.nodes.add(n);
-                            hashMap.put(n, s);
-                        }
-                    }
-                }
-            }
-        }
-
-        private void addEdges() {
-
-            for (int i = 0; i < layerCount; i++) {
-                LayoutNode prev = null;
-                for (LayoutNode n : layers[i]) {
-
-                    if (prev != null) {
-                        Segment s1 = hashMap.get(prev);
-                        Segment s2 = hashMap.get(n);
-
-                        if (s1 != s2) {
-                            s1.succs.add(s2);
-                            s2.preds.add(s1);
-                        }
-                    }
-                    prev = n;
-
-                }
-            }
-        }
-
-        private void topologicalSorting() {
-
-            Queue<Segment> queue = new LinkedList<Segment>();
-
-            int index = 0;
-            ArrayList<Segment> newList = new ArrayList<Segment>();
-            for (Segment s : segments) {
-                if (s.preds.size() == 0) {
-                    s.orderNumber = index;
-                    newList.add(s);
-                    index++;
-                    queue.add(s);
-                }
-            }
-
-            while (!queue.isEmpty()) {
-                Segment s = queue.remove();
-
-                for (Segment succ : s.succs) {
-                    succ.preds.remove(s);
-                    if (succ.preds.size() == 0) {
-                        queue.add(succ);
-                        succ.orderNumber = index;
-                        newList.add(succ);
-                        index++;
-                    }
-                }
-            }
-
-            segments = newList;
-        }
-
-        private void initialPositions() {
-
-            int[] minPos = new int[layers.length];
-
-            for (Segment s : segments) {
-                int max = 0;
-                for (LayoutNode n : s.nodes) {
-                    int x = minPos[n.layer];
-                    if (x > max) {
-                        max = x;
-                    }
-                }
-
-                for (LayoutNode n : s.nodes) {
-                    minPos[n.layer] = max + n.width + xOffset;
-                    n.x = max;
-                }
-            }
-        }
-
-        private int predSum(LayoutNode n) {
-            int sum = 0;
-            for (LayoutEdge e : n.preds) {
-                assert e.to == n;
-                //sum += (e.from.x + e.relativeFrom + (int)hashMap.get(e.from).d) - (e.to.x + e.relativeTo + (int)hashMap.get(e.to).d);
-                sum += (e.from.x + e.relativeFrom) - (e.to.x + e.relativeTo);
-            }
-
-            return sum;
-        }
-
-        private int succSum(LayoutNode n) {
-            int sum = 0;
-            for (LayoutEdge e : n.succs) {
-
-                assert e.from == n;
-                sum += (e.to.x + e.relativeTo) - (e.from.x + e.relativeFrom);
-            //sum += (e.to.x + e.relativeTo + (int)hashMap.get(e.to).d) - (e.from.x + e.relativeFrom + (int)hashMap.get(e.from).d);
-            }
-
-            return sum;
-
-        }
-
-        private void downValues() {
-
-            for (Segment s : segments) {
-                downValues(s);
-
-            }
-
-        }
-
-        private void downValues(Segment s) {
-            LayoutNode n = s.nodes.get(0); // Only first node needed, all other have same coordinate
-
-            if (n.preds.size() == 0) {
-                // Value is 0.0;
-                if (n.succs.size() == 0) {
-                    s.d = 0.0f;
-                } else {
-                    s.d = (((float) succSum(n) / (float) n.succs.size())) / 2;
-                }
-            } else {
-                s.d = (float) predSum(n) / (float) n.preds.size();
-            }
-        }
-
-        private void upValues() {
-            for (Segment s : segments) {
-                upValues(s);
-            }
-        }
-
-        private void upValues(Segment s) {
-            LayoutNode n = s.nodes.get(0); // Only first node needed, all other have same coordinate
-
-            if (n.succs.size() == 0) {
-                // Value is 0.0;
-                if (n.preds.size() == 0) {
-                    s.d = 0.0f;
-                } else {
-                    s.d = (float) predSum(n) / (float) n.preds.size();
-                }
-            } else {
-                s.d = ((float) succSum(n) / (float) n.succs.size()) / 2;
-            }
-        }
-
-        private void sweep(boolean down) {
-
-            if (down) {
-                downValues();
-            } else {
-                upValues();
-            }
-
-            SortedSet<Region> regions = new TreeSet<Region>(regionComparator);
-            for (Segment s : segments) {
-                s.region = new Region();
-                s.region.minOrderNumber = s.orderNumber;
-                s.region.segments.add(s);
-                s.region.d = s.d;
-                regions.add(s.region);
-            }
-
-            for (Segment s : segments) {
-                for (LayoutNode n : s.nodes) {
-                    if (n.pos != 0) {
-                        LayoutNode prevNode = layers[n.layer].get(n.pos - 1);
-                        if (prevNode.x + prevNode.width + xOffset == n.x) {
-                            Segment other = hashMap.get(prevNode);
-                            Region r1 = s.region;
-                            Region r2 = other.region;
-                            // They are close together
-                            if (r1 != r2 && r2.d >= r1.d) {
-
-                                if (r2.segments.size() < r1.segments.size()) {
-
-                                    r1.d = (r1.d * r1.segments.size() + r2.d * r2.segments.size()) / (r1.segments.size() + r2.segments.size());
-
-                                    for (Segment tempS : r2.segments) {
-                                        r1.segments.add(tempS);
-                                        tempS.region = r1;
-                                        r1.minOrderNumber = Math.min(r1.minOrderNumber, tempS.orderNumber);
-                                    }
-
-                                    regions.remove(r2);
-                                } else {
-
-                                    r2.d = (r1.d * r1.segments.size() + r2.d * r2.segments.size()) / (r1.segments.size() + r2.segments.size());
-
-                                    for (Segment tempS : r1.segments) {
-                                        r2.segments.add(tempS);
-                                        tempS.region = r2;
-                                        r2.minOrderNumber = Math.min(r2.minOrderNumber, tempS.orderNumber);
-                                    }
-
-                                    regions.remove(r1);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-
-
-
-            ArrayList<Region> reversedRegions = new ArrayList<Region>();
-            for (Region r : regions) {
-                if (r.d < 0) {
-                    processRegion(r, down);
-                } else {
-                    reversedRegions.add(0, r);
-                }
-            }
-
-            for (Region r : reversedRegions) {
-                processRegion(r, down);
-            }
-
-        }
-
-        private void processRegion(Region r, boolean down) {
-
-            // Do not move
-            if ((int) r.d == 0) {
-                return;
-            }
-
-            ArrayList<Segment> arr = new ArrayList<Segment>();
-            for (Segment s : r.segments) {
-                arr.add(s);
-            }
-
-            if (r.d > 0) {
-                Collections.reverse(arr);
-            }
-
-            for (Segment s : arr) {
-
-
-                int min = (int) r.d;
-                if (min < 0) {
-                    min = -min;
-                }
-
-                for (LayoutNode n : s.nodes) {
-
-                    int layer = n.layer;
-                    int pos = n.pos;
-
-
-                    if (r.d > 0) {
-
-                        if (pos != layers[layer].size() - 1) {
-
-                            int off = layers[layer].get(pos + 1).x - n.x - xOffset - n.width;
-                            assert off >= 0;
-                            if (off < min) {
-                                min = off;
-                            }
-                        }
-
-                    } else {
-
-                        if (pos != 0) {
-
-                            int off = n.x - xOffset - layers[layer].get(pos - 1).x - layers[layer].get(pos - 1).width;
-                            assert off >= 0;
-                            if (off < min) {
-                                min = off;
-                            }
-                        }
-                    }
-                }
-
-                assert min >= 0;
-                if (min != 0) {
-                    for (LayoutNode n : s.nodes) {
-                        if (r.d > 0) {
-                            n.x += min;
-                        } else {
-                            n.x -= min;
-                        }
-
-                    }
-                }
-            }
-        }
-
-        protected void run() {
-
-            generateSegments();
-            addEdges();
-            topologicalSorting();
-            initialPositions();
-            for (int i = 0; i < SWEEP_ITERATIONS; i++) {
-
-                sweep(true);
-                sweep(true);
-                sweep(false);
-                sweep(false);
-            }
-
-            sweep(true);
-            sweep(true);
-        }
-    }
     private static Comparator<LayoutNode> crossingNodeComparator = new Comparator<LayoutNode>() {
 
+        @Override
         public int compare(LayoutNode n1, LayoutNode n2) {
             return n1.crossingNumber - n2.crossingNumber;
         }
@@ -1119,15 +775,16 @@
             layers = new List[layerCount];
 
             for (int i = 0; i < layerCount; i++) {
-                layers[i] = new ArrayList<LayoutNode>();
+                layers[i] = new ArrayList<>();
             }
         }
 
+        @Override
         protected void run() {
             createLayers();
 
             // Generate initial ordering
-            HashSet<LayoutNode> visited = new HashSet<LayoutNode>();
+            HashSet<LayoutNode> visited = new HashSet<>();
             for (LayoutNode n : nodes) {
                 if (n.layer == 0) {
                     layers[0].add(n);
@@ -1205,21 +862,20 @@
                 for (LayoutNode n : layers[i]) {
 
                     int sum = 0;
+                    int count = 0;
                     for (LayoutEdge e : n.preds) {
                         int cur = e.from.x + e.relativeFrom;
-
-                        /*pos;
-                        if(e.from.width != 0 && e.relativeFrom != 0) {
-                        cur += (float)e.relativeFrom / (float)(e.from.width);
-                        }*/
-
-                        sum += cur;
+                        int factor = 1;
+                        if (e.vip) {
+                            factor = VIP_BONUS;
+                        }
+                        sum += cur*factor;
+                        count+=factor;
                     }
 
-                    if (n.preds.size() > 0) {
-                        sum /= n.preds.size();
+                    if (count > 0) {
+                        sum /= count;
                         n.crossingNumber = sum;
-                    //if(n.vertex == null) n.crossingNumber += layers[i].size();
                     }
                 }
 
@@ -1248,9 +904,9 @@
                     next = layers[index].get(i + 1);
                 }
 
-                boolean cond = (n.succs.size() == 0);
+                boolean cond = n.succs.isEmpty();
                 if (down) {
-                    cond = (n.preds.size() == 0);
+                    cond = n.preds.isEmpty();
                 }
 
                 if (cond) {
@@ -1276,21 +932,21 @@
 
                 for (LayoutNode n : layers[i]) {
 
+                    int count = 0;
                     int sum = 0;
                     for (LayoutEdge e : n.succs) {
-                        int cur = e.to.x + e.relativeTo;//pos;
-						/*
-                        if(e.to.width != 0 && e.relativeTo != 0) {
-                        cur += (float)e.relativeTo / (float)(e.to.width);
-                        }*/
-
-                        sum += cur;
+                        int cur = e.to.x + e.relativeTo;
+                        int factor = 1;
+                        if (e.vip) {
+                            factor = VIP_BONUS;
+                        }
+                        sum += cur*factor;
+                        count+=factor;
                     }
 
-                    if (n.succs.size() > 0) {
-                        sum /= n.succs.size();
+                    if (count > 0) {
+                        sum /= count;
                         n.crossingNumber = sum;
-                    //if(n.vertex == null) n.crossingNumber += layers[i].size();
                     }
 
                 }
@@ -1310,7 +966,7 @@
         @Override
         public void postCheck() {
 
-            HashSet<LayoutNode> visited = new HashSet<LayoutNode>();
+            HashSet<LayoutNode> visited = new HashSet<>();
             for (int i = 0; i < layers.length; i++) {
                 for (LayoutNode n : layers[i]) {
                     assert !visited.contains(n);
@@ -1324,6 +980,7 @@
 
     private class AssignYCoordinates extends AlgorithmPart {
 
+        @Override
         protected void run() {
             int curY = 0;
 
@@ -1380,6 +1037,7 @@
             }
         }
 
+        @Override
         protected void run() {
             oldNodeCount = nodes.size();
 
@@ -1388,18 +1046,19 @@
 
                 Comparator<LayoutEdge> comparator = new Comparator<LayoutEdge>() {
 
+                    @Override
                     public int compare(LayoutEdge e1, LayoutEdge e2) {
                         return e1.to.layer - e2.to.layer;
                     }
                 };
-                HashMap<Integer, List<LayoutEdge>> portHash = new HashMap<Integer, List<LayoutEdge>>();
-                ArrayList<LayoutNode> currentNodes = new ArrayList<LayoutNode>(nodes);
+                HashMap<Integer, List<LayoutEdge>> portHash = new HashMap<>();
+                ArrayList<LayoutNode> currentNodes = new ArrayList<>(nodes);
                 for (LayoutNode n : currentNodes) {
                     portHash.clear();
 
-                    ArrayList<LayoutEdge> succs = new ArrayList<LayoutEdge>(n.succs);
-                    HashMap<Integer, LayoutNode> topNodeHash = new HashMap<Integer, LayoutNode>();
-                    HashMap<Integer, HashMap<Integer, LayoutNode>> bottomNodeHash = new HashMap<Integer, HashMap<Integer, LayoutNode>>();
+                    ArrayList<LayoutEdge> succs = new ArrayList<>(n.succs);
+                    HashMap<Integer, LayoutNode> topNodeHash = new HashMap<>();
+                    HashMap<Integer, HashMap<Integer, LayoutNode>> bottomNodeHash = new HashMap<>();
                     for (LayoutEdge e : succs) {
                         assert e.from.layer < e.to.layer;
                         if (e.from.layer != e.to.layer - 1) {
@@ -1418,6 +1077,7 @@
                                     topEdge.relativeTo = topNode.width / 2;
                                     topEdge.to = topNode;
                                     topEdge.link = e.link;
+                                    topEdge.vip = e.vip;
                                     e.from.succs.add(topEdge);
                                     topNode.preds.add(topEdge);
                                 } else {
@@ -1433,6 +1093,7 @@
                                     topEdge.relativeTo = topNode.width / 2;
                                     topEdge.to = topNode;
                                     topEdge.link = e.link;
+                                    topEdge.vip = e.vip;
                                     e.from.succs.add(topEdge);
                                     topNode.preds.add(topEdge);
                                     topNodeHash.put(e.relativeFrom, topNode);
@@ -1460,6 +1121,7 @@
                                 bottomEdge.relativeFrom = bottomNode.width / 2;
                                 bottomEdge.from = bottomNode;
                                 bottomEdge.link = e.link;
+                                bottomEdge.vip = e.vip;
                                 e.to.preds.add(bottomEdge);
                                 bottomEdgeHash.put(topEdge, bottomEdge);
                                 bottomNode.succs.add(bottomEdge);
@@ -1474,7 +1136,7 @@
                         }
                     }
 
-                    succs = new ArrayList<LayoutEdge>(n.succs);
+                    succs = new ArrayList<>(n.succs);
                     for (LayoutEdge e : succs) {
 
                         Integer i = e.relativeFrom;
@@ -1499,6 +1161,7 @@
                                 edges[0] = new LayoutEdge();
                                 edges[0].from = n;
                                 edges[0].relativeFrom = i;
+                                edges[0].vip = e.vip;
                                 n.succs.add(edges[0]);
 
                                 nodes[0] = new LayoutNode();
@@ -1510,6 +1173,7 @@
                                 edges[0].relativeTo = nodes[0].width / 2;
                                 for (int j = 1; j < cnt; j++) {
                                     edges[j] = new LayoutEdge();
+                                    edges[j].vip = e.vip;
                                     edges[j].from = nodes[j - 1];
                                     edges[j].relativeFrom = nodes[j - 1].width / 2;
                                     nodes[j - 1].succs.add(edges[j]);
@@ -1541,7 +1205,7 @@
             } else if (combine == Combine.SAME_INPUTS) {
                 throw new UnsupportedOperationException("Currently not supported");
             } else {
-                ArrayList<LayoutNode> currentNodes = new ArrayList<LayoutNode>(nodes);
+                ArrayList<LayoutNode> currentNodes = new ArrayList<>(nodes);
                 for (LayoutNode n : currentNodes) {
                     for (LayoutEdge e : n.succs) {
                         processSingleEdge(e);
@@ -1568,6 +1232,7 @@
             n.preds.add(e);
             nodes.add(n);
             LayoutEdge result = new LayoutEdge();
+            result.vip = e.vip;
             n.succs.add(result);
             result.from = n;
             result.relativeFrom = n.width / 2;
@@ -1587,7 +1252,7 @@
 
         @Override
         public void postCheck() {
-            ArrayList<LayoutNode> currentNodes = new ArrayList<LayoutNode>(nodes);
+            ArrayList<LayoutNode> currentNodes = new ArrayList<>(nodes);
             for (LayoutNode n : currentNodes) {
                 for (LayoutEdge e : n.succs) {
                     assert e.from.layer == e.to.layer - 1;
@@ -1612,11 +1277,12 @@
             }
         }
 
+        @Override
         protected void run() {
 
-            List<LayoutNode> insertOrder = new ArrayList<LayoutNode>();
+            List<LayoutNode> insertOrder = new ArrayList<>();
 
-            HashSet<LayoutNode> set = new HashSet<LayoutNode>();
+            HashSet<LayoutNode> set = new HashSet<>();
             for (LayoutNode n : nodes) {
                 if (n.preds.size() == 0) {
                     set.add(n);
@@ -1626,8 +1292,8 @@
             }
 
             int z = minLayerDifference;
-            HashSet<LayoutNode> newSet = new HashSet<LayoutNode>();
-            HashSet<LayoutNode> failed = new HashSet<LayoutNode>();
+            HashSet<LayoutNode> newSet = new HashSet<>();
+            HashSet<LayoutNode> failed = new HashSet<>();
             while (!set.isEmpty()) {
 
                 newSet.clear();
@@ -1718,11 +1384,12 @@
         private HashSet<LayoutNode> visited;
         private HashSet<LayoutNode> active;
 
+        @Override
         protected void run() {
 
             // Remove self-edges
             for (LayoutNode node : nodes) {
-                ArrayList<LayoutEdge> succs = new ArrayList<LayoutEdge>(node.succs);
+                ArrayList<LayoutEdge> succs = new ArrayList<>(node.succs);
                 for (LayoutEdge e : succs) {
                     assert e.from == node;
                     if (e.to == node) {
@@ -1750,8 +1417,8 @@
 
 
             // Start DFS and reverse back edges
-            visited = new HashSet<LayoutNode>();
-            active = new HashSet<LayoutNode>();
+            visited = new HashSet<>();
+            active = new HashSet<>();
             for (LayoutNode node : nodes) {
                 DFS(node);
             }
@@ -1759,7 +1426,7 @@
 
             for (LayoutNode node : nodes) {
 
-                SortedSet<Integer> reversedDown = new TreeSet<Integer>();
+                SortedSet<Integer> reversedDown = new TreeSet<>();
 
                 for (LayoutEdge e : node.succs) {
                     if (reversedLinks.contains(e.link)) {
@@ -1770,9 +1437,9 @@
 
                 SortedSet<Integer> reversedUp = null;
                 if (reversedDown.size() == 0) {
-                    reversedUp = new TreeSet<Integer>(Collections.reverseOrder());
+                    reversedUp = new TreeSet<>(Collections.reverseOrder());
                 } else {
-                    reversedUp = new TreeSet<Integer>();
+                    reversedUp = new TreeSet<>();
                 }
 
                 for (LayoutEdge e : node.preds) {
@@ -1786,7 +1453,7 @@
                 int curX = 0;
                 int curWidth = node.width + reversedDown.size() * offset;
                 for (int pos : reversedDown) {
-                    ArrayList<LayoutEdge> reversedSuccs = new ArrayList<LayoutEdge>();
+                    ArrayList<LayoutEdge> reversedSuccs = new ArrayList<>();
                     for (LayoutEdge e : node.succs) {
                         if (e.relativeFrom == pos && reversedLinks.contains(e.link)) {
                             reversedSuccs.add(e);
@@ -1794,7 +1461,7 @@
                         }
                     }
 
-                    ArrayList<Point> startPoints = new ArrayList<Point>();
+                    ArrayList<Point> startPoints = new ArrayList<>();
                     startPoints.add(new Point(curWidth, curX));
                     startPoints.add(new Point(pos, curX));
                     startPoints.add(new Point(pos, reversedDown.size() * offset));
@@ -1824,7 +1491,7 @@
 
                 int oldNodeHeight = node.height;
                 for (int pos : reversedUp) {
-                    ArrayList<LayoutEdge> reversedPreds = new ArrayList<LayoutEdge>();
+                    ArrayList<LayoutEdge> reversedPreds = new ArrayList<>();
                     for (LayoutEdge e : node.preds) {
                         if (e.relativeTo == pos && reversedLinks.contains(e.link)) {
                             if (reversedDown.size() == 0) {
@@ -1837,7 +1504,7 @@
                         }
                     }
                     node.height += offset;
-                    ArrayList<Point> endPoints = new ArrayList<Point>();
+                    ArrayList<Point> endPoints = new ArrayList<>();
 
                     if (reversedDown.size() == 0) {
 
@@ -1885,7 +1552,7 @@
                 return;
             }
 
-            Stack<LayoutNode> stack = new Stack<LayoutNode>();
+            Stack<LayoutNode> stack = new Stack<>();
             stack.push(startNode);
 
             while (!stack.empty()) {
@@ -1902,7 +1569,7 @@
                 visited.add(node);
                 active.add(node);
 
-                ArrayList<LayoutEdge> succs = new ArrayList<LayoutEdge>(node.succs);
+                ArrayList<LayoutEdge> succs = new ArrayList<>(node.succs);
                 for (LayoutEdge e : succs) {
                     if (active.contains(e.to)) {
                         assert visited.contains(e.to);
@@ -1957,8 +1624,8 @@
 
             for (LayoutNode n : nodes) {
 
-                HashSet<LayoutNode> curVisited = new HashSet<LayoutNode>();
-                Queue<LayoutNode> queue = new LinkedList<LayoutNode>();
+                HashSet<LayoutNode> curVisited = new HashSet<>();
+                Queue<LayoutNode> queue = new LinkedList<>();
                 for (LayoutEdge e : n.succs) {
                     LayoutNode s = e.to;
                     queue.add(s);
@@ -1981,6 +1648,7 @@
     }
     private Comparator<Link> linkComparator = new Comparator<Link>() {
 
+        @Override
         public int compare(Link l1, Link l2) {
 
             int result = l1.getFrom().getVertex().compareTo(l2.getFrom().getVertex());
@@ -2002,9 +1670,10 @@
 
     private class BuildDatastructure extends AlgorithmPart {
 
+        @Override
         protected void run() {
             // Set up nodes
-            List<Vertex> vertices = new ArrayList<Vertex>(graph.getVertices());
+            List<Vertex> vertices = new ArrayList<>(graph.getVertices());
             Collections.sort(vertices);
 
             for (Vertex v : vertices) {
@@ -2018,7 +1687,7 @@
             }
 
             // Set up edges
-            List<Link> links = new ArrayList<Link>(graph.getLinks());
+            List<Link> links = new ArrayList<>(graph.getLinks());
             Collections.sort(links, linkComparator);
             for (Link l : links) {
                 LayoutEdge edge = new LayoutEdge();
@@ -2031,6 +1700,7 @@
                 edge.link = l;
                 edge.from.succs.add(edge);
                 edge.to.preds.add(edge);
+                edge.vip = l.isVIP();
             //assert edge.from != edge.to; // No self-loops allowed
             }
 
@@ -2072,6 +1742,7 @@
         }
     }
 
+    @Override
     public void doRouting(LayoutGraph graph) {
         // Do nothing for now
     }
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/InterClusterConnection.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.hierarchicallayout;
-
-import com.sun.hotspot.igv.layout.Link;
-import com.sun.hotspot.igv.layout.Port;
-import java.awt.Point;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class InterClusterConnection implements Link {
-
-    private Port inputSlot;
-    private Port outputSlot;
-    private List<Point> intermediatePoints;
-    private ClusterInputSlotNode inputSlotNode;
-    private ClusterOutputSlotNode outputSlotNode;
-
-    public InterClusterConnection(ClusterOutputSlotNode outputSlotNode, ClusterInputSlotNode inputSlotNode) {
-        this.outputSlotNode = outputSlotNode;
-        this.inputSlotNode = inputSlotNode;
-        this.inputSlot = inputSlotNode.getInputSlot();
-        this.outputSlot = outputSlotNode.getOutputSlot();
-        intermediatePoints = new ArrayList<Point>();
-    }
-
-    public ClusterOutputSlotNode getOutputSlotNode() {
-        return outputSlotNode;
-    }
-
-    public Port getTo() {
-        return inputSlot;
-    }
-
-    public Port getFrom() {
-        return outputSlot;
-    }
-
-    public void setControlPoints(List<Point> p) {
-        this.intermediatePoints = p;
-    }
-
-    public List<Point> getControlPoints() {
-        return intermediatePoints;
-    }
-
-    @Override
-    public String toString() {
-        return "InterClusterConnection[from=" + getFrom() + ", to=" + getTo() + "]";
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Node.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Node.java	Thu Feb 02 16:07:52 2012 -0800
@@ -90,8 +90,8 @@
     protected Node(Graph<N, E> graph, N data) {
         setData(data);
         this.graph = graph;
-        inEdges = new ArrayList<Edge<N, E>>();
-        outEdges = new ArrayList<Edge<N, E>>();
+        inEdges = new ArrayList<>();
+        outEdges = new ArrayList<>();
     }
 
     protected void addInEdge(Edge<N, E> e) {
@@ -125,7 +125,7 @@
     }
 
     public List<Node<N, E>> getSuccessors() {
-        ArrayList<Node<N, E>> succ = new ArrayList<Node<N, E>>();
+        ArrayList<Node<N, E>> succ = new ArrayList<>();
         for (Edge<N, E> e : getOutEdges()) {
             Node<N, E> n = e.getDest();
             if (!succ.contains(n)) {
@@ -136,7 +136,7 @@
     }
 
     public List<Node<N, E>> getPredecessors() {
-        ArrayList<Node<N, E>> pred = new ArrayList<Node<N, E>>();
+        ArrayList<Node<N, E>> pred = new ArrayList<>();
         for (Edge<N, E> e : getInEdges()) {
             Node<N, E> n = e.getSource();
             if (!pred.contains(n)) {
--- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/OldHierarchicalLayoutManager.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1222 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.hierarchicallayout;
-
-import java.awt.Point;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import com.sun.hotspot.igv.layout.LayoutGraph;
-import com.sun.hotspot.igv.layout.LayoutManager;
-import com.sun.hotspot.igv.layout.Link;
-import com.sun.hotspot.igv.layout.Port;
-import com.sun.hotspot.igv.layout.Vertex;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class OldHierarchicalLayoutManager implements LayoutManager {
-
-    public static final int DUMMY_WIDTH = 0;
-    public static final int DUMMY_HEIGHT = 0;
-    public static final int LAYER_OFFSET = 50;
-    public static final int OFFSET = 8;
-    public static final boolean VERTICAL_LAYOUT = true;
-    public static final boolean ASSERT = false;
-    public static final boolean TRACE = false;
-    public static final Timing initTiming = new Timing("init");
-    public static final Timing removeCyclesTiming = new Timing("removeCycles");
-    public static final Timing reversedEdgesTiming = new Timing("reversedEdges");
-    public static final Timing assignLayersTiming = new Timing("assignLayers");
-    public static final Timing dummyNodesTiming = new Timing("dummyNodes");
-    public static final Timing crossingReductionTiming = new Timing("crossingReduction");
-    public static final Timing assignCoordinatesTiming = new Timing("assignCoordinates");
-    public static final Timing assignRealTiming = new Timing("assignReal");
-    public static final Timing rootVertexTiming = new Timing("rootVertex");
-    public static final Timing createEdgesTiming = new Timing("createEdges");
-    public static final Timing optimizeMedianTiming = new Timing("optimizeMedian");
-    private Combine combine;
-
-    public enum Combine {
-
-        NONE,
-        SAME_INPUTS,
-        SAME_OUTPUTS
-    }
-
-    private class NodeData {
-
-        private Map<Port, Integer> reversePositions;
-        private Vertex node;
-        private Link edge;
-        private int layer;
-        private int x;
-        private int y;
-        private int width;
-
-        public NodeData(Vertex node) {
-            reversePositions = new HashMap<Port, Integer>();
-            layer = -1;
-            this.node = node;
-            assert node != null;
-
-            if (VERTICAL_LAYOUT) {
-                width = node.getSize().width;
-            } else {
-                width = node.getSize().height;
-            }
-        }
-
-        public NodeData(Link edge) {
-            layer = -1;
-            this.edge = edge;
-            assert edge != null;
-
-            if (VERTICAL_LAYOUT) {
-                width = DUMMY_WIDTH;
-            } else {
-                width = DUMMY_HEIGHT;
-            }
-        }
-
-        public Vertex getNode() {
-            return node;
-        }
-
-        public Link getEdge() {
-            return edge;
-        }
-
-        public int getCoordinate() {
-            return x;
-        }
-
-        public void setCoordinate(int x) {
-            this.x = x;
-        }
-
-        public int getX() {
-            if (VERTICAL_LAYOUT) {
-                return x;
-            } else {
-                return y;
-            }
-        }
-
-        public int getY() {
-            if (VERTICAL_LAYOUT) {
-                return y;
-            } else {
-                return x;
-            }
-        }
-
-        public void setLayerCoordinate(int y) {
-            this.y = y;
-        }
-
-        public void setLayer(int x) {
-            layer = x;
-        }
-
-        public int getLayer() {
-            return layer;
-        }
-
-        public boolean isDummy() {
-            return edge != null;
-        }
-
-        public int getWidth() {
-            return width;
-        }
-
-        public void addReversedStartEdge(Edge<NodeData, EdgeData> e) {
-            assert e.getData().isReversed();
-            Port port = e.getData().getEdge().getTo();
-            int pos = addReversedPort(port);
-            Point start = e.getData().getRelativeStart();
-            e.getData().addStartPoint(start);
-            int yCoord = node.getSize().height + width - node.getSize().width;
-            e.getData().addStartPoint(new Point(start.x, yCoord));
-            e.getData().addStartPoint(new Point(pos, yCoord));
-            e.getData().setRelativeStart(new Point(pos, 0));
-        }
-
-        private int addReversedPort(Port p) {
-            if (reversePositions.containsKey(p)) {
-                return reversePositions.get(p);
-            } else {
-                width += OFFSET;
-                reversePositions.put(p, width);
-                return width;
-            }
-        }
-
-        public void addReversedEndEdge(Edge<NodeData, EdgeData> e) {
-            assert e.getData().isReversed();
-            int pos = addReversedPort(e.getData().getEdge().getFrom());
-            Point end = e.getData().getRelativeEnd();
-            e.getData().setRelativeEnd(new Point(pos, node.getSize().height));
-            int yCoord = 0 - width + node.getSize().width;
-            e.getData().addEndPoint(new Point(pos, yCoord));
-            e.getData().addEndPoint(new Point(end.x, yCoord));
-            e.getData().addEndPoint(end);
-        }
-
-        public int getHeight() {
-            if (isDummy()) {
-                if (VERTICAL_LAYOUT) {
-                    return DUMMY_HEIGHT;
-                } else {
-                    return DUMMY_WIDTH;
-                }
-
-            } else {
-                if (VERTICAL_LAYOUT) {
-                    return node.getSize().height;
-                } else {
-                    return node.getSize().width;
-                }
-            }
-        }
-
-        @Override
-        public String toString() {
-            if (isDummy()) {
-                return edge.toString() + "(layer=" + layer + ")";
-            } else {
-                return node.toString() + "(layer=" + layer + ")";
-            }
-        }
-    }
-
-    private class EdgeData {
-
-        private Point relativeEnd;
-        private Point relativeStart;
-        private List<Point> startPoints;
-        private List<Point> endPoints;
-        private boolean important;
-        private boolean reversed;
-        private Link edge;
-
-        public EdgeData(Link edge) {
-            this(edge, false);
-        }
-
-        public EdgeData(Link edge, boolean rev) {
-            this.edge = edge;
-            reversed = rev;
-            relativeStart = edge.getFrom().getRelativePosition();
-            relativeEnd = edge.getTo().getRelativePosition();
-            assert relativeStart.x >= 0 && relativeStart.x <= edge.getFrom().getVertex().getSize().width;
-            assert relativeStart.y >= 0 && relativeStart.y <= edge.getFrom().getVertex().getSize().height;
-            assert relativeEnd.x >= 0 && relativeEnd.x <= edge.getTo().getVertex().getSize().width;
-            assert relativeEnd.y >= 0 && relativeEnd.y <= edge.getTo().getVertex().getSize().height;
-            startPoints = new ArrayList<Point>();
-            endPoints = new ArrayList<Point>();
-            this.important = true;
-        }
-
-        public boolean isImportant() {
-            return important;
-        }
-
-        public void setImportant(boolean b) {
-            this.important = b;
-        }
-
-        public List<Point> getStartPoints() {
-            return startPoints;
-        }
-
-        public List<Point> getEndPoints() {
-            return endPoints;
-        }
-
-        public List<Point> getAbsoluteEndPoints() {
-            if (endPoints.size() == 0) {
-                return endPoints;
-            }
-
-            List<Point> result = new ArrayList<Point>();
-            Point point = edge.getTo().getVertex().getPosition();
-            for (Point p : endPoints) {
-                Point p2 = new Point(p.x + point.x, p.y + point.y);
-                result.add(p2);
-            }
-
-            return result;
-        }
-
-        public List<Point> getAbsoluteStartPoints() {
-            if (startPoints.size() == 0) {
-                return startPoints;
-            }
-
-            List<Point> result = new ArrayList<Point>();
-            Point point = edge.getFrom().getVertex().getPosition();
-            for (Point p : startPoints) {
-                Point p2 = new Point(p.x + point.x, p.y + point.y);
-                result.add(p2);
-            }
-
-            return result;
-        }
-
-        public void addEndPoint(Point p) {
-            endPoints.add(p);
-        }
-
-        public void addStartPoint(Point p) {
-            startPoints.add(p);
-        }
-
-        public Link getEdge() {
-            return edge;
-        }
-
-        public void setRelativeEnd(Point p) {
-            relativeEnd = p;
-        }
-
-        public void setRelativeStart(Point p) {
-            relativeStart = p;
-        }
-
-        public Point getRelativeEnd() {
-            return relativeEnd;
-        }
-
-        public Point getRelativeStart() {
-            return relativeStart;
-        }
-
-        public boolean isReversed() {
-            return reversed;
-        }
-
-        public void setReversed(boolean b) {
-            reversed = b;
-        }
-
-        @Override
-        public String toString() {
-            return "EdgeData[reversed=" + reversed + "]";
-        }
-    }
-    private Graph<NodeData, EdgeData> graph;
-    private Map<Vertex, Node<NodeData, EdgeData>> nodeMap;
-    private int layerOffset;
-
-    /** Creates a new instance of HierarchicalPositionManager */
-    public OldHierarchicalLayoutManager(Combine combine) {
-        this(combine, LAYER_OFFSET);
-    }
-
-    public OldHierarchicalLayoutManager(Combine combine, int layerOffset) {
-        this.combine = combine;
-        this.layerOffset = layerOffset;
-    }
-
-    public void doRouting(LayoutGraph graph) {
-    }
-
-    //public void setPositions(PositionedNode rootNode, List<? extends PositionedNode> nodes, List<? extends PositionedEdge> edges) {
-    public void doLayout(LayoutGraph layoutGraph) {
-        doLayout(layoutGraph, new HashSet<Vertex>(), new HashSet<Vertex>());
-    }
-
-    public void doLayout(LayoutGraph layoutGraph, Set<? extends Vertex> firstLayerHint, Set<? extends Vertex> lastLayerHint) {
-        doLayout(layoutGraph, firstLayerHint, lastLayerHint, new HashSet<Link>());
-    }
-
-    public void doLayout(LayoutGraph layoutGraph, Set<? extends Vertex> firstLayerHint, Set<? extends Vertex> lastLayerHint, Set<? extends Link> importantLinksHint) {
-
-        if (TRACE) {
-            System.out.println("HierarchicalPositionManager.doLayout called");
-            System.out.println("Vertex count = " + layoutGraph.getVertices().size() + " Link count = " + layoutGraph.getLinks().size());
-        }
-
-        // Nothing to do => quit immediately
-        if (layoutGraph.getVertices().size() == 0) {
-            return;
-        }
-
-        initTiming.start();
-
-        // Mapping vertex to Node in graph
-        nodeMap = new HashMap<Vertex, Node<NodeData, EdgeData>>();
-
-        graph = new Graph<NodeData, EdgeData>();
-
-        Set<Node<NodeData, EdgeData>> rootNodes = new HashSet<Node<NodeData, EdgeData>>();
-        Set<Vertex> startRootVertices = new HashSet<Vertex>();
-
-        for (Vertex v : layoutGraph.getVertices()) {
-            if (v.isRoot()) {
-                startRootVertices.add(v);
-            }
-        }
-
-        rootVertexTiming.start();
-        Set<Vertex> rootVertices = layoutGraph.findRootVertices(startRootVertices);
-        rootVertexTiming.stop();
-
-
-        for (Vertex node : layoutGraph.getVertices()) {
-
-            NodeData data = new NodeData(node);
-            Node<NodeData, EdgeData> n = graph.createNode(data, node);
-            nodeMap.put(node, n);
-
-            if (rootVertices.contains(node)) {
-                rootNodes.add(n);
-            }
-        }
-
-        Set<? extends Link> links = layoutGraph.getLinks();
-        Link[] linkArr = new Link[links.size()];
-        links.toArray(linkArr);
-
-        List<Link> linkList = new ArrayList<Link>();
-        for (Link l : linkArr) {
-            linkList.add(l);
-        }
-
-        createEdgesTiming.start();
-        Collections.sort(linkList, new Comparator<Link>() {
-
-            public int compare(Link o1, Link o2) {
-                int result = o1.getFrom().getVertex().compareTo(o2.getFrom().getVertex());
-                if (result == 0) {
-                    return o1.getTo().getVertex().compareTo(o2.getTo().getVertex());
-                } else {
-                    return result;
-                }
-            }
-        });
-
-        for (Link edge : linkList) {
-            EdgeData data = new EdgeData(edge);
-            graph.createEdge(graph.getNode(edge.getFrom().getVertex()), graph.getNode(edge.getTo().getVertex()), data, data);
-            if (importantLinksHint.size() > 0 && !importantLinksHint.contains(edge)) {
-                data.setImportant(false);
-            }
-        }
-        createEdgesTiming.stop();
-
-        initTiming.stop();
-
-        removeCyclesTiming.start();
-
-        // STEP 1: Remove cycles!
-        removeCycles(rootNodes);
-        if (ASSERT) {
-            assert checkRemoveCycles();
-        }
-
-        removeCyclesTiming.stop();
-
-        reversedEdgesTiming.start();
-
-        for (Node<NodeData, EdgeData> n : graph.getNodes()) {
-            List<Edge<NodeData, EdgeData>> edges = new ArrayList<Edge<NodeData, EdgeData>>(n.getOutEdges());
-            Collections.sort(edges, new Comparator<Edge<NodeData, EdgeData>>() {
-
-                public int compare(Edge<NodeData, EdgeData> o1, Edge<NodeData, EdgeData> o2) {
-                    return o2.getData().getRelativeEnd().x - o1.getData().getRelativeEnd().x;
-                }
-            });
-
-
-            for (Edge<NodeData, EdgeData> e : edges) {
-
-                if (e.getData().isReversed()) {
-                    e.getSource().getData().addReversedEndEdge(e);
-                }
-            }
-        }
-
-        for (Node<NodeData, EdgeData> n : graph.getNodes()) {
-            List<Edge<NodeData, EdgeData>> edges = new ArrayList<Edge<NodeData, EdgeData>>(n.getInEdges());
-            Collections.sort(edges, new Comparator<Edge<NodeData, EdgeData>>() {
-
-                public int compare(Edge<NodeData, EdgeData> o1, Edge<NodeData, EdgeData> o2) {
-                    return o2.getData().getRelativeStart().x - o1.getData().getRelativeStart().x;
-                }
-            });
-
-
-            for (Edge<NodeData, EdgeData> e : edges) {
-                if (e.getData().isReversed()) {
-                    e.getDest().getData().addReversedStartEdge(e);
-                }
-            }
-        }
-
-        reversedEdgesTiming.stop();
-
-        assignLayersTiming.start();
-        // STEP 2: Assign layers!
-        int maxLayer = assignLayers(rootNodes, firstLayerHint, lastLayerHint);
-        if (ASSERT) {
-            assert checkAssignLayers();
-        }
-
-        // Put into layer array
-        //int maxLayer = 0;
-        //for(Node<NodeData, EdgeData> n : graph.getNodes()) {
-        //    maxLayer = Math.max(maxLayer, n.getData().getLayer());
-        //}
-
-
-        @SuppressWarnings("unchecked")
-        ArrayList<Node<NodeData, EdgeData>> layers[] = (ArrayList<Node<NodeData, EdgeData>>[]) new ArrayList[maxLayer + 1];
-        int layerSizes[] = new int[maxLayer + 1];
-        for (int i = 0; i < maxLayer + 1; i++) {
-            layers[i] = new ArrayList<Node<NodeData, EdgeData>>();
-        }
-
-        for (Node<NodeData, EdgeData> n : graph.getNodes()) {
-            int curLayer = n.getData().getLayer();
-            layers[curLayer].add(n);
-        }
-
-        assignLayersTiming.stop();
-
-        // STEP 3: Insert dummy nodes!
-        dummyNodesTiming.start();
-        insertDummyNodes(layers);
-        if (ASSERT) {
-            assert checkDummyNodes();
-        }
-        dummyNodesTiming.stop();
-
-        crossingReductionTiming.start();
-        // STEP 4: Assign Y coordinates
-        assignLayerCoordinates(layers, layerSizes);
-
-        // STEP 5: Crossing reduction
-        crossingReduction(layers);
-        crossingReductionTiming.stop();
-
-        // STEP 6: Assign Y coordinates
-        assignCoordinatesTiming.start();
-        assignCoordinates(layers);
-        assignCoordinatesTiming.stop();
-
-        assignRealTiming.start();
-
-        // Assign coordinates of nodes to real objects
-        for (Node<NodeData, EdgeData> n : graph.getNodes()) {
-            if (!n.getData().isDummy()) {
-
-                Vertex node = n.getData().getNode();
-                node.setPosition(new Point(n.getData().getX(), n.getData().getY()));
-            }
-        }
-
-        for (Node<NodeData, EdgeData> n : graph.getNodes()) {
-            if (!n.getData().isDummy()) {
-
-                Vertex node = n.getData().getNode();
-
-                List<Edge<NodeData, EdgeData>> outEdges = n.getOutEdges();
-                for (Edge<NodeData, EdgeData> e : outEdges) {
-                    Node<NodeData, EdgeData> succ = e.getDest();
-                    if (succ.getData().isDummy()) {
-                        //PositionedEdge edge = succ.getData().getEdge();
-                        List<Point> points = new ArrayList<Point>();
-                        assignToRealObjects(layerSizes, succ, points);
-                    } else {
-                        List<Point> points = new ArrayList<Point>();
-
-                        EdgeData otherEdgeData = e.getData();
-                        points.addAll(otherEdgeData.getAbsoluteStartPoints());
-                        Link otherEdge = otherEdgeData.getEdge();
-                        Point relFrom = new Point(otherEdgeData.getRelativeStart());
-                        Point from = otherEdge.getFrom().getVertex().getPosition();
-                        relFrom.move(relFrom.x + from.x, relFrom.y + from.y);
-                        points.add(relFrom);
-
-                        Point relTo = new Point(otherEdgeData.getRelativeEnd());
-                        Point to = otherEdge.getTo().getVertex().getPosition();
-                        relTo.move(relTo.x + to.x, relTo.y + to.y);
-                        assert from != null;
-                        assert to != null;
-                        points.add(relTo);
-                        points.addAll(otherEdgeData.getAbsoluteEndPoints());
-                        e.getData().getEdge().setControlPoints(points);
-                    }
-                }
-            }
-        }
-
-        assignRealTiming.stop();
-
-        initTiming.print();
-        removeCyclesTiming.print();
-        reversedEdgesTiming.print();
-        assignLayersTiming.print();
-        dummyNodesTiming.print();
-        crossingReductionTiming.print();
-        assignCoordinatesTiming.print();
-        assignRealTiming.print();
-        rootVertexTiming.print();
-        createEdgesTiming.print();
-        optimizeMedianTiming.print();
-    }
-
-    public boolean onOneLine(Point p1, Point p2, Point p3) {
-        int xoff1 = p1.x - p2.x;
-        int yoff1 = p1.y - p2.y;
-        int xoff2 = p3.x - p2.x;
-        int yoff2 = p3.y - p2.x;
-
-        return (xoff1 * yoff2 - yoff1 * xoff2 == 0);
-    }
-
-    private void assignToRealObjects(int layerSizes[], Node<NodeData, EdgeData> cur, List<Point> points) {
-        assert cur.getData().isDummy();
-
-        ArrayList<Point> otherPoints = new ArrayList<Point>(points);
-
-        int size = layerSizes[cur.getData().getLayer()];
-        otherPoints.add(new Point(cur.getData().getX(), cur.getData().getY() - size / 2));
-        if (otherPoints.size() >= 3 && onOneLine(otherPoints.get(otherPoints.size() - 1), otherPoints.get(otherPoints.size() - 2), otherPoints.get(otherPoints.size() - 3))) {
-            otherPoints.remove(otherPoints.size() - 2);
-        }
-        otherPoints.add(new Point(cur.getData().getX(), cur.getData().getY() + size / 2));
-        if (otherPoints.size() >= 3 && onOneLine(otherPoints.get(otherPoints.size() - 1), otherPoints.get(otherPoints.size() - 2), otherPoints.get(otherPoints.size() - 3))) {
-            otherPoints.remove(otherPoints.size() - 2);
-        }
-
-        for (int i = 0; i < cur.getOutEdges().size(); i++) {
-            Node<NodeData, EdgeData> otherSucc = cur.getOutEdges().get(i).getDest();
-
-            if (otherSucc.getData().isDummy()) {
-                assignToRealObjects(layerSizes, otherSucc, otherPoints);
-            } else {
-                EdgeData otherEdgeData = cur.getOutEdges().get(i).getData();
-                Link otherEdge = otherEdgeData.getEdge();
-
-                List<Point> middlePoints = new ArrayList<Point>(otherPoints);
-                if (cur.getOutEdges().get(i).getData().isReversed()) {
-                    Collections.reverse(middlePoints);
-                }
-
-                ArrayList<Point> copy = new ArrayList<Point>();
-                Point relFrom = new Point(otherEdgeData.getRelativeStart());
-                Point from = otherEdge.getFrom().getVertex().getPosition();
-                //int moveUp = (size - otherEdge.getFrom().getVertex().getSize().height) / 2;
-                relFrom.move(relFrom.x + from.x, relFrom.y + from.y);
-                copy.addAll(otherEdgeData.getAbsoluteStartPoints());
-                copy.add(relFrom);
-                copy.addAll(middlePoints);
-
-                Point relTo = new Point(otherEdgeData.getRelativeEnd());
-                Point to = otherEdge.getTo().getVertex().getPosition();
-                relTo.move(relTo.x + to.x, relTo.y + to.y);
-                copy.add(relTo);
-
-                copy.addAll(otherEdgeData.getAbsoluteEndPoints());
-
-
-                otherEdge.setControlPoints(copy);
-            }
-        }
-    }
-
-    private boolean checkDummyNodes() {
-        for (Edge<NodeData, EdgeData> e : graph.getEdges()) {
-            if (e.getSource().getData().getLayer() != e.getDest().getData().getLayer() - 1) {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    private void insertDummyNodes(ArrayList<Node<NodeData, EdgeData>> layers[]) {
-
-        int sum = 0;
-        List<Node<NodeData, EdgeData>> nodes = new ArrayList<Node<NodeData, EdgeData>>(graph.getNodes());
-        int edgeCount = 0;
-        int innerMostLoop = 0;
-
-        for (Node<NodeData, EdgeData> n : nodes) {
-            List<Edge<NodeData, EdgeData>> edges = new ArrayList<Edge<NodeData, EdgeData>>(n.getOutEdges());
-            for (Edge<NodeData, EdgeData> e : edges) {
-
-                edgeCount++;
-                Link edge = e.getData().getEdge();
-                Node<NodeData, EdgeData> destNode = e.getDest();
-                Node<NodeData, EdgeData> lastNode = n;
-                Edge<NodeData, EdgeData> lastEdge = e;
-
-                boolean searchForNode = (combine != Combine.NONE);
-                for (int i = n.getData().getLayer() + 1; i < destNode.getData().getLayer(); i++) {
-
-                    Node<NodeData, EdgeData> foundNode = null;
-                    if (searchForNode) {
-                        for (Node<NodeData, EdgeData> sameLayerNode : layers[i]) {
-                            innerMostLoop++;
-
-                            if (combine == Combine.SAME_OUTPUTS) {
-                                if (sameLayerNode.getData().isDummy() && sameLayerNode.getData().getEdge().getFrom() == edge.getFrom()) {
-                                    foundNode = sameLayerNode;
-                                    break;
-                                }
-                            } else if (combine == Combine.SAME_INPUTS) {
-                                if (sameLayerNode.getData().isDummy() && sameLayerNode.getData().getEdge().getTo() == edge.getTo()) {
-                                    foundNode = sameLayerNode;
-                                    break;
-                                }
-                            }
-                        }
-                    }
-
-                    if (foundNode == null) {
-                        searchForNode = false;
-                        NodeData intermediateData = new NodeData(edge);
-                        Node<NodeData, EdgeData> curNode = graph.createNode(intermediateData, null);
-                        curNode.getData().setLayer(i);
-                        layers[i].add(0, curNode);
-                        sum++;
-                        lastEdge.remove();
-                        graph.createEdge(lastNode, curNode, e.getData(), null);
-                        assert lastNode.getData().getLayer() == curNode.getData().getLayer() - 1;
-                        lastEdge = graph.createEdge(curNode, destNode, e.getData(), null);
-                        lastNode = curNode;
-                    } else {
-                        lastEdge.remove();
-                        lastEdge = graph.createEdge(foundNode, destNode, e.getData(), null);
-                        lastNode = foundNode;
-                    }
-
-                }
-            }
-        }
-
-        if (TRACE) {
-            System.out.println("Number of edges: " + edgeCount);
-        }
-        if (TRACE) {
-            System.out.println("Dummy nodes inserted: " + sum);
-        }
-    }
-
-    private void assignLayerCoordinates(ArrayList<Node<NodeData, EdgeData>> layers[], int layerSizes[]) {
-        int cur = 0;
-        for (int i = 0; i < layers.length; i++) {
-            int maxHeight = 0;
-            for (Node<NodeData, EdgeData> n : layers[i]) {
-                maxHeight = Math.max(maxHeight, n.getData().getHeight());
-            }
-
-            layerSizes[i] = maxHeight;
-            for (Node<NodeData, EdgeData> n : layers[i]) {
-                int curCoordinate = cur + (maxHeight - n.getData().getHeight()) / 2;
-                n.getData().setLayerCoordinate(curCoordinate);
-            }
-            cur += maxHeight + layerOffset;
-
-        }
-    }
-
-    private void assignCoordinates(ArrayList<Node<NodeData, EdgeData>> layers[]) {
-
-        for (int i = 0; i < layers.length; i++) {
-            ArrayList<Node<NodeData, EdgeData>> curArray = layers[i];
-            int curY = 0;
-            for (Node<NodeData, EdgeData> n : curArray) {
-
-                n.getData().setCoordinate(curY);
-                if (!n.getData().isDummy()) {
-                    curY += n.getData().getWidth();
-                }
-                curY += OFFSET;
-
-            }
-        }
-
-        int curSol = evaluateSolution();
-        if (TRACE) {
-            System.out.println("First coordinate solution found: " + curSol);
-        }
-
-        // Sort to correct order
-        for (int i = 0; i < layers.length; i++) {
-            Collections.sort(layers[i], new Comparator<Node<NodeData, EdgeData>>() {
-
-                public int compare(Node<NodeData, EdgeData> o1, Node<NodeData, EdgeData> o2) {
-                    if (o2.getData().isDummy()) {
-                        return 1;
-                    } else if (o1.getData().isDummy()) {
-                        return -1;
-                    }
-                    return o2.getInEdges().size() + o2.getOutEdges().size() - o1.getInEdges().size() - o1.getOutEdges().size();
-                }
-            });
-        }
-
-
-        optimizeMedianTiming.start();
-        for (int i = 0; i < 2; i++) {
-            optimizeMedian(layers);
-            curSol = evaluateSolution();
-            if (TRACE) {
-                System.out.println("Current coordinate solution found: " + curSol);
-            }
-        }
-        optimizeMedianTiming.stop();
-        normalizeCoordinate();
-
-    }
-
-    private void normalizeCoordinate() {
-
-        int min = Integer.MAX_VALUE;
-        for (Node<NodeData, EdgeData> n : graph.getNodes()) {
-            min = Math.min(min, n.getData().getCoordinate());
-        }
-
-        for (Node<NodeData, EdgeData> n : graph.getNodes()) {
-            n.getData().setCoordinate(n.getData().getCoordinate() - min);
-        }
-
-    }
-
-    private void optimizeMedian(ArrayList<Node<NodeData, EdgeData>> layers[]) {
-
-        // Downsweep
-        for (int i = 1; i < layers.length; i++) {
-
-            ArrayList<Node<NodeData, EdgeData>> processingList = layers[i];
-            ArrayList<Node<NodeData, EdgeData>> alreadyAssigned = new ArrayList<Node<NodeData, EdgeData>>();
-            for (Node<NodeData, EdgeData> n : processingList) {
-
-
-                ArrayList<Node<NodeData, EdgeData>> preds = new ArrayList<Node<NodeData, EdgeData>>(n.getPredecessors());
-                int pos = n.getData().getCoordinate();
-                if (preds.size() > 0) {
-
-                    Collections.sort(preds, new Comparator<Node<NodeData, EdgeData>>() {
-
-                        public int compare(Node<NodeData, EdgeData> o1, Node<NodeData, EdgeData> o2) {
-                            return o1.getData().getCoordinate() - o2.getData().getCoordinate();
-                        }
-                    });
-
-                    if (preds.size() % 2 == 0) {
-                        assert preds.size() >= 2;
-                        pos = (preds.get(preds.size() / 2).getData().getCoordinate() - calcRelativeCoordinate(preds.get(preds.size() / 2), n) + preds.get(preds.size() / 2 - 1).getData().getCoordinate() - calcRelativeCoordinate(preds.get(preds.size() / 2 - 1), n)) / 2;
-                    } else {
-                        assert preds.size() >= 1;
-                        pos = preds.get(preds.size() / 2).getData().getCoordinate() - calcRelativeCoordinate(preds.get(preds.size() / 2), n);
-                    }
-                }
-
-                tryAdding(alreadyAssigned, n, pos);
-            }
-        }
-        // Upsweep
-        for (int i = layers.length - 2; i >= 0; i--) {
-            ArrayList<Node<NodeData, EdgeData>> processingList = layers[i];
-            ArrayList<Node<NodeData, EdgeData>> alreadyAssigned = new ArrayList<Node<NodeData, EdgeData>>();
-            for (Node<NodeData, EdgeData> n : processingList) {
-
-                ArrayList<Node<NodeData, EdgeData>> succs = new ArrayList<Node<NodeData, EdgeData>>(n.getSuccessors());
-                int pos = n.getData().getCoordinate();
-                if (succs.size() > 0) {
-
-                    Collections.sort(succs, new Comparator<Node<NodeData, EdgeData>>() {
-
-                        public int compare(Node<NodeData, EdgeData> o1, Node<NodeData, EdgeData> o2) {
-                            return o1.getData().getCoordinate() - o2.getData().getCoordinate();
-                        }
-                    });
-
-                    if (succs.size() % 2 == 0) {
-                        assert succs.size() >= 2;
-                        pos = (succs.get(succs.size() / 2).getData().getCoordinate() - calcRelativeCoordinate(n, succs.get(succs.size() / 2)) + succs.get(succs.size() / 2 - 1).getData().getCoordinate() - calcRelativeCoordinate(n, succs.get(succs.size() / 2 - 1))) / 2;
-                    } else {
-                        assert succs.size() >= 1;
-                        pos = succs.get(succs.size() / 2).getData().getCoordinate() - calcRelativeCoordinate(n, succs.get(succs.size() / 2));
-                    }
-                }
-
-                tryAdding(alreadyAssigned, n, pos);
-            }
-        }
-    }
-
-    private int median(ArrayList<Integer> arr) {
-        assert arr.size() > 0;
-        Collections.sort(arr);
-        if (arr.size() % 2 == 0) {
-            return (arr.get(arr.size() / 2) + arr.get(arr.size() / 2 - 1)) / 2;
-        } else {
-            return arr.get(arr.size() / 2);
-        }
-    }
-
-    private int calcRelativeCoordinate(Node<NodeData, EdgeData> n, Node<NodeData, EdgeData> succ) {
-
-        if (n.getData().isDummy() && succ.getData().isDummy()) {
-            return 0;
-        }
-
-        int pos = 0;
-        int pos2 = 0;
-        ArrayList<Integer> coords2 = new ArrayList<Integer>();
-        ArrayList<Integer> coords = new ArrayList<Integer>();
-        /*if(!n.getData().isDummy())*/ {
-            for (Edge<NodeData, EdgeData> e : n.getOutEdges()) {
-
-                //System.out.println("reversed: " + e.getData().isReversed());
-                if (e.getDest() == succ) {
-
-                    if (e.getData().isReversed()) {
-                        if (!n.getData().isDummy()) {
-                            coords.add(e.getData().getRelativeEnd().x);
-                        }
-
-                        if (!succ.getData().isDummy()) {
-                            coords2.add(e.getData().getRelativeStart().x);
-                        }
-                    } else {
-                        if (!n.getData().isDummy()) {
-                            coords.add(e.getData().getRelativeStart().x);
-                        }
-
-                        if (!succ.getData().isDummy()) {
-                            coords2.add(e.getData().getRelativeEnd().x);
-                        }
-                    }
-                }
-            }
-
-            // assert coords.size() > 0;
-            if (!n.getData().isDummy()) {
-                pos = median(coords);
-            }
-
-            if (!succ.getData().isDummy()) {
-                pos2 = median(coords2);
-            }
-        }
-        //System.out.println("coords=" + coords);
-        //System.out.println("coords2=" + coords2);
-
-        return pos - pos2;
-    }
-
-    private boolean intersect(int v1, int w1, int v2, int w2) {
-        if (v1 >= v2 && v1 < v2 + w2) {
-            return true;
-        }
-        if (v1 + w1 > v2 && v1 + w1 < v2 + w2) {
-            return true;
-        }
-        if (v1 < v2 && v1 + w1 > v2) {
-            return true;
-        }
-        return false;
-    }
-
-    private boolean intersect(Node<NodeData, EdgeData> n1, Node<NodeData, EdgeData> n2) {
-        return intersect(n1.getData().getCoordinate(), n1.getData().getWidth() + OFFSET, n2.getData().getCoordinate(), n2.getData().getWidth() + OFFSET);
-    }
-
-    private void tryAdding(List<Node<NodeData, EdgeData>> alreadyAssigned, Node<NodeData, EdgeData> node, int pos) {
-
-        boolean doesIntersect = false;
-        node.getData().setCoordinate(pos);
-        for (Node<NodeData, EdgeData> n : alreadyAssigned) {
-            if (n.getData().getCoordinate() + n.getData().getWidth() < pos) {
-                break;
-            } else if (intersect(node, n)) {
-                doesIntersect = true;
-                break;
-            }
-
-        }
-
-        if (!doesIntersect) {
-
-            // Everything fine, just place the node
-            int z = 0;
-            for (Node<NodeData, EdgeData> n : alreadyAssigned) {
-                if (pos > n.getData().getCoordinate()) {
-                    break;
-                }
-                z++;
-            }
-
-            if (z == -1) {
-                z = alreadyAssigned.size();
-            }
-
-
-            if (ASSERT) {
-                assert !findOverlap(alreadyAssigned, node);
-            }
-            alreadyAssigned.add(z, node);
-
-        } else {
-
-            assert alreadyAssigned.size() > 0;
-
-            // Search for alternative location
-            int minOffset = Integer.MAX_VALUE;
-            int minIndex = -1;
-            int minPos = 0;
-            int w = node.getData().getWidth() + OFFSET;
-
-            // Try top-most
-            minIndex = 0;
-            minPos = alreadyAssigned.get(0).getData().getCoordinate() + alreadyAssigned.get(0).getData().getWidth() + OFFSET;
-            minOffset = Math.abs(minPos - pos);
-
-            // Try bottom-most
-            Node<NodeData, EdgeData> lastNode = alreadyAssigned.get(alreadyAssigned.size() - 1);
-            int lastPos = lastNode.getData().getCoordinate() - w;
-            int lastOffset = Math.abs(lastPos - pos);
-            if (lastOffset < minOffset) {
-                minPos = lastPos;
-                minOffset = lastOffset;
-                minIndex = alreadyAssigned.size();
-            }
-
-            // Try between
-            for (int i = 0; i < alreadyAssigned.size() - 1; i++) {
-                Node<NodeData, EdgeData> curNode = alreadyAssigned.get(i);
-                Node<NodeData, EdgeData> nextNode = alreadyAssigned.get(i + 1);
-
-                int start = nextNode.getData().getCoordinate() + nextNode.getData().getWidth() + OFFSET;
-                int end = curNode.getData().getCoordinate() - OFFSET;
-
-                int bestPoss = end - node.getData().getWidth();
-                if (bestPoss < pos && pos - bestPoss > minOffset) {
-                    // No better solution possible => break
-                    break;
-                }
-
-                if (end - start >= node.getData().getWidth()) {
-                    // Node could fit here
-                    int cand1 = start;
-                    int cand2 = end - node.getData().getWidth();
-                    int off1 = Math.abs(cand1 - pos);
-                    int off2 = Math.abs(cand2 - pos);
-                    if (off1 < minOffset) {
-                        minPos = cand1;
-                        minOffset = off1;
-                        minIndex = i + 1;
-                    }
-
-                    if (off2 < minOffset) {
-                        minPos = cand2;
-                        minOffset = off2;
-                        minIndex = i + 1;
-                    }
-                }
-            }
-
-            assert minIndex != -1;
-            node.getData().setCoordinate(minPos);
-            if (ASSERT) {
-                assert !findOverlap(alreadyAssigned, node);
-            }
-            alreadyAssigned.add(minIndex, node);
-        }
-
-    }
-
-    private boolean findOverlap(List<Node<NodeData, EdgeData>> nodes, Node<NodeData, EdgeData> node) {
-
-        for (Node<NodeData, EdgeData> n1 : nodes) {
-            if (intersect(n1, node)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    private int evaluateSolution() {
-
-        int sum = 0;
-        for (Edge<NodeData, EdgeData> e : graph.getEdges()) {
-            Node<NodeData, EdgeData> source = e.getSource();
-            Node<NodeData, EdgeData> dest = e.getDest();
-            int offset = 0;
-            offset = Math.abs(source.getData().getCoordinate() - dest.getData().getCoordinate());
-            sum += offset;
-        }
-
-        return sum;
-    }
-
-    private void crossingReduction(ArrayList<Node<NodeData, EdgeData>> layers[]) {
-
-        for (int i = 0; i < layers.length - 1; i++) {
-
-            ArrayList<Node<NodeData, EdgeData>> curNodes = layers[i];
-            ArrayList<Node<NodeData, EdgeData>> nextNodes = layers[i + 1];
-            for (Node<NodeData, EdgeData> n : curNodes) {
-                for (Node<NodeData, EdgeData> succ : n.getSuccessors()) {
-                    if (ASSERT) {
-                        assert nextNodes.contains(succ);
-                    }
-                    nextNodes.remove(succ);
-                    nextNodes.add(succ);
-                }
-            }
-
-        }
-
-    }
-
-    private void removeCycles(Set<Node<NodeData, EdgeData>> rootNodes) {
-        final List<Edge<NodeData, EdgeData>> reversedEdges = new ArrayList<Edge<NodeData, EdgeData>>();
-
-
-        int removedCount = 0;
-        int reversedCount = 0;
-
-        Graph<NodeData, EdgeData>.DFSTraversalVisitor visitor = graph.new DFSTraversalVisitor() {
-
-            @Override
-            public boolean visitEdge(Edge<NodeData, EdgeData> e, boolean backEdge) {
-                if (backEdge) {
-                    if (ASSERT) {
-                        assert !reversedEdges.contains(e);
-                    }
-                    reversedEdges.add(e);
-                    e.getData().setReversed(!e.getData().isReversed());
-                }
-
-                return e.getData().isImportant();
-            }
-        };
-        Set<Node<NodeData, EdgeData>> nodes = new HashSet<Node<NodeData, EdgeData>>();
-        nodes.addAll(rootNodes);
-
-        assert nodes.size() > 0;
-
-        this.graph.traverseDFS(nodes, visitor);
-
-        for (Edge<NodeData, EdgeData> e : reversedEdges) {
-            if (e.isSelfLoop()) {
-                e.remove();
-                removedCount++;
-            } else {
-                e.reverse();
-                reversedCount++;
-            }
-        }
-    }
-
-    private boolean checkRemoveCycles() {
-        return !graph.hasCycles();
-    }
-    // Only used by assignLayers
-    private int maxLayerTemp;
-
-    private int assignLayers(Set<Node<NodeData, EdgeData>> rootNodes, Set<? extends Vertex> firstLayerHints,
-            Set<? extends Vertex> lastLayerHints) {
-        this.maxLayerTemp = -1;
-        for (Node<NodeData, EdgeData> n : graph.getNodes()) {
-            n.getData().setLayer(-1);
-        }
-
-        Graph<NodeData, EdgeData>.BFSTraversalVisitor traverser = graph.new BFSTraversalVisitor() {
-
-            @Override
-            public void visitNode(Node<NodeData, EdgeData> n, int depth) {
-                if (depth > n.getData().getLayer()) {
-                    n.getData().setLayer(depth);
-                    maxLayerTemp = Math.max(maxLayerTemp, depth);
-                }
-            }
-        };
-
-        for (Node<NodeData, EdgeData> n : rootNodes) {
-            if (n.getData().getLayer() == -1) {
-                this.graph.traverseBFS(n, traverser, true);
-            }
-        }
-
-        for (Vertex v : firstLayerHints) {
-            assert nodeMap.containsKey(v);
-            nodeMap.get(v).getData().setLayer(0);
-        }
-
-        for (Vertex v : lastLayerHints) {
-            assert nodeMap.containsKey(v);
-            nodeMap.get(v).getData().setLayer(maxLayerTemp);
-        }
-
-        return maxLayerTemp;
-    }
-
-    private boolean checkAssignLayers() {
-
-        for (Edge<NodeData, EdgeData> e : graph.getEdges()) {
-            Node<NodeData, EdgeData> source = e.getSource();
-            Node<NodeData, EdgeData> dest = e.getDest();
-
-
-            if (source.getData().getLayer() >= dest.getData().getLayer()) {
-                return false;
-            }
-        }
-        int maxLayer = 0;
-        for (Node<NodeData, EdgeData> n : graph.getNodes()) {
-            assert n.getData().getLayer() >= 0;
-            if (n.getData().getLayer() > maxLayer) {
-                maxLayer = n.getData().getLayer();
-            }
-        }
-
-        int countPerLayer[] = new int[maxLayer + 1];
-        for (Node<NodeData, EdgeData> n : graph.getNodes()) {
-            countPerLayer[n.getData().getLayer()]++;
-        }
-
-        if (TRACE) {
-            System.out.println("Number of layers: " + maxLayer);
-        }
-        return true;
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/build.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
-<!-- for some information on what you could do (e.g. targets to override). -->
-<!-- If you delete this file and reopen the project it will be recreated. -->
-<project name="com.sun.hotspot.igv.java6scriptingproxy" default="netbeans" basedir=".">
-    <description>Builds, tests, and runs the project com.sun.hotspot.igv.java6scriptingproxy.</description>
-    <import file="nbproject/build-impl.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/manifest.mf	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-OpenIDE-Module: com.sun.hotspot.igv.java6scriptingproxy
-OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/java6scriptingproxy/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.0
-
--- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/build-impl.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-*** GENERATED FROM project.xml - DO NOT EDIT  ***
-***         EDIT ../build.xml INSTEAD         ***
--->
-<project name="com.sun.hotspot.igv.java6scriptingproxy-impl" basedir="..">
-    <fail message="Please build using Ant 1.7.1 or higher.">
-        <condition>
-            <not>
-                <antversion atleast="1.7.1"/>
-            </not>
-        </condition>
-    </fail>
-    <property file="nbproject/private/suite-private.properties"/>
-    <property file="nbproject/suite.properties"/>
-    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
-    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
-    <property file="${suite.dir}/nbproject/platform.properties"/>
-    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="name"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{name}" value="${@{value}}"/>
-        </sequential>
-    </macrodef>
-    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="property"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{property}" value="@{value}"/>
-        </sequential>
-    </macrodef>
-    <property file="${user.properties.file}"/>
-    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
-        <condition>
-            <not>
-                <contains string="${cluster.path.evaluated}" substring="platform"/>
-            </not>
-        </condition>
-    </fail>
-    <import file="${harness.dir}/build.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/genfiles.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=485d21b4
-nbproject/build-impl.xml.script.CRC32=341e7d1e
-nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1
--- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/project.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
-    <type>org.netbeans.modules.apisupport.project</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
-            <code-name-base>com.sun.hotspot.igv.java6scriptingproxy</code-name-base>
-            <suite-component/>
-            <module-dependencies>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.filter</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.graph</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-            </module-dependencies>
-            <public-packages>
-                <package>com.sun.hotspot.igv.java6scriptingproxy</package>
-            </public-packages>
-        </data>
-    </configuration>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/suite.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-suite.dir=${basedir}/..
--- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/src/META-INF/services/com.sun.hotspot.igv.filter.ScriptEngineAbstraction	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.hotspot.igv.java6scriptingproxy.JavaSE6ScriptEngine
\ No newline at end of file
--- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/src/com/sun/hotspot/igv/java6scriptingproxy/Bundle.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-OpenIDE-Module-Name=Java6ScriptingProxy
--- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/src/com/sun/hotspot/igv/java6scriptingproxy/JavaSE6ScriptEngine.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.sun.hotspot.igv.java6scriptingproxy;
-
-import com.sun.hotspot.igv.filter.*;
-import com.sun.hotspot.igv.graph.Diagram;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class JavaSE6ScriptEngine implements ScriptEngineAbstraction {
-
-    private Object engine;
-    private Object bindings;
-    private Method Bindings_put;
-    private Method ScriptEngine_eval;
-
-    public boolean initialize(String jsHelperText) {
-        try {
-            ClassLoader cl = JavaSE6ScriptEngine.class.getClassLoader();
-            Class<?> managerClass = cl.loadClass("javax.script.ScriptEngineManager");
-            Class<?> engineClass = cl.loadClass("javax.script.ScriptEngine");
-            Class<?> bindingsClass = cl.loadClass("javax.script.Bindings");
-            Class<?> contextClass = cl.loadClass("javax.script.ScriptContext");
-
-            Object manager = managerClass.newInstance();
-            Method getEngineByName = managerClass.getMethod("getEngineByName", String.class);
-            engine = getEngineByName.invoke(manager, "ECMAScript");
-            Method eval = engineClass.getMethod("eval", String.class);
-            ScriptEngine_eval = engineClass.getMethod("eval", String.class, bindingsClass);
-            eval.invoke(engine, jsHelperText);
-            Method getContext = engineClass.getMethod("getContext");
-            Object context = getContext.invoke(engine);
-            Method getBindings = contextClass.getMethod("getBindings", Integer.TYPE);
-            Field f = contextClass.getField("ENGINE_SCOPE");
-            bindings = getBindings.invoke(context, f.getInt(null));
-            Bindings_put = bindingsClass.getMethod("put", String.class, Object.class);
-            Bindings_put.invoke(bindings, "IO", System.out);
-
-            /*
-             * Non-reflective code: 
-            ScriptEngineManager sem = new ScriptEngineManager();
-            ScriptEngine e = sem.getEngineByName("ECMAScript");
-            engine = e;
-            e.eval(jsHelperText);
-            Bindings b = e.getContext().getBindings(ScriptContext.ENGINE_SCOPE);
-            b.put("IO", System.out);
-            bindings = b;
-             */
-            
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    public void execute(Diagram d, String code) {
-        try {
-            Bindings_put.invoke(bindings, "graph", d);
-            ScriptEngine_eval.invoke(engine, code, bindings);
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/Layout/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Layout/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/Cluster.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.layout;
-
-import java.awt.Rectangle;
-import java.util.Set;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public interface Cluster extends Comparable<Cluster> {
-
-    public Cluster getOuter();
-
-    public void setBounds(Rectangle r);
-
-    public Set<? extends Cluster> getSuccessors();
-}
--- a/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/LayoutGraph.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/LayoutGraph.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,11 +23,7 @@
  */
 package com.sun.hotspot.igv.layout;
 
-import java.util.HashSet;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
+import java.util.*;
 
 /**
  *
@@ -49,10 +45,10 @@
         this.links = links;
         assert verify();
 
-        vertices = new TreeSet<Vertex>();
-        portLinks = new HashMap<Port, Set<Link>>(links.size());
-        inputPorts = new HashMap<Vertex, Set<Port>>(links.size());
-        outputPorts = new HashMap<Vertex, Set<Port>>(links.size());
+        vertices = new TreeSet<>();
+        portLinks = new HashMap<>(links.size());
+        inputPorts = new HashMap<>(links.size());
+        outputPorts = new HashMap<>(links.size());
 
         for (Link l : links) {
             Port p = l.getFrom();
@@ -76,7 +72,7 @@
             }
 
             if (!portLinks.containsKey(p)) {
-                HashSet<Link> hashSet = new HashSet<Link>(3);
+                HashSet<Link> hashSet = new HashSet<>(3);
                 portLinks.put(p, hashSet);
             }
 
@@ -152,7 +148,7 @@
     //   whole graph is visited.
     public Set<Vertex> findRootVertices(Set<Vertex> startingRoots) {
 
-        Set<Vertex> notRootSet = new HashSet<Vertex>();
+        Set<Vertex> notRootSet = new HashSet<>();
         for (Vertex v : startingRoots) {
             if (!notRootSet.contains(v)) {
                 markNotRoot(notRootSet, v, v);
@@ -174,7 +170,7 @@
             }
         }
 
-        Set<Vertex> result = new HashSet<Vertex>();
+        Set<Vertex> result = new HashSet<>();
         for (Vertex v : tmpVertices) {
             if (!notRootSet.contains(v)) {
                 result.add(v);
@@ -187,16 +183,4 @@
     public Set<Vertex> findRootVertices() {
         return findRootVertices(new HashSet<Vertex>());
     }
-
-    public SortedSet<Cluster> getClusters() {
-
-        SortedSet<Cluster> clusters = new TreeSet<Cluster>();
-        for (Vertex v : getVertices()) {
-            if (v.getCluster() != null) {
-                clusters.add(v.getCluster());
-            }
-        }
-
-        return clusters;
-    }
 }
--- a/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/Link.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/Link.java	Thu Feb 02 16:07:52 2012 -0800
@@ -35,6 +35,8 @@
     public Port getFrom();
 
     public Port getTo();
+    
+    public boolean isVIP();
 
     public List<Point> getControlPoints();
 
--- a/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/Vertex.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/Vertex.java	Thu Feb 02 16:07:52 2012 -0800
@@ -32,8 +32,6 @@
  */
 public interface Vertex extends Comparable<Vertex> {
 
-    public Cluster getCluster();
-
     public Dimension getSize();
 
     public Point getPosition();
--- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/NetworkConnection/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/src/META-INF/services/com.sun.hotspot.igv.data.services.GroupReceiver	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.hotspot.igv.connection.Server
\ No newline at end of file
--- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/Client.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/Client.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,14 +24,12 @@
  */
 package com.sun.hotspot.igv.connection;
 
-import com.sun.hotspot.igv.data.Group;
+import com.sun.hotspot.igv.data.serialization.Parser;
 import com.sun.hotspot.igv.data.services.GroupCallback;
-import com.sun.hotspot.igv.data.serialization.Parser;
-import com.sun.hotspot.igv.data.Properties.RegexpPropertyMatcher;
+import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.Socket;
-import javax.swing.JTextField;
 import org.openide.util.Exceptions;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -40,54 +38,37 @@
  *
  * @author Thomas Wuerthinger
  */
-public class Client implements Runnable, GroupCallback {
+public class Client implements Runnable {
 
     private Socket socket;
-    private JTextField networkTextField;
     private GroupCallback callback;
 
-    public Client(Socket socket, JTextField networkTextField, GroupCallback callback) {
+    public Client(Socket socket, GroupCallback callback) {
         this.callback = callback;
         this.socket = socket;
-        this.networkTextField = networkTextField;
     }
 
+    @Override
     public void run() {
 
         try {
-            InputStream inputStream = socket.getInputStream();
-
-            if (networkTextField.isEnabled()) {
-
-                socket.getOutputStream().write('y');
-                InputSource is = new InputSource(inputStream);
+            InputStream inputStream = new BufferedInputStream(socket.getInputStream());
+            InputSource is = new InputSource(inputStream);
 
-                try {
-                    Parser parser = new Parser(this);
-                    parser.parse(is, null);
-                } catch (SAXException ex) {
-                    ex.printStackTrace();
-                }
-            } else {
-                socket.getOutputStream().write('n');
+            try {
+                Parser parser = new Parser(callback);
+                parser.parse(is, null);
+            } catch (SAXException ex) {
+                ex.printStackTrace();
             }
-
-            socket.close();
         } catch (IOException ex) {
             Exceptions.printStackTrace(ex);
+        } finally {
+            try {
+                socket.close();
+            } catch (IOException ex) {
+                Exceptions.printStackTrace(ex);
+            }
         }
     }
-
-    public void started(final Group g) {
-        try {
-            RegexpPropertyMatcher matcher = new RegexpPropertyMatcher("name", ".*" + networkTextField.getText() + ".*");
-            if (g.getProperties().selectSingle(matcher) != null && networkTextField.isEnabled()) {
-                socket.getOutputStream().write('y');
-                callback.started(g);
-            } else {
-                socket.getOutputStream().write('n');
-            }
-        } catch (IOException e) {
-        }
-    }
-}
+}
\ No newline at end of file
--- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/Server.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/Server.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,17 +24,13 @@
  */
 package com.sun.hotspot.igv.connection;
 
-import com.sun.hotspot.igv.data.Group;
 import com.sun.hotspot.igv.data.services.GroupCallback;
-import com.sun.hotspot.igv.data.services.GroupReceiver;
 import com.sun.hotspot.igv.settings.Settings;
-import java.awt.Component;
 import java.io.IOException;
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.util.prefs.PreferenceChangeEvent;
 import java.util.prefs.PreferenceChangeListener;
-import javax.swing.SwingUtilities;
 import org.openide.DialogDisplayer;
 import org.openide.NotifyDescriptor;
 import org.openide.util.RequestProcessor;
@@ -43,51 +39,21 @@
  *
  * @author Thomas Wuerthinger
  */
-public class Server implements GroupCallback, GroupReceiver, PreferenceChangeListener {
+public class Server implements PreferenceChangeListener {
 
-    private javax.swing.JPanel jPanel1;
-    private javax.swing.JCheckBox networkCheckBox;
-    private javax.swing.JTextField networkTextField;
     private ServerSocket serverSocket;
     private GroupCallback callback;
     private int port;
     private Runnable serverRunnable;
 
-    public Component init(GroupCallback callback) {
+    public Server(GroupCallback callback) {
 
         this.callback = callback;
-
-        jPanel1 = new javax.swing.JPanel();
-        networkTextField = new javax.swing.JTextField();
-        networkCheckBox = new javax.swing.JCheckBox();
-
-
-        jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
-        jPanel1.setLayout(new java.awt.BorderLayout(10, 10));
-        jPanel1.add(networkTextField, java.awt.BorderLayout.CENTER);
-
-        networkCheckBox.setSelected(true);
-        org.openide.awt.Mnemonics.setLocalizedText(networkCheckBox, "Receive when name contains");
-        networkCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
-        networkCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
-        networkCheckBox.addChangeListener(new javax.swing.event.ChangeListener() {
-
-            public void stateChanged(javax.swing.event.ChangeEvent evt) {
-                networkCheckBoxChanged(evt);
-            }
-        });
-        jPanel1.add(networkCheckBox, java.awt.BorderLayout.WEST);
-        networkCheckBox.getAccessibleContext().setAccessibleName("Read from network when name contains");
-
         initializeNetwork();
         Settings.get().addPreferenceChangeListener(this);
-        return jPanel1;
     }
 
-    private void networkCheckBoxChanged(javax.swing.event.ChangeEvent evt) {
-        networkTextField.setEnabled(networkCheckBox.isSelected());
-    }
-
+    @Override
     public void preferenceChange(PreferenceChangeEvent e) {
 
         int curPort = Integer.parseInt(Settings.get().get(Settings.PORT, Settings.PORT_DEFAULT));
@@ -110,6 +76,7 @@
 
         Runnable runnable = new Runnable() {
 
+            @Override
             public void run() {
                 while (true) {
                     try {
@@ -118,7 +85,7 @@
                             clientSocket.close();
                             return;
                         }
-                        RequestProcessor.getDefault().post(new Client(clientSocket, networkTextField, Server.this), 0, Thread.MAX_PRIORITY);
+                        RequestProcessor.getDefault().post(new Client(clientSocket, callback), 0, Thread.MAX_PRIORITY);
                     } catch (IOException ex) {
                         serverSocket = null;
                         NotifyDescriptor message = new NotifyDescriptor.Message("Error during listening for incoming connections. Listening for incoming data is disabled.", NotifyDescriptor.ERROR_MESSAGE);
@@ -133,13 +100,4 @@
 
         RequestProcessor.getDefault().post(runnable, 0, Thread.MAX_PRIORITY);
     }
-
-    public void started(final Group g) {
-        SwingUtilities.invokeLater(new Runnable() {
-
-            public void run() {
-                callback.started(g);
-            }
-        });
-    }
 }
--- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/build.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
-<!-- for some information on what you could do (e.g. targets to override). -->
-<!-- If you delete this file and reopen the project it will be recreated. -->
-<project name="com.sun.hotspot.igv.rhino" default="netbeans" basedir=".">
-    <description>Builds, tests, and runs the project com.sun.hotspot.igv.rhino.</description>
-    <import file="nbproject/build-impl.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/manifest.mf	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-OpenIDE-Module: com.sun.hotspot.igv.rhino
-OpenIDE-Module-Layer: com/sun/hotspot/igv/rhino/layer.xml
-OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/rhino/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.0
-
--- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/build-impl.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-*** GENERATED FROM project.xml - DO NOT EDIT  ***
-***         EDIT ../build.xml INSTEAD         ***
--->
-<project name="com.sun.hotspot.igv.rhino-impl" basedir="..">
-    <fail message="Please build using Ant 1.7.1 or higher.">
-        <condition>
-            <not>
-                <antversion atleast="1.7.1"/>
-            </not>
-        </condition>
-    </fail>
-    <property file="nbproject/private/suite-private.properties"/>
-    <property file="nbproject/suite.properties"/>
-    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
-    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
-    <property file="${suite.dir}/nbproject/platform.properties"/>
-    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="name"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{name}" value="${@{value}}"/>
-        </sequential>
-    </macrodef>
-    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="property"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{property}" value="@{value}"/>
-        </sequential>
-    </macrodef>
-    <property file="${user.properties.file}"/>
-    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
-        <condition>
-            <not>
-                <contains string="${cluster.path.evaluated}" substring="platform"/>
-            </not>
-        </condition>
-    </fail>
-    <import file="${harness.dir}/build.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/genfiles.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=0c3e7912
-nbproject/build-impl.xml.script.CRC32=87376d18
-nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1
--- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/project.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
-    <type>org.netbeans.modules.apisupport.project</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
-            <code-name-base>com.sun.hotspot.igv.rhino</code-name-base>
-            <suite-component/>
-            <module-dependencies>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.filter</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.graph</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-            </module-dependencies>
-            <public-packages>
-                <package>com.sun.hotspot.igv.rhino</package>
-            </public-packages>
-        </data>
-    </configuration>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/suite.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-suite.dir=${basedir}/..
--- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/src/META-INF/services/com.sun.hotspot.igv.filter.ScriptEngineAbstraction	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.hotspot.igv.rhino.RhinoScriptEngine
\ No newline at end of file
--- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/src/com/sun/hotspot/igv/rhino/Bundle.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-OpenIDE-Module-Name=RhinoScriptEngineProxy
--- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/src/com/sun/hotspot/igv/rhino/RhinoScriptEngine.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.sun.hotspot.igv.rhino;
-
-import com.sun.hotspot.igv.filter.ScriptEngineAbstraction;
-import com.sun.hotspot.igv.graph.Diagram;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class RhinoScriptEngine implements ScriptEngineAbstraction {
-
-    private String jsHelperText;
-    private Constructor importer;
-    private Method scope_put;
-    private Method cx_evaluateString;
-    private Method context_enter;
-    private Method context_exit;
-
-    public boolean initialize(String s) {
-        this.jsHelperText = s;
-        Class<?> importerTopLevel = null;
-        try {
-            ClassLoader cl = RhinoScriptEngine.class.getClassLoader();
-            Class<?> context = cl.loadClass("org.mozilla.javascript.Context");
-            Class<?> scriptable = cl.loadClass("org.mozilla.javascript.Scriptable");
-            importerTopLevel = cl.loadClass("org.mozilla.javascript.ImporterTopLevel");
-            importer = importerTopLevel.getDeclaredConstructor(context);
-            scope_put = importerTopLevel.getMethod("put", String.class, scriptable, Object.class);
-            cx_evaluateString = context.getDeclaredMethod("evaluateString", scriptable, String.class, String.class, Integer.TYPE, Object.class);
-            context_enter = context.getDeclaredMethod("enter");
-            context_exit = context.getDeclaredMethod("exit");
-            return true;
-        } catch (Exception e) {
-            return false;
-        }
-    }
-
-    public void execute(Diagram d, String code) {
-        try {
-            Object cx = context_enter.invoke(null, (Object[]) null);
-            try {
-                Object scope = importer.newInstance(cx);
-                scope_put.invoke(scope, "IO", scope, System.out);
-                scope_put.invoke(scope, "graph", scope, d);
-                cx_evaluateString.invoke(cx, scope, jsHelperText, "jsHelper.js", 1, null);
-                cx_evaluateString.invoke(cx, scope, code, "<cmd>", 1, null);
-            } finally {
-                // Exit from the context.
-                context_exit.invoke(null, (Object[]) null);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/src/com/sun/hotspot/igv/rhino/layer.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
-<filesystem>
-</filesystem>
--- a/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/src/com/sun/hotspot/igv/selectioncoordinator/SelectionCoordinator.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/src/com/sun/hotspot/igv/selectioncoordinator/SelectionCoordinator.java	Thu Feb 02 16:07:52 2012 -0800
@@ -46,10 +46,10 @@
     }
 
     private SelectionCoordinator() {
-        selectedChangedEvent = new ChangedEvent<SelectionCoordinator>(this);
-        highlightedChangedEvent = new ChangedEvent<SelectionCoordinator>(this);
-        selectedObjects = new HashSet<Object>();
-        highlightedObjects = new HashSet<Object>();
+        selectedChangedEvent = new ChangedEvent<>(this);
+        highlightedChangedEvent = new ChangedEvent<>(this);
+        selectedObjects = new HashSet<>();
+        highlightedObjects = new HashSet<>();
     }
 
     public Set<Object> getSelectedObjects() {
--- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/project.xml	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/project.xml	Thu Feb 02 16:07:52 2012 -0800
@@ -1,45 +1,29 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
-    <type>org.netbeans.modules.apisupport.project</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
-            <code-name-base>com.sun.hotspot.igv.servercompiler</code-name-base>
-            <suite-component/>
-            <module-dependencies>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.data</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.graph</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.graphtotext</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.structuredtext</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-            </module-dependencies>
-            <public-packages/>
-        </data>
-    </configuration>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.apisupport.project</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+            <code-name-base>com.sun.hotspot.igv.servercompiler</code-name-base>
+            <suite-component/>
+            <module-dependencies>
+                <dependency>
+                    <code-name-base>com.sun.hotspot.igv.data</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>1.0</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>com.sun.hotspot.igv.graph</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>1.0</specification-version>
+                    </run-dependency>
+                </dependency>
+            </module-dependencies>
+            <public-packages/>
+        </data>
+    </configuration>
+</project>
--- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/META-INF/services/com.sun.hotspot.igv.data.services.GroupOrganizer	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.hotspot.igv.servercompiler.JavaGroupOrganizer
\ No newline at end of file
--- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/META-INF/services/com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.hotspot.igv.servercompiler.ServerCompilerGraphToTextConverter
\ No newline at end of file
--- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/JavaGroupOrganizer.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.sun.hotspot.igv.servercompiler;
-
-import com.sun.hotspot.igv.data.Group;
-import com.sun.hotspot.igv.data.services.GroupOrganizer;
-import com.sun.hotspot.igv.data.Pair;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class JavaGroupOrganizer implements GroupOrganizer {
-
-    public String getName() {
-        return "Java structure";
-    }
-
-    public List<Pair<String, List<Group>>> organize(List<String> subFolders, List<Group> groups) {
-
-        List<Pair<String, List<Group>>> result = new ArrayList<Pair<String, List<Group>>>();
-
-        if (subFolders.size() == 0) {
-            buildResult(result, groups, packageNameProvider);
-        } else if (subFolders.size() == 1) {
-            buildResult(result, groups, classNameProvider);
-        } else if (subFolders.size() == 2) {
-            for (Group g : groups) {
-                List<Group> children = new ArrayList<Group>();
-                children.add(g);
-                Pair<String, List<Group>> p = new Pair<String, List<Group>>();
-                p.setLeft(reducedNameProvider.getName(g));
-                p.setRight(children);
-                result.add(p);
-            }
-        } else {
-            result.add(new Pair<String, List<Group>>("", groups));
-        }
-
-        return result;
-    }
-
-    private void buildResult(List<Pair<String, List<Group>>> result, List<Group> groups, NameProvider provider) {
-        HashMap<String, List<Group>> map = new HashMap<String, List<Group>>(groups.size());
-        for (Group g : groups) {
-            String s = provider.getName(g);
-
-            if (!map.containsKey(s)) {
-                List<Group> list = new ArrayList<Group>();
-                Pair<String, List<Group>> pair = new Pair<String, List<Group>>(s, list);
-                result.add(pair);
-                map.put(s, list);
-            }
-
-            List<Group> curList = map.get(s);
-            curList.add(g);
-        }
-
-        Collections.sort(result, new Comparator<Pair<String, List<Group>>>() {
-
-            public int compare(Pair<String, List<Group>> a, Pair<String, List<Group>> b) {
-                return a.getLeft().compareTo(b.getLeft());
-            }
-        });
-    }
-
-    private static interface NameProvider {
-
-        public String getName(Group g);
-    }
-    private NameProvider reducedNameProvider = new NameProvider() {
-
-        public String getName(Group g) {
-            String name = g.getName();
-            assert name != null : "name of group must be set!";
-            final String noReducedName = name;
-
-            int firstPoint = name.indexOf(".");
-            if (firstPoint == -1) {
-                return noReducedName;
-            }
-
-            int firstParenthese = name.indexOf("(");
-            if (firstParenthese == -1 || firstParenthese < firstPoint) {
-                return noReducedName;
-            }
-
-            int current = firstPoint;
-            while (current >= 0 && name.charAt(current) != ' ') {
-                current--;
-            }
-
-            String tmp = name.substring(0, firstParenthese);
-            int lastPoint = tmp.lastIndexOf(".");
-            if (lastPoint == -1) {
-                return noReducedName;
-            }
-
-            name = name.substring(0, current + 1) + name.substring(lastPoint + 1);
-            return name;
-        }
-    };
-    private NameProvider packageNameProvider = new NameProvider() {
-
-        public String getName(Group g) {
-            String name = g.getName();
-            assert name != null : "name of group must be set!";
-            final String noPackage = "<default>";
-
-            int firstPoint = name.indexOf(".");
-            if (firstPoint == -1) {
-                return noPackage;
-            }
-
-            int firstParenthese = name.indexOf("(");
-            if (firstParenthese == -1 || firstParenthese < firstPoint) {
-                return noPackage;
-            }
-
-            int current = firstPoint;
-            while (current >= 0 && name.charAt(current) != ' ') {
-                current--;
-            }
-            
-            String fullClassName = name.substring(current + 1, firstParenthese);
-            int lastPoint = fullClassName.lastIndexOf(".");
-            if (lastPoint == -1) {
-                return noPackage;
-            }
-            lastPoint = fullClassName.lastIndexOf(".", lastPoint - 1);
-            if (lastPoint == -1) {
-                return noPackage;
-            }
-
-            String packageName = fullClassName.substring(0, lastPoint);
-            return packageName;
-        }
-    };
-    private NameProvider classNameProvider = new NameProvider() {
-
-        public String getName(Group g) {
-            String name = g.getName();
-            assert name != null : "name of group must be set!";
-
-            final String noClass = "<noclass>";
-
-            int firstPoint = name.indexOf(".");
-            if (firstPoint == -1) {
-                return noClass;
-            }
-
-            int firstParenthese = name.indexOf("(");
-            if (firstParenthese == -1 || firstParenthese < firstPoint) {
-                return noClass;
-            }
-
-            int current = firstPoint;
-            while (current >= 0 && name.charAt(current) != ' ') {
-                current--;
-            }
-
-            String fullClassName = name.substring(current + 1, firstParenthese);
-            int lastPoint = fullClassName.lastIndexOf(".");
-            if (lastPoint == -1) {
-                return noClass;
-            }
-            int lastlastPoint = fullClassName.lastIndexOf(".", lastPoint - 1);
-
-            String className = fullClassName.substring(lastlastPoint + 1, lastPoint);
-            return className;
-        }
-    };
-}
--- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerGraphToTextConverter.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.sun.hotspot.igv.servercompiler;
-
-import com.sun.hotspot.igv.data.InputBlock;
-import com.sun.hotspot.igv.data.InputEdge;
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.data.Properties;
-import com.sun.hotspot.igv.data.Properties.PropertyMatcher;
-import com.sun.hotspot.igv.data.Properties.PropertySelector;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter;
-import com.sun.hotspot.igv.structuredtext.Element;
-import com.sun.hotspot.igv.structuredtext.MultiElement;
-import com.sun.hotspot.igv.structuredtext.SimpleElement;
-import com.sun.hotspot.igv.structuredtext.StructuredText;
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.swing.text.Style;
-import javax.swing.text.StyleConstants;
-import javax.swing.text.StyleContext;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class ServerCompilerGraphToTextConverter implements GraphToTextConverter {
-
-
-    private Map<InputNode, Set<Figure>> map;
-    private Map<InputNode, List<InputEdge>> ingoingEdges;
-    private Map<InputNode, List<InputEdge>> outgoingEdges;
-    private InputGraph graph;
-
-    private Collection<InputNode> sortNodes(Collection<InputNode> nodes) {
-        List<InputNode> result = new ArrayList<InputNode>(nodes);
-
-        Collections.sort(result, InputNode.getPropertyComparator("idx"));
-
-
-        return result;
-    }
-
-    public StructuredText convert(InputGraph graph, Diagram diagram) {
-
-        this.graph = graph;
-        map = diagram.calcSourceToFigureRelation();
-        ingoingEdges = graph.findAllIngoingEdges();
-        outgoingEdges = graph.findAllOutgoingEdges();
-
-        final StructuredText result = new StructuredText(graph.getName());
-
-        for (InputBlock b : graph.getBlocks()) {
-            result.addChild(new SimpleElement("Block " + b.getName() + "\n"));
-            for (InputNode n : sortNodes(b.getNodes())) {
-                result.addChild(getNodeElement(n));
-            }
-        }
-
-        boolean first = true;
-        for (InputNode n : sortNodes(graph.getNodes())) {
-            if (graph.getBlock(n) == null) {
-                if (first) {
-                    first = false;
-                    result.addChild(new SimpleElement("No block: \n"));
-                }
-                result.addChild(getNodeElement(n));
-            }
-        }
-
-
-        return result;
-    }
-
-    private Element getNodeNameElement(InputNode n) {
-
-        final SimpleElement name = new SimpleElement(n.getProperties().get("idx") + " " + n.getProperties().get("name"), calcStyle(n));
-        name.addSource(n.getId());
-        return name;
-    }
-
-    private Element getNodeSmallElement(InputNode n) {
-        final SimpleElement id = new SimpleElement(n.getProperties().get("idx"), calcStyle(n));
-        id.addSource(n.getId());
-        return id;
-    }
-
-    private Element getNodeElement(InputNode n) {
-
-        final MultiElement result = new MultiElement();
-
-        result.print("\t");
-        result.addChild(getNodeNameElement(n));
-
-        result.print(" === ");
-        
-        for (InputEdge e : outgoingEdges.get(n)) {
-            result.print(" ");
-            result.addChild(getNodeSmallElement(graph.getNode(e.getTo())));
-            result.print(" ");
-        }
-
-        result.print(" [[");
-
-        for (InputEdge e : ingoingEdges.get(n)) {
-            result.print(" ");
-            result.addChild(getNodeSmallElement(graph.getNode(e.getFrom())));
-            result.print(" ");
-        }
-
-        result.print("]] ");
-        
-        result.print(n.getProperties().get("dump_spec"));
-
-        result.print("\n");
-
-        return result;
-    }
-    
-    private static final PropertyMatcher MATCHER = new Properties.RegexpPropertyMatcher("name", "Root");
-    public boolean canConvert(InputGraph graph) {
-        return new PropertySelector<InputNode>(graph.getNodes()).selectSingle(MATCHER) != null;
-    }
-
-    private Color calcColor(InputNode node) {
-        Set<Figure> figureSet = this.map.get(node);
-        if(figureSet != null && figureSet.size() == 1) {
-            return figureSet.iterator().next().getColor();
-        } else {
-            return Color.WHITE;
-        }
-    }
-
-    private Color lessColor(Color c) {
-        return new Color(255 - (255 - c.getRed()) / 4, 255 - (255 - c.getGreen()) / 4, 255 - (255 - c.getBlue()) / 4);
-    }
-
-    private Style calcStyle(InputNode node) {
-        Color c = calcColor(node);
-        Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
-        Style newStyle = StyleContext.getDefaultStyleContext().addStyle(null, defaultStyle);
-
-        StyleConstants.setBackground(newStyle, lessColor(c));
-        return newStyle;
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java	Thu Feb 02 16:07:52 2012 -0800
@@ -29,17 +29,7 @@
 import com.sun.hotspot.igv.data.InputGraph;
 import com.sun.hotspot.igv.data.InputNode;
 import com.sun.hotspot.igv.data.services.Scheduler;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
-import java.util.Vector;
+import java.util.*;
 
 /**
  *
@@ -50,8 +40,8 @@
     private static class Node {
 
         public InputNode inputNode;
-        public Set<Node> succs = new HashSet<Node>();
-        public List<Node> preds = new ArrayList<Node>();
+        public Set<Node> succs = new HashSet<>();
+        public List<Node> preds = new ArrayList<>();
         public InputBlock block;
         public boolean isBlockProjection;
         public boolean isBlockStart;
@@ -65,6 +55,7 @@
     private InputBlock[][] commonDominator;
     private static final Comparator<InputEdge> edgeComparator = new Comparator<InputEdge>() {
 
+        @Override
         public int compare(InputEdge o1, InputEdge o2) {
             return o1.getToIndex() - o2.getToIndex();
         }
@@ -72,13 +63,13 @@
 
     public void buildBlocks() {
 
-        blocks = new Vector<InputBlock>();
+        blocks = new Vector<>();
         Node root = findRoot();
         if (root == null) {
             return;
         }
-        Stack<Node> stack = new Stack<Node>();
-        Set<Node> visited = new HashSet<Node>();
+        Stack<Node> stack = new Stack<>();
+        Set<Node> visited = new HashSet<>();
         stack.add(root);
         int blockCount = 0;
         InputBlock rootBlock = null;
@@ -179,7 +170,7 @@
         }
 
         int z = 0;
-        blockIndex = new HashMap<InputBlock, Integer>(blocks.size());
+        blockIndex = new HashMap<>(blocks.size());
         for (InputBlock b : blocks) {
             blockIndex.put(b, z);
             z++;
@@ -190,13 +181,14 @@
         return n.getProperties().get("block");
     }
 
+    @Override
     public Collection<InputBlock> schedule(InputGraph graph) {
         if (graph.getNodes().isEmpty()) {
             return Collections.emptyList();
         }
 
         if (graph.getBlocks().size() > 0) {
-            Collection<InputNode> tmpNodes = new ArrayList<InputNode>(graph.getNodes());
+            Collection<InputNode> tmpNodes = new ArrayList<>(graph.getNodes());
             for (InputNode n : tmpNodes) {
                 String block = getBlockName(n);
                 if (graph.getBlock(n) == null) {
@@ -206,8 +198,8 @@
             }
             return graph.getBlocks();
         } else {
-            nodes = new ArrayList<Node>();
-            inputNodeToNode = new HashMap<InputNode, Node>(graph.getNodes().size());
+            nodes = new ArrayList<>();
+            inputNodeToNode = new HashMap<>(graph.getNodes().size());
 
             this.graph = graph;
             buildUpGraph();
@@ -241,9 +233,9 @@
         }
 
         // Mark all nodes reachable in backward traversal from root
-        Set<Node> reachable = new HashSet<Node>();
+        Set<Node> reachable = new HashSet<>();
         reachable.add(root);
-        Stack<Node> stack = new Stack<Node>();
+        Stack<Node> stack = new Stack<>();
         stack.push(root);
         while (!stack.isEmpty()) {
             Node cur = stack.pop();
@@ -255,7 +247,7 @@
             }
         }
 
-        Set<Node> unscheduled = new HashSet<Node>();
+        Set<Node> unscheduled = new HashSet<>();
         for (Node n : this.nodes) {
             if (n.block == null && reachable.contains(n)) {
                 unscheduled.add(n);
@@ -265,7 +257,7 @@
         while (unscheduled.size() > 0) {
             boolean progress = false;
 
-            Set<Node> newUnscheduled = new HashSet<Node>();
+            Set<Node> newUnscheduled = new HashSet<>();
             for (Node n : unscheduled) {
 
                 InputBlock block = null;
@@ -305,7 +297,7 @@
             }
         }
 
-        Set<Node> curReachable = new HashSet<Node>(reachable);
+        Set<Node> curReachable = new HashSet<>(reachable);
         for (Node n : curReachable) {
             if (n.block != null) {
                 for (Node s : n.succs) {
@@ -320,7 +312,7 @@
 
     private void markWithBlock(Node n, InputBlock b, Set<Node> reachable) {
         assert !reachable.contains(n);
-        Stack<Node> stack = new Stack<Node>();
+        Stack<Node> stack = new Stack<>();
         stack.push(n);
         n.block = b;
         b.addNode(n.inputNode.getId());
@@ -376,7 +368,7 @@
         if (ba == bb) {
             return ba;
         }
-        Set<InputBlock> visited = new HashSet<InputBlock>();
+        Set<InputBlock> visited = new HashSet<>();
         while (ba != null) {
             visited.add(ba);
             ba = dominatorMap.get(ba);
@@ -394,12 +386,12 @@
     }
 
     public void buildDominators() {
-        dominatorMap = new HashMap<InputBlock, InputBlock>(graph.getBlocks().size());
+        dominatorMap = new HashMap<>(graph.getBlocks().size());
         if (blocks.size() == 0) {
             return;
         }
-        Vector<BlockIntermediate> intermediate = new Vector<BlockIntermediate>(graph.getBlocks().size());
-        Map<InputBlock, BlockIntermediate> map = new HashMap<InputBlock, BlockIntermediate>(graph.getBlocks().size());
+        Vector<BlockIntermediate> intermediate = new Vector<>(graph.getBlocks().size());
+        Map<InputBlock, BlockIntermediate> map = new HashMap<>(graph.getBlocks().size());
         int z = 0;
         for (InputBlock b : blocks) {
             BlockIntermediate bi = new BlockIntermediate();
@@ -410,16 +402,16 @@
             bi.parent = -1;
             bi.label = z;
             bi.ancestor = -1;
-            bi.pred = new ArrayList<Integer>();
-            bi.bucket = new ArrayList<Integer>();
+            bi.pred = new ArrayList<>();
+            bi.bucket = new ArrayList<>();
             intermediate.add(bi);
             map.put(b, bi);
             z++;
         }
-        Stack<Integer> stack = new Stack<Integer>();
+        Stack<Integer> stack = new Stack<>();
         stack.add(0);
 
-        Vector<BlockIntermediate> array = new Vector<BlockIntermediate>();
+        Vector<BlockIntermediate> array = new Vector<>();
         intermediate.get(0).dominator = 0;
 
         int n = 0;
@@ -597,7 +589,7 @@
             inputNodeToNode.put(n, node);
         }
 
-        Map<Integer, List<InputEdge>> edgeMap = new HashMap<Integer, List<InputEdge>>(graph.getEdges().size());
+        Map<Integer, List<InputEdge>> edgeMap = new HashMap<>(graph.getEdges().size());
         for (InputEdge e : graph.getEdges()) {
 
             int to = e.getTo();
--- a/src/share/tools/IdealGraphVisualizer/Settings/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Settings/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/Settings/src/com/sun/hotspot/igv/settings/ViewOptionsCategory.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Settings/src/com/sun/hotspot/igv/settings/ViewOptionsCategory.java	Thu Feb 02 16:07:52 2012 -0800
@@ -41,14 +41,17 @@
         return new ImageIcon(ImageUtilities.loadImage("com/sun/hotspot/igv/settings/settings.png"));
     }
 
+    @Override
     public String getCategoryName() {
         return NbBundle.getMessage(ViewOptionsCategory.class, "OptionsCategory_Name_View");
     }
 
+    @Override
     public String getTitle() {
         return NbBundle.getMessage(ViewOptionsCategory.class, "OptionsCategory_Title_View");
     }
 
+    @Override
     public OptionsPanelController create() {
         return new ViewOptionsPanelController();
     }
--- a/src/share/tools/IdealGraphVisualizer/Settings/src/com/sun/hotspot/igv/settings/ViewOptionsPanelController.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Settings/src/com/sun/hotspot/igv/settings/ViewOptionsPanelController.java	Thu Feb 02 16:07:52 2012 -0800
@@ -40,40 +40,49 @@
     private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
     private boolean changed;
 
+    @Override
     public void update() {
         getPanel().load();
         changed = false;
     }
 
+    @Override
     public void applyChanges() {
         getPanel().store();
         changed = false;
     }
 
+    @Override
     public void cancel() {
     // need not do anything special, if no changes have been persisted yet
     }
 
+    @Override
     public boolean isValid() {
         return getPanel().valid();
     }
 
+    @Override
     public boolean isChanged() {
         return changed;
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return null; // new HelpCtx("...ID") if you have a help set
     }
 
+    @Override
     public JComponent getComponent(Lookup masterLookup) {
         return getPanel();
     }
 
+    @Override
     public void addPropertyChangeListener(PropertyChangeListener l) {
         pcs.addPropertyChangeListener(l);
     }
 
+    @Override
     public void removePropertyChangeListener(PropertyChangeListener l) {
         pcs.removePropertyChangeListener(l);
     }
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/build.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
-<!-- for some information on what you could do (e.g. targets to override). -->
-<!-- If you delete this file and reopen the project it will be recreated. -->
-<project name="com.sun.hotspot.igv.structuredtext" default="netbeans" basedir=".">
-    <description>Builds, tests, and runs the project com.sun.hotspot.igv.structuredtext.</description>
-    <import file="nbproject/build-impl.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/manifest.mf	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-OpenIDE-Module: com.sun.hotspot.igv.structuredtext
-OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/structuredtext/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.0
-
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/nbproject/build-impl.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-*** GENERATED FROM project.xml - DO NOT EDIT  ***
-***         EDIT ../build.xml INSTEAD         ***
--->
-<project name="com.sun.hotspot.igv.structuredtext-impl" basedir="..">
-    <fail message="Please build using Ant 1.7.1 or higher.">
-        <condition>
-            <not>
-                <antversion atleast="1.7.1"/>
-            </not>
-        </condition>
-    </fail>
-    <property file="nbproject/private/suite-private.properties"/>
-    <property file="nbproject/suite.properties"/>
-    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
-    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
-    <property file="${suite.dir}/nbproject/platform.properties"/>
-    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="name"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{name}" value="${@{value}}"/>
-        </sequential>
-    </macrodef>
-    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="property"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{property}" value="@{value}"/>
-        </sequential>
-    </macrodef>
-    <property file="${user.properties.file}"/>
-    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
-        <condition>
-            <not>
-                <contains string="${cluster.path.evaluated}" substring="platform"/>
-            </not>
-        </condition>
-    </fail>
-    <import file="${harness.dir}/build.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/nbproject/genfiles.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=216fc635
-nbproject/build-impl.xml.script.CRC32=6022dc85
-nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/nbproject/platform.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-# Deprecated since 5.0u1; for compatibility with 5.0:
-disabled.clusters=\
-    apisupport1,\
-    gsf1,\
-    harness,\
-    java2,\
-    nb6.1,\
-    profiler3
-disabled.modules=\
-    org.apache.xml.resolver,\
-    org.netbeans.api.debugger,\
-    org.netbeans.api.xml,\
-    org.netbeans.core.execution,\
-    org.netbeans.core.ide,\
-    org.netbeans.core.multiview,\
-    org.netbeans.core.nativeaccess,\
-    org.netbeans.core.output2,\
-    org.netbeans.insane,\
-    org.netbeans.lib.cvsclient,\
-    org.netbeans.libs.commons_logging,\
-    org.netbeans.libs.freemarker,\
-    org.netbeans.libs.ini4j,\
-    org.netbeans.libs.jna,\
-    org.netbeans.libs.jsch,\
-    org.netbeans.libs.jsr223,\
-    org.netbeans.libs.lucene,\
-    org.netbeans.libs.svnClientAdapter,\
-    org.netbeans.libs.xerces,\
-    org.netbeans.modules.applemenu,\
-    org.netbeans.modules.autoupdate.services,\
-    org.netbeans.modules.autoupdate.ui,\
-    org.netbeans.modules.classfile,\
-    org.netbeans.modules.core.kit,\
-    org.netbeans.modules.db,\
-    org.netbeans.modules.db.core,\
-    org.netbeans.modules.db.drivers,\
-    org.netbeans.modules.db.kit,\
-    org.netbeans.modules.db.mysql,\
-    org.netbeans.modules.db.sql.editor,\
-    org.netbeans.modules.db.sql.visualeditor,\
-    org.netbeans.modules.dbapi,\
-    org.netbeans.modules.defaults,\
-    org.netbeans.modules.diff,\
-    org.netbeans.modules.editor.bookmarks,\
-    org.netbeans.modules.editor.bracesmatching,\
-    org.netbeans.modules.editor.codetemplates,\
-    org.netbeans.modules.editor.completion,\
-    org.netbeans.modules.editor.errorstripe,\
-    org.netbeans.modules.editor.errorstripe.api,\
-    org.netbeans.modules.editor.guards,\
-    org.netbeans.modules.editor.highlights,\
-    org.netbeans.modules.editor.macros,\
-    org.netbeans.modules.editor.plain,\
-    org.netbeans.modules.editor.plain.lib,\
-    org.netbeans.modules.editor.structure,\
-    org.netbeans.modules.extbrowser,\
-    org.netbeans.modules.favorites,\
-    org.netbeans.modules.gototest,\
-    org.netbeans.modules.httpserver,\
-    org.netbeans.modules.ide.kit,\
-    org.netbeans.modules.image,\
-    org.netbeans.modules.javahelp,\
-    org.netbeans.modules.jumpto,\
-    org.netbeans.modules.languages,\
-    org.netbeans.modules.languages.bat,\
-    org.netbeans.modules.languages.diff,\
-    org.netbeans.modules.languages.manifest,\
-    org.netbeans.modules.languages.sh,\
-    org.netbeans.modules.lexer.editorbridge,\
-    org.netbeans.modules.lexer.nbbridge,\
-    org.netbeans.modules.localhistory,\
-    org.netbeans.modules.masterfs,\
-    org.netbeans.modules.mercurial,\
-    org.netbeans.modules.progress.ui,\
-    org.netbeans.modules.project.ant,\
-    org.netbeans.modules.project.libraries,\
-    org.netbeans.modules.projectui,\
-    org.netbeans.modules.projectuiapi,\
-    org.netbeans.modules.properties,\
-    org.netbeans.modules.properties.syntax,\
-    org.netbeans.modules.refactoring.api,\
-    org.netbeans.modules.schema2beans,\
-    org.netbeans.modules.sendopts,\
-    org.netbeans.modules.server,\
-    org.netbeans.modules.servletapi,\
-    org.netbeans.modules.subversion,\
-    org.netbeans.modules.tasklist.kit,\
-    org.netbeans.modules.tasklist.projectint,\
-    org.netbeans.modules.tasklist.todo,\
-    org.netbeans.modules.tasklist.ui,\
-    org.netbeans.modules.templates,\
-    org.netbeans.modules.timers,\
-    org.netbeans.modules.usersguide,\
-    org.netbeans.modules.utilities,\
-    org.netbeans.modules.utilities.project,\
-    org.netbeans.modules.versioning,\
-    org.netbeans.modules.versioning.system.cvss,\
-    org.netbeans.modules.versioning.util,\
-    org.netbeans.modules.web.flyingsaucer,\
-    org.netbeans.modules.xml,\
-    org.netbeans.modules.xml.axi,\
-    org.netbeans.modules.xml.catalog,\
-    org.netbeans.modules.xml.core,\
-    org.netbeans.modules.xml.lexer,\
-    org.netbeans.modules.xml.multiview,\
-    org.netbeans.modules.xml.retriever,\
-    org.netbeans.modules.xml.schema.completion,\
-    org.netbeans.modules.xml.schema.model,\
-    org.netbeans.modules.xml.tax,\
-    org.netbeans.modules.xml.text,\
-    org.netbeans.modules.xml.tools,\
-    org.netbeans.modules.xml.wsdl.model,\
-    org.netbeans.modules.xml.xam,\
-    org.netbeans.modules.xml.xdm,\
-    org.netbeans.modules.xsl,\
-    org.netbeans.spi.debugger.ui,\
-    org.netbeans.spi.editor.hints,\
-    org.netbeans.spi.navigator,\
-    org.netbeans.spi.palette,\
-    org.netbeans.spi.tasklist,\
-    org.netbeans.spi.viewmodel,\
-    org.netbeans.swing.dirchooser,\
-    org.openide.compat,\
-    org.openide.util.enumerations
-enabled.clusters=\
-    ide9,\
-    platform8
-nbjdk.active=default
-nbplatform.active=default
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/nbproject/project.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
-    <type>org.netbeans.modules.apisupport.project</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
-            <code-name-base>com.sun.hotspot.igv.structuredtext</code-name-base>
-            <suite-component/>
-            <module-dependencies/>
-            <public-packages>
-                <package>com.sun.hotspot.igv.structuredtext</package>
-                <package>com.sun.hotspot.igv.structuredtext.services</package>
-            </public-packages>
-        </data>
-    </configuration>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/nbproject/suite.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-suite.dir=${basedir}/..
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/Bundle.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-OpenIDE-Module-Name=StructuredText
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/Element.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +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.sun.hotspot.igv.structuredtext;
-
-import com.sun.hotspot.igv.structuredtext.services.ElementVisitor;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import javax.swing.text.Style;
-import javax.swing.text.StyleContext;
-
-/**
- *
- * @author Thomas
- */
-public abstract class Element {
-    
-    private Set<Object> source;
-    private Style style;
-    private Style highlightedStyle;
-    
-    public Element() {
-        source = new HashSet<Object>();
-        style = null;
-        highlightedStyle = null;
-    }
-    
-    public Style getStyle() {
-        return style;
-    }
-
-    public Style getHighlightedStyle() {
-        return highlightedStyle;
-    }
-    
-    public void setStyle(Style style) {
-        this.style = style;
-    }
-
-    public void setHighlightedStyle(Style style) {
-        this.highlightedStyle = style;
-    }
-    
-    public void setStyleRecursive(Style style) {
-        this.style = style;
-    }
-
-    public void setHighlightedStyleRecursive(Style style) {
-        this.highlightedStyle = style;
-    }
-    
-    public Set<Object> getSource() {
-        return Collections.unmodifiableSet(source);
-    }
-    
-    public void addSource(Object o) {
-        source.add(o);
-    }
-    
-    public abstract void accept(ElementVisitor visitor);
-}
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/MultiElement.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +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.sun.hotspot.igv.structuredtext;
-
-import com.sun.hotspot.igv.structuredtext.services.ElementVisitor;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.swing.text.Style;
-
-/**
- *
- * @author Thomas
- */
-public class MultiElement extends Element {
-
-    private List<Element> children;
-    private String foldString;
-    
-    public MultiElement() {
-        this((String)null);
-    }
-       
-    public MultiElement(String foldString) {
-        this(foldString, null);
-    }
-    
-    public MultiElement(Style style) {
-        this(null, style);
-    }
-    
-    public MultiElement(String foldString, Style style) {
-        setStyle(style);
-        this.foldString = foldString;
-        children = new ArrayList<Element>();
-    }
-    
-    public void print(String s) {
-        print(s, null);
-    }
-
-    @Override
-    public void setStyleRecursive(Style style) {
-        super.setStyleRecursive(style);
-        for(Element elem : this.getChildren()) {
-            elem.setStyleRecursive(style);
-        }
-    }
-
-    @Override
-    public void setHighlightedStyleRecursive(Style style) {
-        super.setStyleRecursive(style);
-        for(Element elem : this.getChildren()) {
-            elem.setHighlightedStyleRecursive(style);
-        }
-    }
-    
-    public void print(String s, Object source) {
-        if (s == null) {
-            s = "";
-        }
-        SimpleElement elem = new SimpleElement(s);
-        if(source != null) {
-            elem.addSource(source);
-        }
-        addChild(elem);
-    }
-
-    public void print(String s, Object source, int padding) {
-        if (s == null) {
-            s = "";
-        }
-        StringBuilder sb = new StringBuilder(s);
-        while (sb.length() < padding) {
-            sb.insert(0, ' ');
-        }
-        print(sb.toString(), source);
-    }
-
-    public void println() {
-        println("");
-    }
-    
-    public void println(String s) {
-        print(s + "\n");
-    }
-    
-    public void println(String s, Object source) {
-        print(s + "\n", source);
-    }
-    
-    
-    public void println(String s, Object source, int padding) {
-        print(s + "\n", source, padding);
-    }
-    
-    public void addChild(Element element) {
-        assert element != null;
-        this.children.add(element);
-    }
-    
-    public String getFoldString() {
-        return foldString;
-    }
-    
-    public void setFoldString(String s) {
-        this.foldString = s;
-    }
-    
-    public List<Element> getChildren() {
-        return Collections.unmodifiableList(children);
-    }
-    
-    public void accept(ElementVisitor visitor) {
-        visitor.visit(this);
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/Range.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +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.sun.hotspot.igv.structuredtext;
-
-/**
- *
- * @author Thomas
- */
-public class Range {
-    
-    private int start;
-    private int length;
-    
-    public Range(int start, int length) {
-        this.start = start;
-        this.length = length;
-    }
-    
-    public int getStart() {
-        return start;
-    }
-    
-    public boolean overlaps(Range r2) {
-        if(start < r2.start) {
-            return start + length > r2.start;
-        } else {
-            return r2.start + r2.length > start;
-        }
-    }
-    
-    public int getLength() {
-        return length;
-    }
-
-}
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/SimpleElement.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +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.sun.hotspot.igv.structuredtext;
-
-import com.sun.hotspot.igv.structuredtext.services.ElementVisitor;
-import javax.swing.text.Style;
-import javax.swing.text.StyleContext;
-
-/**
- *
- * @author Thomas
- */
-public class SimpleElement extends Element {
-
-    public static final Element EMPTY = new SimpleElement("");
-    public static final Element LN = new SimpleElement("\n");
-    public static final Element TAB = new SimpleElement("\t");
-    
-    private String text;
-    
-    public SimpleElement(String s) {
-        this(s, null);
-    }
-    
-    public SimpleElement(String s, Style style) {
-        setText(s);
-        setStyle(style);
-        assert text != null;
-    }
-    
-    private static String addPadding(String s, int minLength) {
-        
-        StringBuilder sb = new StringBuilder(s);
-        while(sb.length() < minLength) {
-            sb.insert(0, ' ');
-        }
-        return sb.toString();
-    }
-    
-    public SimpleElement(String s, int length) {
-        this(addPadding(s, length));
-    }
-    
-    
-    public String getText() {
-        return text;
-    }
-    
-    public void setText(String s) {
-        this.text = s;
-    }
-    
-    public void accept(ElementVisitor visitor) {
-        visitor.visit(this);
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/StructuredText.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +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.sun.hotspot.igv.structuredtext;
-
-import com.sun.hotspot.igv.structuredtext.services.ElementVisitor;
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- *
- * @author Thomas
- */
-public class StructuredText extends MultiElement {
-    
-    private String name;
-    
-    public StructuredText(String name) {
-        this.name = name;
-    }
-    
-    public String getName() {
-        return name;
-    }
-    
-    public Element findElementAt(final int searchIndex) {
-        
-        final Element[] result = new Element[1];
-        this.accept(new ElementVisitor() {
-            
-            private int index;
-            
-            @Override
-            public void visit(MultiElement element) {
-                int startIndex = index;
-                super.visit(element);
-            }
-
-            @Override
-            public void visit(SimpleElement element) {
-                if(searchIndex >= index && searchIndex < index + element.getText().length()) {
-                    assert result[0] == null;
-                    result[0] = element;
-                }
-                index += element.getText().length();
-            }
-        });
-        
-        return result[0];
-    }
-    
-    public Map<Element, Range> calculateRanges() {
-        
-        final Map<Element, Range> result = new HashMap<Element, Range>();
-        
-        this.accept(new ElementVisitor() {
-            
-            private int index;
-            
-            @Override
-            public void visit(MultiElement element) {
-                int startIndex = index;
-                super.visit(element);
-                result.put(element, new Range(startIndex, index - startIndex));
-            }
-
-            @Override
-            public void visit(SimpleElement element) {
-                result.put(element, new Range(index, element.getText().length()));
-                index += element.getText().length();
-            }
-        });
-        
-        
-        return result;
-        
-    }
-    
-    public String convertToString() {
-        final StringBuilder result = new StringBuilder();
-        this.accept(new ElementVisitor() {
-            @Override
-            public void visit(SimpleElement element) {
-                result.append(element.getText());
-            }
-        }
-        );
-        return result.toString();
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/ToolTipProvider.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +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.sun.hotspot.igv.structuredtext;
-
-/**
- *
- * @author thomas
- */
-public interface ToolTipProvider {
-
-        String getToolTip();
-
-}
--- a/src/share/tools/IdealGraphVisualizer/StructuredText/src/com/sun/hotspot/igv/structuredtext/services/ElementVisitor.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +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.sun.hotspot.igv.structuredtext.services;
-
-import com.sun.hotspot.igv.structuredtext.Element;
-import com.sun.hotspot.igv.structuredtext.MultiElement;
-import com.sun.hotspot.igv.structuredtext.SimpleElement;
-
-/**
- *
- * @author Thomas
- */
-public abstract class ElementVisitor {
-
-    public void visit(MultiElement element) {
-        
-        for(Element e : element.getChildren()) {
-            e.accept(this);
-        }
-    }
-    public abstract void visit(SimpleElement element);
-}
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/build.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
-<!-- for some information on what you could do (e.g. targets to override). -->
-<!-- If you delete this file and reopen the project it will be recreated. -->
-<project name="com.sun.hotspot.igv.texteditor" default="netbeans" basedir=".">
-    <description>Builds, tests, and runs the project com.sun.hotspot.igv.texteditor.</description>
-    <import file="nbproject/build-impl.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/manifest.mf	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-OpenIDE-Module: com.sun.hotspot.igv.texteditor
-OpenIDE-Module-Layer: com/sun/hotspot/igv/texteditor/layer.xml
-OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/texteditor/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.0
-
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/nbproject/build-impl.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-*** GENERATED FROM project.xml - DO NOT EDIT  ***
-***         EDIT ../build.xml INSTEAD         ***
--->
-<project name="com.sun.hotspot.igv.texteditor-impl" basedir="..">
-    <fail message="Please build using Ant 1.7.1 or higher.">
-        <condition>
-            <not>
-                <antversion atleast="1.7.1"/>
-            </not>
-        </condition>
-    </fail>
-    <property file="nbproject/private/suite-private.properties"/>
-    <property file="nbproject/suite.properties"/>
-    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
-    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
-    <property file="${suite.dir}/nbproject/platform.properties"/>
-    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="name"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{name}" value="${@{value}}"/>
-        </sequential>
-    </macrodef>
-    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
-        <attribute name="property"/>
-        <attribute name="value"/>
-        <sequential>
-            <property name="@{property}" value="@{value}"/>
-        </sequential>
-    </macrodef>
-    <property file="${user.properties.file}"/>
-    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
-    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
-        <condition>
-            <not>
-                <contains string="${cluster.path.evaluated}" substring="platform"/>
-            </not>
-        </condition>
-    </fail>
-    <import file="${harness.dir}/build.xml"/>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/nbproject/genfiles.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=ddc04434
-nbproject/build-impl.xml.script.CRC32=122053f6
-nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.46.2
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/nbproject/platform.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-# Deprecated since 5.0u1; for compatibility with 5.0:
-disabled.clusters=\
-    apisupport1,\
-    gsf1,\
-    harness,\
-    java2,\
-    nb6.1,\
-    profiler3
-disabled.modules=\
-    org.apache.xml.resolver,\
-    org.netbeans.api.debugger,\
-    org.netbeans.api.xml,\
-    org.netbeans.core.execution,\
-    org.netbeans.core.ide,\
-    org.netbeans.core.multiview,\
-    org.netbeans.core.nativeaccess,\
-    org.netbeans.core.output2,\
-    org.netbeans.insane,\
-    org.netbeans.lib.cvsclient,\
-    org.netbeans.libs.commons_logging,\
-    org.netbeans.libs.freemarker,\
-    org.netbeans.libs.ini4j,\
-    org.netbeans.libs.jna,\
-    org.netbeans.libs.jsch,\
-    org.netbeans.libs.jsr223,\
-    org.netbeans.libs.lucene,\
-    org.netbeans.libs.svnClientAdapter,\
-    org.netbeans.libs.xerces,\
-    org.netbeans.modules.applemenu,\
-    org.netbeans.modules.autoupdate.services,\
-    org.netbeans.modules.autoupdate.ui,\
-    org.netbeans.modules.classfile,\
-    org.netbeans.modules.core.kit,\
-    org.netbeans.modules.db,\
-    org.netbeans.modules.db.core,\
-    org.netbeans.modules.db.drivers,\
-    org.netbeans.modules.db.kit,\
-    org.netbeans.modules.db.mysql,\
-    org.netbeans.modules.db.sql.editor,\
-    org.netbeans.modules.db.sql.visualeditor,\
-    org.netbeans.modules.dbapi,\
-    org.netbeans.modules.defaults,\
-    org.netbeans.modules.diff,\
-    org.netbeans.modules.editor.bookmarks,\
-    org.netbeans.modules.editor.bracesmatching,\
-    org.netbeans.modules.editor.codetemplates,\
-    org.netbeans.modules.editor.completion,\
-    org.netbeans.modules.editor.errorstripe,\
-    org.netbeans.modules.editor.errorstripe.api,\
-    org.netbeans.modules.editor.guards,\
-    org.netbeans.modules.editor.highlights,\
-    org.netbeans.modules.editor.macros,\
-    org.netbeans.modules.editor.plain,\
-    org.netbeans.modules.editor.plain.lib,\
-    org.netbeans.modules.editor.structure,\
-    org.netbeans.modules.extbrowser,\
-    org.netbeans.modules.favorites,\
-    org.netbeans.modules.gototest,\
-    org.netbeans.modules.httpserver,\
-    org.netbeans.modules.ide.kit,\
-    org.netbeans.modules.image,\
-    org.netbeans.modules.javahelp,\
-    org.netbeans.modules.jumpto,\
-    org.netbeans.modules.languages,\
-    org.netbeans.modules.languages.bat,\
-    org.netbeans.modules.languages.diff,\
-    org.netbeans.modules.languages.manifest,\
-    org.netbeans.modules.languages.sh,\
-    org.netbeans.modules.lexer.editorbridge,\
-    org.netbeans.modules.lexer.nbbridge,\
-    org.netbeans.modules.localhistory,\
-    org.netbeans.modules.masterfs,\
-    org.netbeans.modules.mercurial,\
-    org.netbeans.modules.progress.ui,\
-    org.netbeans.modules.project.ant,\
-    org.netbeans.modules.project.libraries,\
-    org.netbeans.modules.projectui,\
-    org.netbeans.modules.projectuiapi,\
-    org.netbeans.modules.properties,\
-    org.netbeans.modules.properties.syntax,\
-    org.netbeans.modules.refactoring.api,\
-    org.netbeans.modules.schema2beans,\
-    org.netbeans.modules.sendopts,\
-    org.netbeans.modules.server,\
-    org.netbeans.modules.servletapi,\
-    org.netbeans.modules.subversion,\
-    org.netbeans.modules.tasklist.kit,\
-    org.netbeans.modules.tasklist.projectint,\
-    org.netbeans.modules.tasklist.todo,\
-    org.netbeans.modules.tasklist.ui,\
-    org.netbeans.modules.templates,\
-    org.netbeans.modules.timers,\
-    org.netbeans.modules.usersguide,\
-    org.netbeans.modules.utilities,\
-    org.netbeans.modules.utilities.project,\
-    org.netbeans.modules.versioning,\
-    org.netbeans.modules.versioning.system.cvss,\
-    org.netbeans.modules.versioning.util,\
-    org.netbeans.modules.web.flyingsaucer,\
-    org.netbeans.modules.xml,\
-    org.netbeans.modules.xml.axi,\
-    org.netbeans.modules.xml.catalog,\
-    org.netbeans.modules.xml.core,\
-    org.netbeans.modules.xml.lexer,\
-    org.netbeans.modules.xml.multiview,\
-    org.netbeans.modules.xml.retriever,\
-    org.netbeans.modules.xml.schema.completion,\
-    org.netbeans.modules.xml.schema.model,\
-    org.netbeans.modules.xml.tax,\
-    org.netbeans.modules.xml.text,\
-    org.netbeans.modules.xml.tools,\
-    org.netbeans.modules.xml.wsdl.model,\
-    org.netbeans.modules.xml.xam,\
-    org.netbeans.modules.xml.xdm,\
-    org.netbeans.modules.xsl,\
-    org.netbeans.spi.debugger.ui,\
-    org.netbeans.spi.editor.hints,\
-    org.netbeans.spi.navigator,\
-    org.netbeans.spi.palette,\
-    org.netbeans.spi.tasklist,\
-    org.netbeans.spi.viewmodel,\
-    org.netbeans.swing.dirchooser,\
-    org.openide.compat,\
-    org.openide.util.enumerations
-enabled.clusters=\
-    ide9,\
-    platform8
-nbjdk.active=default
-nbplatform.active=default
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/nbproject/project.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
-    <type>org.netbeans.modules.apisupport.project</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
-            <code-name-base>com.sun.hotspot.igv.texteditor</code-name-base>
-            <suite-component/>
-            <module-dependencies>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.data</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.selectioncoordinator</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>com.sun.hotspot.igv.structuredtext</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>1.0</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.netbeans.modules.editor</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <release-version>3</release-version>
-                        <specification-version>1.42.2.3.9.2</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.netbeans.modules.editor.deprecated.pre65formatting</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <release-version>0-1</release-version>
-                        <specification-version>1.4.1.1.5.13.10</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.netbeans.modules.editor.fold</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <release-version>1</release-version>
-                        <specification-version>1.8</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <release-version>3</release-version>
-                        <specification-version>3.8.1.13.9</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.netbeans.modules.editor.lib2</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <release-version>1</release-version>
-                        <specification-version>1.11.2.2</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.text</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>6.18</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.util</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>7.12.0.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.util.lookup</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>8.8.1</specification-version>
-                    </run-dependency>
-                </dependency>
-                <dependency>
-                    <code-name-base>org.openide.windows</code-name-base>
-                    <build-prerequisite/>
-                    <compile-dependency/>
-                    <run-dependency>
-                        <specification-version>6.20</specification-version>
-                    </run-dependency>
-                </dependency>
-            </module-dependencies>
-            <public-packages>
-                <package>com.sun.hotspot.igv.texteditor</package>
-            </public-packages>
-        </data>
-    </configuration>
-</project>
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/nbproject/suite.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-suite.dir=${basedir}/..
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/Bundle.properties	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-
-OpenIDE-Module-Name=TextEditor
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/SyntaxLayer.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,327 +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.sun.hotspot.igv.texteditor;
-
-import com.sun.hotspot.igv.data.ChangedListener;
-import com.sun.hotspot.igv.selectioncoordinator.SelectionCoordinator;
-import com.sun.hotspot.igv.structuredtext.MultiElement;
-import com.sun.hotspot.igv.structuredtext.SimpleElement;
-import com.sun.hotspot.igv.structuredtext.StructuredText;
-import com.sun.hotspot.igv.structuredtext.Element;
-import com.sun.hotspot.igv.structuredtext.Range;
-import com.sun.hotspot.igv.structuredtext.ToolTipProvider;
-import com.sun.hotspot.igv.structuredtext.services.ElementVisitor;
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.Style;
-import javax.swing.text.StyleConstants;
-import javax.swing.text.StyleContext;
-import org.netbeans.spi.editor.highlighting.HighlightsLayerFactory;
-import org.netbeans.spi.editor.highlighting.HighlightsSequence;
-import org.netbeans.spi.editor.highlighting.support.AbstractHighlightsContainer;
-
-/**
- *
- * @author Thomas
- */
-public class SyntaxLayer extends AbstractHighlightsContainer implements ChangedListener<SelectionCoordinator> {
-
-    private HighlightsLayerFactory.Context context;
-
-    public SyntaxLayer(final HighlightsLayerFactory.Context context) {
-        this.context = context;
-
-        context.getDocument().addDocumentListener(new DocumentListener() {
-
-            public void insertUpdate(DocumentEvent arg0) {
-                update();
-            }
-
-            public void removeUpdate(DocumentEvent arg0) {
-            }
-
-            public void changedUpdate(DocumentEvent arg0) {
-            }
-        });
-
-        SelectionCoordinator.getInstance().getSelectedChangedEvent().addListener(this);
-        SelectionCoordinator.getInstance().getHighlightedChangedEvent().addListener(this);
-
-        context.getComponent().addMouseMotionListener(new MouseMotionListener() {
-
-            public void mouseDragged(MouseEvent e) {
-            }
-
-            public void mouseMoved(MouseEvent e) {
-                // [tw] hack to prevent sidebar mouse over
-                if (e.getPoint().getX() < 15) return;
-
-                int index = context.getComponent().viewToModel(e.getPoint());
-                Element elem = indexToElement(index);
-                if (elem != null) {
-                    Set<Object> highlightedSource = new HashSet<Object>(elem.getSource());
-                    SelectionCoordinator.getInstance().setHighlightedObjects(highlightedSource);
-                    context.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
-                }
-            }
-        });
-
-        context.getComponent().addMouseListener(new MouseListener() {
-
-            public void mouseClicked(MouseEvent e) {
-                
-                int index = context.getComponent().viewToModel(e.getPoint());
-                Element elem = indexToElement(index);
-                if (elem != null) {
-                    Set<Object> selectedSource = new HashSet<Object>(elem.getSource());
-
-                    for (Object o : selectedSource) {
-                        if (o instanceof ToolTipProvider) {
-                            String toolTip = ((ToolTipProvider) o).getToolTip();
-                        }
-                    }
-
-                    if ((e.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) != 0) {
-
-                        SelectionCoordinator.getInstance().addAllSelected(selectedSource);
-                    } else {
-                        SelectionCoordinator.getInstance().setSelectedObjects(selectedSource);
-                    }
-                    context.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
-                } else {
-                    context.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
-
-                }
-            }
-
-            public void mousePressed(MouseEvent e) {
-            }
-
-            public void mouseReleased(MouseEvent e) {
-            }
-
-            public void mouseEntered(MouseEvent e) {
-            }
-
-            public void mouseExited(MouseEvent e) {
-                SelectionCoordinator.getInstance().setHighlightedObjects(new HashSet<Object>());
-            }
-        });
-    }
-
-    public void changed(SelectionCoordinator source) {
-        update();
-    }
-
-    private void update() {
-        fireHighlightsChange(0, context.getDocument().getLength());
-    }
-
-    private Element indexToElement(int index) {
-        StructuredText text = (StructuredText) context.getDocument().getProperty(StructuredText.class);
-        if (text == null) {
-            return null;
-        }
-        return text.findElementAt(index);
-    }
-
-    private static class HighlightsRange {
-
-        private int start;
-        private int end;
-        private AttributeSet attributes;
-
-        public HighlightsRange(int start, int length, AttributeSet attributes) {
-            this.start = start;
-            this.end = start + length;
-            this.attributes = attributes;
-        }
-
-        public int getStart() {
-            return start;
-        }
-
-        public int getEnd() {
-            return end;
-        }
-
-        public AttributeSet getAttributes() {
-            return attributes;
-        }
-    }
-
-    private static class HighlightsSequenceImpl implements HighlightsSequence {
-
-        private List<HighlightsRange> ranges;
-        private int currentIndex;
-
-        public HighlightsSequenceImpl() {
-            this(new ArrayList<HighlightsRange>());
-        }
-
-        public HighlightsSequenceImpl(List<HighlightsRange> ranges) {
-            this.ranges = ranges;
-            this.currentIndex = -1;
-        }
-
-        public boolean moveNext() {
-            currentIndex++;
-            return currentIndex < ranges.size();
-        }
-
-        public int getStartOffset() {
-            return ranges.get(currentIndex).getStart();
-        }
-
-        public int getEndOffset() {
-            return ranges.get(currentIndex).getEnd();
-        }
-
-        public AttributeSet getAttributes() {
-            return ranges.get(currentIndex).getAttributes();
-        }
-    }
-
-    private boolean intersects(Set<Object> s1, Set<Object> s2) {
-        for (Object o : s1) {
-            if (s2.contains(o)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public HighlightsSequence getHighlights(final int start, final int end) {
-
-        StructuredText text = (StructuredText) context.getDocument().getProperty(StructuredText.class);
-        if (text == null) {
-            return new HighlightsSequenceImpl();
-        }
-        final Map<Element, Range> ranges = text.calculateRanges();
-        final List<HighlightsRange> highlightsRanges = new ArrayList<HighlightsRange>();
-        final Range baseRange = new Range(start, end - start);
-
-        text.accept(new ElementVisitor() {
-            
-            private Stack<Style> styleStack = new Stack<Style>();
-            private Stack<Style> highlightedStyleStack = new Stack<Style>();
-            private Stack<MultiElement> parentElements = new Stack<MultiElement>();
-            
-            @Override
-            public void visit(MultiElement element) {
-                Style curStyle = element.getStyle();
-                Style curHighlightedStyle = element.getHighlightedStyle();
-                if(curStyle != null) {
-                    styleStack.push(curStyle);
-                }
-                if (curHighlightedStyle != null) {
-                    highlightedStyleStack.push(curHighlightedStyle);
-                }
-                parentElements.push(element);
-                super.visit(element);
-                if(curStyle != null) {
-                    styleStack.pop();
-                }
-                if (curHighlightedStyle != null) {
-                    highlightedStyleStack.pop();
-                }
-                parentElements.pop();
-            }
-            
-
-            @Override
-            public void visit(SimpleElement element) {
-                Range curRange = ranges.get(element);
-                if (baseRange.overlaps(curRange)) {
-                    Style style = element.getStyle();
-                    if(style == null) {
-                        if(styleStack.size() > 0) {
-                            style = styleStack.peek();
-                        } else {
-                            style = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
-                            StyleConstants.setBackground(style, Color.WHITE);
-                        }
-                    }
-                    
-                    
-                    Style highlightedStyle = element.getHighlightedStyle();
-                    if (highlightedStyle == null) {
-                        if (highlightedStyleStack.size() > 0) {
-                            highlightedStyle = highlightedStyleStack.peek();
-                        }
-                    }
-
-                    Set<Object> highlightedSource = SelectionCoordinator.getInstance().getHighlightedObjects();
-                    if (highlightedSource != null) {
-                        
-                        boolean doesIntersect = intersects(element.getSource(), highlightedSource);
-                        for (MultiElement parentElement : parentElements) {
-                            if (doesIntersect) {
-                                break;
-                            }
-
-                            doesIntersect = intersects(parentElement.getSource(), highlightedSource);
-                        }
-
-                        if (doesIntersect) {
-
-                            if (highlightedStyle != null) {
-                                style = highlightedStyle;
-                            } else {
-                                style = StyleContext.getDefaultStyleContext().addStyle(null, style);
-                                Color bg = StyleConstants.getBackground(style);
-                                Color fg = StyleConstants.getForeground(style);
-                                StyleConstants.setBackground(style, new Color(255 - bg.getRed(), 255 - bg.getGreen(), 255 - bg.getBlue()));
-                                StyleConstants.setForeground(style, new Color(255 - fg.getRed(), 255 - fg.getGreen(), 255 - fg.getBlue()));
-                            }
-                        }
-                    }
-
-                    Set<Object> selectedSource = SelectionCoordinator.getInstance().getSelectedObjects();
-                    if (selectedSource != null && intersects(element.getSource(), selectedSource)) {
-                        style = StyleContext.getDefaultStyleContext().addStyle(null, style);
-                        StyleConstants.setBold(style, true);
-                    }
-
-                    highlightsRanges.add(new HighlightsRange(curRange.getStart(), curRange.getLength(), style));
-                }
-            }
-        });
-
-        return new HighlightsSequenceImpl(highlightsRanges);
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/TextEditor.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +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.sun.hotspot.igv.texteditor;
-
-import com.sun.hotspot.igv.structuredtext.Element;
-import com.sun.hotspot.igv.structuredtext.MultiElement;
-import com.sun.hotspot.igv.structuredtext.SimpleElement;
-import com.sun.hotspot.igv.structuredtext.StructuredText;
-import com.sun.hotspot.igv.structuredtext.services.ElementVisitor;
-import java.awt.Component;
-import java.util.HashSet;
-import java.util.Set;
-import javax.swing.JEditorPane;
-import javax.swing.SwingUtilities;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.Document;
-import javax.swing.text.Position;
-import javax.swing.text.SimpleAttributeSet;
-import org.netbeans.modules.editor.NbEditorDocument;
-import org.netbeans.modules.editor.NbEditorUtilities;
-import org.openide.text.Annotation;
-import org.openide.text.Line;
-import org.openide.util.Exceptions;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class TextEditor {
-    
-    private JEditorPane editorPane;
-    private Component component;
-    private Set<Annotation> addedAnnotations;
-    
-    public TextEditor() {
-        editorPane = new JEditorPane();
-        component = createEditor(editorPane);
-        addedAnnotations = new HashSet<Annotation>();
-        
-    }
-    
-    public Component getComponent() {
-        return component;
-    }
-
-    public void setStructuredText(StructuredText text) {
-        assert text != null;
-        
-        setStructuredText(text, null);
-    }
-    
-    public void setStructuredText(final StructuredText text, final Element focusedElement) {
-        
-        assert text != null;
-
-        SwingUtilities.invokeLater(new Runnable() {
-
-            public void run() {
-                Document doc = editorPane.getDocument();
-                doc.putProperty(StructuredText.class, text);
-
-                for (Annotation a : addedAnnotations) {
-                    ((NbEditorDocument) editorPane.getDocument()).removeAnnotation(a);
-                }
-
-                try {
-                    editorPane.getDocument().remove(0, editorPane.getDocument().getLength());
-                    editorPane.getDocument().insertString(0, text.convertToString(), SimpleAttributeSet.EMPTY);
-
-                    text.accept(new ElementVisitor() {
-
-                        private int pos = 0;
-
-                        private void checkForFocus(Element element) {
-                            if (element == focusedElement) {
-                                editorPane.setCaretPosition(pos);
-                            }
-                        }
-
-                        @Override
-                        public void visit(MultiElement element) {
-                            super.visit(element);
-                            checkForFocus(element);
-                        }
-
-                        @Override
-                        public void visit(SimpleElement element) {
-                            checkForFocus(element);
-                            for (Object o : element.getSource()) {
-                                if (o instanceof Annotation) {
-                                    Annotation a = (Annotation) o;
-                                    final Line line = NbEditorUtilities.getLine(editorPane.getDocument(), pos, false);
-
-                                    ((NbEditorDocument) editorPane.getDocument()).addAnnotation(new PositionImpl(pos), element.getText().length(), a);
-                                    addedAnnotations.add(a);
-                                }
-                            }
-                            pos += element.getText().length();
-                        }
-
-                        class PositionImpl implements Position {
-
-                            private int position;
-
-                            public PositionImpl(int position) {
-                                this.position = position;
-                            }
-
-                            public int getOffset() {
-                                return position;
-                            }
-                        }
-                    });
-
-                } catch (BadLocationException ex) {
-                    Exceptions.printStackTrace(ex);
-                }
-                
-            }
-        });
-       
-    }
-
-    private Component createEditor(JEditorPane pane) {
-        TextEditorKit kit = new TextEditorKit();
-        pane.setEditable(false);
-        NbEditorDocument doc = (NbEditorDocument) kit.createDefaultDocument();
-        pane.setEditorKit(kit);
-        pane.setDocument(doc);
-        return doc.createEditor(pane);
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/TextEditorKit.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.texteditor;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.swing.Action;
-import org.netbeans.editor.BaseDocument;
-import org.netbeans.modules.editor.NbEditorKit;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class TextEditorKit extends NbEditorKit {
-
-    public static final String MIME_TYPE = "text/text-igv";
-    
-    /**
-     * Actions to be not available in the editor.
-     */
-    private static final String[] ACTION_FILTER = {
-        NbEditorKit.shiftLineLeftAction,
-        NbEditorKit.shiftLineRightAction,
-        NbEditorKit.jumpListNextAction,
-        NbEditorKit.jumpListNextComponentAction,
-        NbEditorKit.jumpListPrevAction,
-        NbEditorKit.jumpListPrevComponentAction,
-        NbEditorKit.pasteAction,
-        NbEditorKit.removeLineAction,
-        NbEditorKit.cutAction,
-        NbEditorKit.findAction,
-        NbEditorKit.findNextAction,
-        NbEditorKit.findPreviousAction,
-        NbEditorKit.toggleHighlightSearchAction,
-        NbEditorKit.findSelectionAction,
-        "jump-list-last-edit"
-    };
-    
-    @Override
-    protected Action[] createActions() {
-        Action[] actions = super.createActions();
-        List<Action> returnedActions = new ArrayList<Action>();
-        for(Action a : actions) {
-            System.out.println("action: " + a.getValue(Action.NAME));
-            
-            boolean found = false;
-            for(String s : ACTION_FILTER) {
-                if(s.equals(a.getValue(Action.NAME))) {
-                    found = true;
-                }
-            }
-            if(!found) {
-                returnedActions.add(a);
-            }
-        }
-        
-        Action[] result = new Action[returnedActions.size()];
-        for(int i=0; i<returnedActions.size(); i++) {
-            result[i] = returnedActions.get(i);
-        }
-        
-        return result;
-    }
-
-    @Override
-    protected void initDocument(BaseDocument doc) {
-        super.initDocument(doc);
-        System.out.println("Initializing document: " + doc);
-        
-    }
-
-    @Override
-    public String getContentType() {
-        return MIME_TYPE;
-    }
-    
-    
-}
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/TextFoldManager.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.texteditor;
-
-import com.sun.hotspot.igv.structuredtext.MultiElement;
-import com.sun.hotspot.igv.structuredtext.SimpleElement;
-import javax.swing.event.DocumentEvent;
-import javax.swing.text.BadLocationException;
-import org.netbeans.api.editor.fold.Fold;
-import org.netbeans.spi.editor.fold.FoldHierarchyTransaction;
-import org.netbeans.spi.editor.fold.FoldManager;
-import org.netbeans.spi.editor.fold.FoldOperation;
-import com.sun.hotspot.igv.structuredtext.Element;
-import com.sun.hotspot.igv.structuredtext.Range;
-import com.sun.hotspot.igv.structuredtext.StructuredText;
-import com.sun.hotspot.igv.structuredtext.services.ElementVisitor;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Logger;
-import javax.swing.text.Document;
-import org.netbeans.api.editor.fold.FoldType;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class TextFoldManager implements FoldManager {
-
-    private FoldOperation operation;
-    private final FoldType defaultFoldType = new FoldType("default");
-    private Set<Fold> currentFolds;
-
-    public TextFoldManager() {
-        currentFolds = new HashSet<Fold>();
-    }
-
-    public void init(FoldOperation operation) {
-        this.operation = operation;
-    }
-
-    public void initFolds(final FoldHierarchyTransaction transaction) {
-    }
-
-    private void update(Document document, final FoldHierarchyTransaction transaction) {
-
-        
-        StructuredText text = (StructuredText) document.getProperty(StructuredText.class);
-        if (text == null) {
-            // No StructuredText object behind the document object.
-            return;
-        }
-        
-        if(document.getLength() == 0) {
-            return;
-        }
-        
-        final Map<Element, Range> ranges = text.calculateRanges();
-        currentFolds.clear();
-
-        text.accept(new ElementVisitor() {
-            @Override
-            public void visit(MultiElement element) {
-                super.visit(element);
-                Range curRange = ranges.get(element);
-
-                if (element.getFoldString() != null) {
-                    try {
-                        Fold f = operation.addToHierarchy(defaultFoldType, element.getFoldString(), false,
-                                curRange.getStart(), curRange.getStart() + curRange.getLength(), 0, 0,
-                                null, transaction);
-                        currentFolds.add(f);
-                    } catch (BadLocationException ex) {
-                        assert false : "Structured text not in sync with document content " + ex.getStackTrace();
-                    }
-                }
-            }
-
-            @Override
-            public void visit(SimpleElement element) {
-            }
-        });
-    }
-
-    public void insertUpdate(DocumentEvent event, FoldHierarchyTransaction transaction) {
-        update(event.getDocument(), transaction);
-    }
-
-    public void removeUpdate(DocumentEvent event, FoldHierarchyTransaction transaction) {
-        update(event.getDocument(), transaction);
-    }
-
-    public void changedUpdate(DocumentEvent event, FoldHierarchyTransaction transaction) {
-//        update(event.getDocument(), transaction);
-    }
-
-    public void removeEmptyNotify(Fold arg0) {
-    }
-
-    public void removeDamagedNotify(Fold arg0) {
-    }
-
-    public void expandNotify(Fold arg0) {
-    }
-
-    public void release() {
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/TextFoldManagerFactory.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.texteditor;
-
-import org.netbeans.spi.editor.fold.FoldManager;
-import org.netbeans.spi.editor.fold.FoldManagerFactory;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class TextFoldManagerFactory implements FoldManagerFactory{
-    public FoldManager createFoldManager() {
-        return new TextFoldManager();
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/TextHighlightsLayerFactory.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.texteditor;
-
-import org.netbeans.spi.editor.highlighting.HighlightsLayer;
-import org.netbeans.spi.editor.highlighting.HighlightsLayerFactory;
-import org.netbeans.spi.editor.highlighting.ZOrder;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class TextHighlightsLayerFactory implements HighlightsLayerFactory {
-    public HighlightsLayer[] createLayers(HighlightsLayerFactory.Context context) {
-        return new HighlightsLayer[] {
-            HighlightsLayer.create("com.sun.hotspot.igv.texteditor.SyntaxLayer", ZOrder.TOP_RACK, true, new SyntaxLayer(context))
-        };
-    }
-
-}
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/TextSideBarFactory.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.texteditor;
-
-import javax.swing.JComponent;
-import javax.swing.text.JTextComponent;
-import org.netbeans.editor.CodeFoldingSideBar;
-import org.netbeans.editor.SideBarFactory;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class TextSideBarFactory implements SideBarFactory {
-    public JComponent createSideBar(JTextComponent text) {
-        return new CodeFoldingSideBar(text);
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/layer.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
-<filesystem>
-    
-    <folder name="Editors">
-        <folder name="Preferences"/>
-        <folder name="text">
-            <folder name="text-igv">
-                <file name="EditorKit.instance">
-                <attr name="instanceClass" stringvalue="com.sun.hotspot.igv.texteditor.TextEditorKit"/>
-                </file>
-                <folder name="FoldManager">
-                    <file name="com-sun-hotspot-igv-texteditor-TextFoldManagerFactory.instance"/>
-                </folder>
-                <folder name="Preferences">
-                    <file name="org-netbeans-modules-editor-preferences.xml" url="org-netbeans-modules-editor-preferences.xml"/>
-                </folder>
-                <folder name="SideBar">
-                    <file name="com-sun-hotspot-igv-texteditor-TextSideBarFactory.instance">
-                        <attr name="position" intvalue="1500"/>
-                    </file>
-                </folder>
-                <file name="com-sun-hotspot-igv-texteditor-TextHighlightsLayerFactory.instance"/>
-                </folder>
-        </folder>
-    </folder>
-</filesystem>
--- a/src/share/tools/IdealGraphVisualizer/TextEditor/src/com/sun/hotspot/igv/texteditor/org-netbeans-modules-editor-preferences.xml	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-<!--
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-
-Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
-
-
-The contents of this file are subject to the terms of either the GNU
-General Public License Version 2 only ("GPL") or the Common
-Development and Distribution License("CDDL") (collectively, the
-"License"). You may not use this file except in compliance with the
-License. You can obtain a copy of the License at
-http://www.netbeans.org/cddl-gplv2.html
-or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
-specific language governing permissions and limitations under the
-License.  When distributing the software, include this License Header
-Notice in each file and include the License file at
-nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
-particular file as subject to the "Classpath" exception as provided
-by Sun in the GPL Version 2 section of the License file that
-accompanied this code. If applicable, add the following below the
-License Header, with the fields enclosed by brackets [] replaced by
-your own identifying information:
-"Portions Copyrighted [year] [name of copyright owner]"
-
-Contributor(s):
-
-The Original Software is NetBeans. The Initial Developer of the Original
-Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
-Microsystems, Inc. All Rights Reserved.
-
-If you wish your version of this file to be governed by only the CDDL
-or only the GPL Version 2, indicate your decision by adding
-"[Contributor] elects to include this software in this distribution
-under the [CDDL or GPL Version 2] license." If you do not indicate a
-single choice of license, a recipient has the option to distribute
-your version of this file under either the CDDL, the GPL Version 2 or
-to extend the choice of license to its licensees as provided above.
-However, if you add GPL Version 2 code and therefore, elected the GPL
-Version 2 license, then the option applies only if the new code is
-made subject to such option by the copyright holder.
--->
-<!DOCTYPE editor-preferences PUBLIC "-//NetBeans//DTD Editor Preferences 1.0//EN" "http://www.netbeans.org/dtds/EditorPreferences-1_0.dtd">
-
-<editor-preferences>
-    <entry name="toolbarVisible" value="false" javaType="java.lang.Boolean" />
-    <entry name="line-number-visible" value="false" javaType="java.lang.Boolean" />
-    <entry name="code-folding-enable" value="true" javaType="java.lang.Boolean" />
-    <entry name="status-bar-visible" value="false" javaType="java.lang.Boolean" />
-    <entry name="text-limit-line-visible" value="false" javaType="java.lang.Boolean" />
-</editor-preferences>
--- a/src/share/tools/IdealGraphVisualizer/Util/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Util/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/ColorIcon.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/ColorIcon.java	Thu Feb 02 16:07:52 2012 -0800
@@ -40,15 +40,18 @@
         color = c;
     }
 
+    @Override
     public void paintIcon(Component c, Graphics g, int x, int y) {
         g.setColor(color);
         g.fillRect(x, y, 16, 16);
     }
 
+    @Override
     public int getIconWidth() {
         return 16;
     }
 
+    @Override
     public int getIconHeight() {
         return 16;
     }
--- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/ContextAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/ContextAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,11 +25,7 @@
 package com.sun.hotspot.igv.util;
 
 import java.awt.EventQueue;
-import org.openide.util.ContextAwareAction;
-import org.openide.util.Lookup;
-import org.openide.util.LookupEvent;
-import org.openide.util.LookupListener;
-import org.openide.util.Utilities;
+import org.openide.util.*;
 import org.openide.util.actions.CallableSystemAction;
 
 /**
@@ -56,6 +52,7 @@
         resultChanged(null);
     }
 
+    @Override
     public void resultChanged(LookupEvent e) {
         if (result.allItems().size() != 0) {
             update(result.allInstances().iterator().next());
@@ -71,6 +68,7 @@
         // Ensure it's AWT event thread
         EventQueue.invokeLater(new Runnable() {
 
+            @Override
             public void run() {
                 performAction(t);
             }
--- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/ExtendedSatelliteComponent.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/ExtendedSatelliteComponent.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,11 +23,10 @@
  */
 package com.sun.hotspot.igv.util;
 
-import org.netbeans.api.visual.widget.Scene;
-
-import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
+import javax.swing.JComponent;
+import org.netbeans.api.visual.widget.Scene;
 
 /**
  * @author David Kaspar
@@ -118,27 +117,34 @@
         }
     }
 
+    @Override
     public void mouseClicked(MouseEvent e) {
     }
 
+    @Override
     public void mousePressed(MouseEvent e) {
         moveVisibleRect(e.getPoint());
     }
 
+    @Override
     public void mouseReleased(MouseEvent e) {
         moveVisibleRect(e.getPoint());
     }
 
+    @Override
     public void mouseEntered(MouseEvent e) {
     }
 
+    @Override
     public void mouseExited(MouseEvent e) {
     }
 
+    @Override
     public void mouseDragged(MouseEvent e) {
         moveVisibleRect(e.getPoint());
     }
 
+    @Override
     public void mouseMoved(MouseEvent e) {
     }
 
@@ -170,26 +176,33 @@
 
     }
 
+    @Override
     public void sceneRepaint() {
     }
 
+    @Override
     public void sceneValidating() {
     }
 
+    @Override
     public void sceneValidated() {
     }
 
+    @Override
     public void componentResized(ComponentEvent e) {
         repaint();
     }
 
+    @Override
     public void componentMoved(ComponentEvent e) {
         repaint();
     }
 
+    @Override
     public void componentShown(ComponentEvent e) {
     }
 
+    @Override
     public void componentHidden(ComponentEvent e) {
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/LookupHistory.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/LookupHistory.java	Thu Feb 02 16:07:52 2012 -0800
@@ -36,7 +36,7 @@
  */
 public class LookupHistory {
 
-    private static Map<Class, LookupHistoryImpl> cache = new HashMap<Class, LookupHistoryImpl>();
+    private static Map<Class, LookupHistoryImpl> cache = new HashMap<>();
 
     private static class LookupHistoryImpl<T> implements LookupListener {
 
@@ -55,6 +55,7 @@
             return last;
         }
 
+        @Override
         public void resultChanged(LookupEvent ev) {
             T current = Utilities.actionsGlobalContext().lookup(klass);
             if (current != null) {
@@ -65,7 +66,7 @@
 
     public static <T> void init(Class<T> klass) {
         if (!cache.containsKey(klass)) {
-            cache.put(klass, new LookupHistoryImpl<T>(klass));
+            cache.put(klass, new LookupHistoryImpl<>(klass));
         }
     }
 
--- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSlider.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSlider.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,15 +25,7 @@
 package com.sun.hotspot.igv.util;
 
 import com.sun.hotspot.igv.data.ChangedListener;
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.RenderingHints;
+import java.awt.*;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
 import java.awt.event.MouseMotionListener;
@@ -105,6 +97,7 @@
         return d;
     }
 
+    @Override
     public void changed(RangeSliderModel source) {
         update();
     }
@@ -240,6 +233,7 @@
         return false;
     }
 
+    @Override
     public void mouseDragged(MouseEvent e) {
         if (state == State.DragBar) {
             int firstX = this.getStartXPosition(model.getFirstPosition());
@@ -294,6 +288,7 @@
         return result;
     }
 
+    @Override
     public void mouseMoved(MouseEvent e) {
         isOverBar = false;
         if (model == null) {
@@ -313,6 +308,7 @@
         repaint();
     }
 
+    @Override
     public void mouseClicked(MouseEvent e) {
         if (e.getClickCount() > 1) {
             // Double click
@@ -321,6 +317,7 @@
         }
     }
 
+    @Override
     public void mousePressed(MouseEvent e) {
         if (model == null) {
             return;
@@ -341,6 +338,7 @@
         tempModel = model.copy();
     }
 
+    @Override
     public void mouseReleased(MouseEvent e) {
         if (model == null || tempModel == null) {
             return;
@@ -350,9 +348,11 @@
         tempModel = null;
     }
 
+    @Override
     public void mouseEntered(MouseEvent e) {
     }
 
+    @Override
     public void mouseExited(MouseEvent e) {
         isOverBar = false;
         repaint();
--- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,8 +24,8 @@
  */
 package com.sun.hotspot.igv.util;
 
+import com.sun.hotspot.igv.data.ChangedEvent;
 import com.sun.hotspot.igv.data.ChangedEventProvider;
-import com.sun.hotspot.igv.data.ChangedEvent;
 import java.awt.Color;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -65,14 +65,14 @@
 
     public RangeSliderModel(List<String> positions) {
         assert positions.size() > 0;
-        this.changedEvent = new ChangedEvent<RangeSliderModel>(this);
-        this.colorChangedEvent = new ChangedEvent<RangeSliderModel>(this);
+        this.changedEvent = new ChangedEvent<>(this);
+        this.colorChangedEvent = new ChangedEvent<>(this);
         setPositions(positions);
     }
 
     protected void setPositions(List<String> positions) {
         this.positions = positions;
-        colors = new ArrayList<Color>();
+        colors = new ArrayList<>();
         for (int i = 0; i < positions.size(); i++) {
             colors.add(Color.black);
         }
@@ -130,6 +130,7 @@
         return colorChangedEvent;
     }
 
+    @Override
     public ChangedEvent<RangeSliderModel> getChangedEvent() {
         return changedEvent;
     }
--- a/src/share/tools/IdealGraphVisualizer/View/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,2 +1,2 @@
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,77 +23,32 @@
  */
 package com.sun.hotspot.igv.view;
 
-import com.sun.hotspot.igv.view.widgets.BlockWidget;
-import com.sun.hotspot.igv.view.widgets.LineWidget;
-import com.sun.hotspot.igv.util.DoubleClickAction;
-import com.sun.hotspot.igv.data.InputBlock;
-import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.graph.Connection;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.graph.OutputSlot;
-import com.sun.hotspot.igv.hierarchicallayout.HierarchicalClusterLayoutManager;
-import com.sun.hotspot.igv.hierarchicallayout.OldHierarchicalLayoutManager;
-import com.sun.hotspot.igv.hierarchicallayout.HierarchicalLayoutManager;
-import com.sun.hotspot.igv.view.widgets.FigureWidget;
-import com.sun.hotspot.igv.layout.LayoutGraph;
-import com.sun.hotspot.igv.data.services.Scheduler;
 import com.sun.hotspot.igv.data.ChangedListener;
 import com.sun.hotspot.igv.data.ControllableChangedListener;
 import com.sun.hotspot.igv.data.Pair;
 import com.sun.hotspot.igv.data.Properties;
-import com.sun.hotspot.igv.graph.Block;
-import com.sun.hotspot.igv.graph.InputSlot;
-import com.sun.hotspot.igv.graph.Slot;
+import com.sun.hotspot.igv.graph.*;
+import com.sun.hotspot.igv.hierarchicallayout.HierarchicalLayoutManager;
+import com.sun.hotspot.igv.layout.LayoutGraph;
 import com.sun.hotspot.igv.selectioncoordinator.SelectionCoordinator;
 import com.sun.hotspot.igv.util.ColorIcon;
+import com.sun.hotspot.igv.util.DoubleClickAction;
 import com.sun.hotspot.igv.util.PropertiesSheet;
 import com.sun.hotspot.igv.view.actions.CustomizablePanAction;
-import com.sun.hotspot.igv.view.widgets.InputSlotWidget;
-import com.sun.hotspot.igv.view.widgets.OutputSlotWidget;
-import com.sun.hotspot.igv.view.widgets.SlotWidget;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseWheelEvent;
-import java.awt.event.MouseWheelListener;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
+import com.sun.hotspot.igv.view.widgets.*;
+import java.awt.*;
+import java.awt.event.*;
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.BorderFactory;
-import javax.swing.JComponent;
-import javax.swing.JPopupMenu;
-import javax.swing.JScrollPane;
-import javax.swing.SwingUtilities;
+import java.util.*;
+import javax.swing.*;
 import javax.swing.event.UndoableEditEvent;
 import javax.swing.undo.AbstractUndoableEdit;
 import javax.swing.undo.CannotRedoException;
 import javax.swing.undo.CannotUndoException;
-import org.netbeans.api.visual.action.ActionFactory;
-import org.netbeans.api.visual.action.PopupMenuProvider;
-import org.netbeans.api.visual.action.RectangularSelectDecorator;
-import org.netbeans.api.visual.action.RectangularSelectProvider;
-import org.netbeans.api.visual.action.WidgetAction;
+import org.netbeans.api.visual.action.*;
 import org.netbeans.api.visual.animator.SceneAnimator;
 import org.netbeans.api.visual.layout.LayoutFactory;
-import org.netbeans.api.visual.model.ObjectScene;
-import org.netbeans.api.visual.model.ObjectSceneEvent;
-import org.netbeans.api.visual.model.ObjectSceneEventType;
-import org.netbeans.api.visual.model.ObjectSceneListener;
-import org.netbeans.api.visual.model.ObjectState;
+import org.netbeans.api.visual.model.*;
 import org.netbeans.api.visual.widget.LayerWidget;
 import org.netbeans.api.visual.widget.Widget;
 import org.openide.awt.UndoRedo;
@@ -150,12 +105,14 @@
     
     private PopupMenuProvider popupMenuProvider = new PopupMenuProvider() {
 
+        @Override
         public JPopupMenu getPopupMenu(Widget widget, Point localLocation) {
             return DiagramScene.this.createPopupMenu();
         }
     };
     private RectangularSelectDecorator rectangularSelectDecorator = new RectangularSelectDecorator() {
 
+        @Override
         public Widget createSelectionWidget() {
             Widget widget = new Widget(DiagramScene.this);
             widget.setBorder(BorderFactory.createLineBorder(Color.black, 2));
@@ -185,6 +142,7 @@
         return false;
     }
 
+    @Override
     public void zoomOut() {
         double zoom = getZoomFactor();
         Point viewPosition = getScrollPane().getViewport().getViewPosition();
@@ -196,6 +154,7 @@
         }
     }
 
+    @Override
     public void zoomIn() {
 
         double zoom = getZoomFactor();
@@ -209,6 +168,7 @@
     }
 
 
+    @Override
     public void centerFigures(List<Figure> list) {
 
         boolean b = getUndoRedoEnabled();
@@ -218,7 +178,7 @@
     }
 
     private Set<Object> getObjectsFromIdSet(Set<Object> set) {
-        Set<Object> selectedObjects = new HashSet<Object>();
+        Set<Object> selectedObjects = new HashSet<>();
         for (Figure f : getModel().getDiagramToView().getFigures()) {
             if (intersects(f.getSource().getSourceNodesAsSet(), set)) {
                 selectedObjects.add(f);
@@ -234,6 +194,7 @@
     }
     private ControllableChangedListener<SelectionCoordinator> highlightedCoordinatorListener = new ControllableChangedListener<SelectionCoordinator>() {
 
+        @Override
         public void filteredChanged(SelectionCoordinator source) {
             DiagramScene.this.setHighlightedObjects(getObjectsFromIdSet(source.getHighlightedObjects()));
             DiagramScene.this.validate();
@@ -241,6 +202,7 @@
     };
     private ControllableChangedListener<SelectionCoordinator> selectedCoordinatorListener = new ControllableChangedListener<SelectionCoordinator>() {
 
+        @Override
         public void filteredChanged(SelectionCoordinator source) {
             DiagramScene.this.gotoSelection(source.getSelectedObjects());
             DiagramScene.this.validate();
@@ -249,6 +211,7 @@
 
     private RectangularSelectProvider rectangularSelectProvider = new RectangularSelectProvider() {
 
+        @Override
         public void performSelection(Rectangle rectangle) {
             if (rectangle.width < 0) {
                 rectangle.x += rectangle.width;
@@ -260,7 +223,7 @@
                 rectangle.height *= -1;
             }
 
-            Set<Object> selectedObjects = new HashSet<Object>();
+            Set<Object> selectedObjects = new HashSet<>();
             for (Figure f : getModel().getDiagramToView().getFigures()) {
                 FigureWidget w = getWidget(f);
                 if (w != null) {
@@ -291,6 +254,7 @@
 
     private MouseWheelListener mouseWheelListener = new MouseWheelListener() {
 
+        @Override
         public void mouseWheelMoved(MouseWheelEvent e) {
             if (e.isControlDown()) {
                 DiagramScene.this.relayoutWithoutLayout(null);
@@ -323,15 +287,19 @@
     }
     private ObjectSceneListener selectionChangedListener = new ObjectSceneListener() {
 
+        @Override
         public void objectAdded(ObjectSceneEvent arg0, Object arg1) {
         }
 
+        @Override
         public void objectRemoved(ObjectSceneEvent arg0, Object arg1) {
         }
 
+        @Override
         public void objectStateChanged(ObjectSceneEvent e, Object o, ObjectState oldState, ObjectState newState) {
         }
 
+        @Override
         public void selectionChanged(ObjectSceneEvent e, Set<Object> oldSet, Set<Object> newSet) {
             DiagramScene scene = (DiagramScene) e.getObjectScene();
             if (scene.isRebuilding()) {
@@ -340,7 +308,7 @@
 
             content.set(newSet, null);
 
-            Set<Integer> nodeSelection = new HashSet<Integer>();
+            Set<Integer> nodeSelection = new HashSet<>();
             for (Object o : newSet) {
                 if (o instanceof Properties.Provider) {
                     final Properties.Provider provider = (Properties.Provider) o;
@@ -373,8 +341,9 @@
 
         }
 
+        @Override
         public void highlightingChanged(ObjectSceneEvent e, Set<Object> oldSet, Set<Object> newSet) {
-            Set<Integer> nodeHighlighting = new HashSet<Integer>();
+            Set<Integer> nodeHighlighting = new HashSet<>();
             for (Object o : newSet) {
                 if (o instanceof Figure) {
                     nodeHighlighting.addAll(((Figure) o).getSource().getSourceNodesAsSet());
@@ -388,8 +357,9 @@
             highlightedCoordinatorListener.setEnabled(true);
         }
 
+        @Override
         public void hoverChanged(ObjectSceneEvent e, Object oldObject, Object newObject) {
-            Set<Object> newHighlightedObjects = new HashSet<Object>(DiagramScene.this.getHighlightedObjects());
+            Set<Object> newHighlightedObjects = new HashSet<>(DiagramScene.this.getHighlightedObjects());
             if (oldObject != null) {
                 newHighlightedObjects.remove(oldObject);
             }
@@ -399,6 +369,7 @@
             DiagramScene.this.setHighlightedObjects(newHighlightedObjects);
         }
 
+        @Override
         public void focusChanged(ObjectSceneEvent arg0, Object arg1, Object arg2) {
         }
     };
@@ -474,6 +445,7 @@
         return scrollPane;
     }
 
+    @Override
     public Component getComponent() {
         return scrollPane;
     }
@@ -486,6 +458,7 @@
         final DiagramScene diagramScene = this;
         Action a = new AbstractAction() {
 
+            @Override
             public void actionPerformed(ActionEvent e) {
                 diagramScene.gotoFigure(f);
             }
@@ -497,13 +470,7 @@
 
         name += " (";
 
-        if (f.getCluster() != null) {
-            name += "B" + f.getCluster().toString();
-        }
         if (!this.getWidget(f, FigureWidget.class).isVisible()) {
-            if (f.getCluster() != null) {
-                name += ", ";
-            }
             name += "hidden";
         }
         name += ")";
@@ -529,21 +496,13 @@
         
         rebuilding = true;
 
-        Collection<Object> objects = new ArrayList<Object>(this.getObjects());
+        Collection<Object> objects = new ArrayList<>(this.getObjects());
         for (Object o : objects) {
             this.removeObject(o);
         }
 
         Diagram d = getModel().getDiagramToView();
 
-        if (d.getGraph().getBlocks().isEmpty()) {
-            Scheduler s = Lookup.getDefault().lookup(Scheduler.class);
-            d.getGraph().clearBlocks();
-            s.schedule(d.getGraph());
-            d.getGraph().ensureNodesInBlocks();
-            d.updateBlocks();
-        }
-
         for (Figure f : d.getFigures()) {
             FigureWidget w = new FigureWidget(f, hoverAction, selectAction, this, mainLayer);
             w.getActions().addAction(ActionFactory.createPopupMenuAction(w));
@@ -569,15 +528,6 @@
                 sw.getActions().addAction(selectAction);
             }
         }
-
-        if (getModel().getShowBlocks()) {
-            for (InputBlock bn : d.getGraph().getBlocks()) {
-                BlockWidget w = new BlockWidget(this, d, bn);
-                w.setVisible(false);
-                this.addObject(bn, w);
-                blockLayer.addChild(w);
-            }
-        }
         
         rebuilding = false;
         this.smallUpdate(true);
@@ -613,7 +563,7 @@
 
         Diagram diagram = getModel().getDiagramToView();
 
-        HashSet<Figure> figures = new HashSet<Figure>();
+        HashSet<Figure> figures = new HashSet<>();
 
         for (Figure f : diagram.getFigures()) {
             FigureWidget w = getWidget(f);
@@ -622,7 +572,7 @@
             }
         }
 
-        HashSet<Connection> edges = new HashSet<Connection>();
+        HashSet<Connection> edges = new HashSet<>();
 
         for (Connection c : diagram.getConnections()) {
             if (isVisible(c)) {
@@ -630,24 +580,12 @@
             }
         }
 
-        if (getModel().getShowBlocks()) {
-            HierarchicalClusterLayoutManager m = new HierarchicalClusterLayoutManager(OldHierarchicalLayoutManager.Combine.SAME_OUTPUTS);
-            HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS);
-            manager.setMaxLayerLength(9);
-            manager.setMinLayerDifference(3);
-            m.setManager(manager);
-            m.setSubManager(new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS));
-            m.doLayout(new LayoutGraph(edges, figures));
-
-        } else {
-            HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS);
-            manager.setMaxLayerLength(10);
-            manager.doLayout(new LayoutGraph(edges, figures));
-        }
-
+        HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS);
+        manager.setMaxLayerLength(10);
+        manager.doLayout(new LayoutGraph(edges, figures));
         relayoutWithoutLayout(oldVisibleWidgets);
     }
-    private Set<Pair<Point, Point>> lineCache = new HashSet<Pair<Point, Point>>();
+    private Set<Pair<Point, Point>> lineCache = new HashSet<>();
 
     private void relayoutWithoutLayout(Set<Widget> oldVisibleWidgets) {
 
@@ -681,17 +619,6 @@
             }
         }
 
-        if (getModel().getShowBlocks()) {
-            for (Block b : diagram.getBlocks()) {
-                BlockWidget w = getWidget(b.getInputBlock());
-                if (w != null && w.isVisible()) {
-                    Rectangle r = b.getBounds();
-                    maxX = Math.max(maxX, r.x + r.width);
-                    maxY = Math.max(maxY, r.y + r.height);
-                }
-            }
-        }
-
         bottomRight.setPreferredLocation(new Point(maxX + BORDER_SIZE, maxY + BORDER_SIZE));
         int offx = 0;
         int offy = 0;
@@ -723,7 +650,7 @@
 
 
         Set<Pair<Point, Point>> lastLineCache = lineCache;
-        lineCache = new HashSet<Pair<Point, Point>>();
+        lineCache = new HashSet<>();
         for (Figure f : diagram.getFigures()) {
             for (OutputSlot s : f.getOutputSlots()) {
                 SceneAnimator anim = animator;
@@ -748,29 +675,12 @@
             }
         }
 
-        if (getModel().getShowBlocks()) {
-            for (Block b : diagram.getBlocks()) {
-                BlockWidget w = getWidget(b.getInputBlock());
-                if (w != null && w.isVisible()) {
-                    Point location = new Point(b.getBounds().x + offx2, b.getBounds().y + offy2);
-                    Rectangle r = new Rectangle(location.x, location.y, b.getBounds().width, b.getBounds().height);
-                    
-                    if ((visibleFigureCount <= ANIMATION_LIMIT && oldVisibleWidgets != null && oldVisibleWidgets.contains(w))) {
-                        animator.animatePreferredBounds(w, r);
-                    } else {
-                        w.setPreferredBounds(r);
-                        animator.animatePreferredBounds(w, r);
-                    }
-                }
-            }
-        }
-
         this.validate();
     }
     private final Point specialNullPoint = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
 
     private void processOutputSlot(Set<Pair<Point, Point>> lastLineCache, OutputSlot s, List<Connection> connections, int controlPointIndex, Point lastPoint, LineWidget predecessor, int offx, int offy, SceneAnimator animator) {
-        Map<Point, List<Connection>> pointMap = new HashMap<Point, List<Connection>>(connections.size());
+        Map<Point, List<Connection>> pointMap = new HashMap<>(connections.size());
 
         for (Connection c : connections) {
 
@@ -795,7 +705,7 @@
             if (pointMap.containsKey(cur)) {
                 pointMap.get(cur).add(c);
             } else {
-                List<Connection> newList = new ArrayList<Connection>(2);
+                List<Connection> newList = new ArrayList<>(2);
                 newList.add(c);
                 pointMap.put(cur, newList);
             }
@@ -826,7 +736,7 @@
                 Point p1 = new Point(lastPoint.x + offx, lastPoint.y + offy);
                 Point p2 = new Point(p.x + offx, p.y + offy);
 
-                Pair<Point, Point> curPair = new Pair<Point, Point>(p1, p2);
+                Pair<Point, Point> curPair = new Pair<>(p1, p2);
                 SceneAnimator curAnimator = animator;
                 if (lastLineCache.contains(curPair)) {
                     curAnimator = null;
@@ -844,6 +754,7 @@
         }
     }
 
+    @Override
     public void setInteractionMode(InteractionMode mode) {
         panAction.setEnabled(mode == InteractionMode.PANNING);
         // When panAction is not enabled, it does not consume the event
@@ -855,7 +766,7 @@
         private Set<Connection> connections;
 
         public ConnectionSet(Collection<Connection> connections) {
-            connections = new HashSet<Connection>(connections);
+            connections = new HashSet<>(connections);
         }
 
         public Set<Connection> getConnectionSet() {
@@ -868,6 +779,7 @@
         return lookup;
     }
 
+    @Override
     public void initialize() {
         Figure f = getModel().getDiagramToView().getRootFigure();
         if (f != null) {
@@ -902,7 +814,7 @@
 
     private Set<Object> idSetToObjectSet(Set<Object> ids) {
 
-        Set<Object> result = new HashSet<Object>();
+        Set<Object> result = new HashSet<>();
         for (Figure f : getModel().getDiagramToView().getFigures()) {
             if (DiagramScene.doesIntersect(f.getSource().getSourceNodesAsSet(), ids)) {
                 result.add(f);
@@ -920,7 +832,7 @@
     public void gotoSelection(Set<Object> ids) {
 
         Rectangle overall = null;
-        Set<Integer> hiddenNodes = new HashSet<Integer>(this.getModel().getHiddenNodes());
+        Set<Integer> hiddenNodes = new HashSet<>(this.getModel().getHiddenNodes());
         hiddenNodes.removeAll(ids);
         this.getModel().showNot(hiddenNodes);
 
@@ -988,8 +900,9 @@
         }
     }
 
+    @Override
     public void setSelection(Collection<Figure> list) {
-        super.setSelectedObjects(new HashSet<Figure>(list));
+        super.setSelectedObjects(new HashSet<>(list));
     }
 
     private UndoRedo.Manager getUndoRedoManager() {
@@ -1001,6 +914,7 @@
         return undoRedoManager;
     }
 
+    @Override
     public UndoRedo getUndoRedo() {
         return getUndoRedoManager();
     }
@@ -1014,9 +928,9 @@
         return true;
     }
 
-    public static boolean doesIntersect(Set s1, Set s2) {
+    public static boolean doesIntersect(Set<?> s1, Set<?> s2) {
         if (s1.size() > s2.size()) {
-            Set tmp = s1;
+            Set<?> tmp = s1;
             s1 = s2;
             s2 = tmp;
         }
@@ -1030,11 +944,13 @@
         return false;
     }
 
+    @Override
     public void componentHidden() {
         SelectionCoordinator.getInstance().getHighlightedChangedEvent().removeListener(highlightedCoordinatorListener);
         SelectionCoordinator.getInstance().getSelectedChangedEvent().removeListener(selectedCoordinatorListener);
     }
 
+    @Override
     public void componentShowing() {
         SelectionCoordinator.getInstance().getHighlightedChangedEvent().addListener(highlightedCoordinatorListener);
         SelectionCoordinator.getInstance().getSelectedChangedEvent().addListener(selectedCoordinatorListener);
@@ -1043,12 +959,11 @@
     private void updateHiddenNodes(Set<Integer> newHiddenNodes, boolean doRelayout) {
 
         System.out.println("newHiddenNodes: " + newHiddenNodes);
-        Set<InputBlock> visibleBlocks = new HashSet<InputBlock>();
 
         Diagram diagram = getModel().getDiagramToView();
         assert diagram != null;
 
-        Set<Widget> oldVisibleWidgets = new HashSet<Widget>();
+        Set<Widget> oldVisibleWidgets = new HashSet<>();
 
         for (Figure f : diagram.getFigures()) {
             FigureWidget w = getWidget(f);
@@ -1057,15 +972,6 @@
             }
         }
 
-        if (getModel().getShowBlocks()) {
-            for (InputBlock b : diagram.getGraph().getBlocks()) {
-                BlockWidget w = getWidget(b);
-                if (w.isVisible()) {
-                    oldVisibleWidgets.add(w);
-                }
-            }
-        }
-
         for (Figure f : diagram.getFigures()) {
             boolean hiddenAfter = doesIntersect(f.getSource().getSourceNodesAsSet(), newHiddenNodes);
 
@@ -1074,9 +980,6 @@
             if (!hiddenAfter) {
                 // Figure is shown
                 w.setVisible(true);
-                for (InputNode n : f.getSource().getSourceNodes()) {
-                    visibleBlocks.add(diagram.getGraph().getBlock(n));
-                }
             } else {
                 // Figure is hidden
                 w.setVisible(false);
@@ -1084,11 +987,11 @@
         }
 
         if (getModel().getShowNodeHull()) {
-            List<FigureWidget> boundaries = new ArrayList<FigureWidget>();
+            List<FigureWidget> boundaries = new ArrayList<>();
             for (Figure f : diagram.getFigures()) {
                 FigureWidget w = getWidget(f);
                 if (!w.isVisible()) {
-                    Set<Figure> set = new HashSet<Figure>(f.getPredecessorSet());
+                    Set<Figure> set = new HashSet<>(f.getPredecessorSet());
                     set.addAll(f.getSuccessorSet());
 
                     boolean b = false;
@@ -1102,9 +1005,6 @@
 
                     if (b) {
                         w.setBoundary(true);
-                        for (InputNode n : f.getSource().getSourceNodes()) {
-                            visibleBlocks.add(diagram.getGraph().getBlock(n));
-                        }
                         boundaries.add(w);
                     }
                 }
@@ -1117,22 +1017,6 @@
             }
         }
 
-        if (getModel().getShowBlocks()) {
-            for (InputBlock b : diagram.getGraph().getBlocks()) {
-
-                boolean visibleAfter = visibleBlocks.contains(b);
-
-                BlockWidget w = getWidget(b);
-                if (visibleAfter) {
-                    // Block must be shown
-                    w.setVisible(true);
-                } else {
-                    // Block must be hidden
-                    w.setVisible(false);
-                }
-            }
-        }
-
         if (doRelayout) {
             relayout(oldVisibleWidgets);
         }
@@ -1141,7 +1025,7 @@
     }
 
     private void showFigure(Figure f) {
-        HashSet<Integer> newHiddenNodes = new HashSet<Integer>(getModel().getHiddenNodes());
+        HashSet<Integer> newHiddenNodes = new HashSet<>(getModel().getHiddenNodes());
         newHiddenNodes.removeAll(f.getSource().getSourceNodesAsSet());
         updateHiddenNodes(newHiddenNodes, true);
     }
@@ -1151,7 +1035,7 @@
     }
 
     public void setSelectedObjects(Object... args) {
-        Set<Object> set = new HashSet<Object>();
+        Set<Object> set = new HashSet<>();
         for (Object o : args) {
             set.add(o);
         }
@@ -1226,6 +1110,7 @@
 
             SwingUtilities.invokeLater(new Runnable() {
 
+                @Override
                 public void run() {
                     scene.setScrollPosition(oldScrollPosition);
                 }
@@ -1234,6 +1119,7 @@
             scene.setUndoRedoEnabled(b);
         }
 
+        @Override
         public void changed(DiagramViewModel source) {
             scene.getModel().getViewChangedEvent().removeListener(this);
             if (oldModel.getHiddenNodes().equals(newModel.getHiddenNodes())) {
@@ -1254,6 +1140,7 @@
     }
 
     private final ChangedListener<DiagramViewModel> fullChange = new ChangedListener<DiagramViewModel>() {
+        @Override
         public void changed(DiagramViewModel source) {
             assert source == model : "Receive only changed event from current model!";
             assert source != null;
@@ -1262,6 +1149,7 @@
     };
 
     private final ChangedListener<DiagramViewModel> hiddenNodesChange = new ChangedListener<DiagramViewModel>() {
+        @Override
         public void changed(DiagramViewModel source) {
             assert source == model : "Receive only changed event from current model!";
             assert source != null;
@@ -1270,6 +1158,7 @@
     };
 
     private final ChangedListener<DiagramViewModel> selectionChange = new ChangedListener<DiagramViewModel>() {
+        @Override
         public void changed(DiagramViewModel source) {
             assert source == model : "Receive only changed event from current model!";
             assert source != null;
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,24 +24,16 @@
  */
 package com.sun.hotspot.igv.view;
 
-import com.sun.hotspot.igv.data.Group;
-import com.sun.hotspot.igv.data.InputGraph;
-import com.sun.hotspot.igv.data.InputNode;
+import com.sun.hotspot.igv.data.*;
 import com.sun.hotspot.igv.difference.Difference;
+import com.sun.hotspot.igv.filter.CustomFilter;
 import com.sun.hotspot.igv.filter.FilterChain;
 import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.data.ChangedEvent;
-import com.sun.hotspot.igv.util.RangeSliderModel;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import com.sun.hotspot.igv.data.ChangedListener;
-import com.sun.hotspot.igv.filter.CustomFilter;
 import com.sun.hotspot.igv.graph.Figure;
 import com.sun.hotspot.igv.settings.Settings;
+import com.sun.hotspot.igv.util.RangeSliderModel;
 import java.awt.Color;
-import java.util.Collection;
+import java.util.*;
 
 /**
  *
@@ -63,10 +55,10 @@
     private ChangedEvent<DiagramViewModel> viewChangedEvent;
     private ChangedEvent<DiagramViewModel> hiddenNodesChangedEvent;
     private ChangedEvent<DiagramViewModel> viewPropertiesChangedEvent;
-    private boolean showBlocks;
     private boolean showNodeHull;
     private ChangedListener<FilterChain> filterChainChangedListener = new ChangedListener<FilterChain>() {
 
+        @Override
         public void changed(FilterChain source) {
             diagramChanged();
         }
@@ -99,8 +91,6 @@
         this.onScreenNodes = newModel.onScreenNodes;
         viewChanged |= (selectedNodes != newModel.selectedNodes);
         this.selectedNodes = newModel.selectedNodes;
-        viewPropertiesChanged |= (showBlocks != newModel.showBlocks);
-        this.showBlocks = newModel.showBlocks;
         viewPropertiesChanged |= (showNodeHull != newModel.showNodeHull);
         this.showNodeHull = newModel.showNodeHull;
 
@@ -119,15 +109,6 @@
         }
     }
 
-    public boolean getShowBlocks() {
-        return showBlocks;
-    }
-
-    public void setShowBlocks(boolean b) {
-        showBlocks = b;
-        viewPropertiesChangedEvent.fire();
-    }
-
     public boolean getShowNodeHull() {
         return showNodeHull;
     }
@@ -141,22 +122,21 @@
         super(calculateStringList(g));
 
         this.showNodeHull = true;
-        this.showBlocks = true;
         this.group = g;
         assert filterChain != null;
         this.filterChain = filterChain;
         assert sequenceFilterChain != null;
         this.sequenceFilterChain = sequenceFilterChain;
-        hiddenNodes = new HashSet<Integer>();
-        onScreenNodes = new HashSet<Integer>();
-        selectedNodes = new HashSet<Integer>();
+        hiddenNodes = new HashSet<>();
+        onScreenNodes = new HashSet<>();
+        selectedNodes = new HashSet<>();
         super.getChangedEvent().addListener(this);
-        diagramChangedEvent = new ChangedEvent<DiagramViewModel>(this);
-        viewChangedEvent = new ChangedEvent<DiagramViewModel>(this);
-        hiddenNodesChangedEvent = new ChangedEvent<DiagramViewModel>(this);
-        viewPropertiesChangedEvent = new ChangedEvent<DiagramViewModel>(this);
+        diagramChangedEvent = new ChangedEvent<>(this);
+        viewChangedEvent = new ChangedEvent<>(this);
+        hiddenNodesChangedEvent = new ChangedEvent<>(this);
+        viewPropertiesChangedEvent = new ChangedEvent<>(this);
 
-        groupChangedEvent = new ChangedEvent<DiagramViewModel>(this);
+        groupChangedEvent = new ChangedEvent<>(this);
         groupChangedEvent.addListener(groupChangedListener);
         groupChangedEvent.fire();
 
@@ -167,6 +147,7 @@
 
         private Group oldGroup;
 
+        @Override
         public void changed(DiagramViewModel source) {
             if (oldGroup != null) {
                 oldGroup.getChangedEvent().removeListener(groupContentChangedListener);
@@ -177,6 +158,7 @@
     };
     private final ChangedListener<Group> groupContentChangedListener = new ChangedListener<Group>() {
 
+        @Override
         public void changed(Group source) {
             assert source == group;
             setPositions(calculateStringList(source));
@@ -214,7 +196,7 @@
 
     public void setSelectedNodes(Set<Integer> nodes) {
         this.selectedNodes = nodes;
-        List<Color> colors = new ArrayList<Color>();
+        List<Color> colors = new ArrayList<>();
         for (String s : getPositions()) {
             colors.add(Color.black);
         }
@@ -259,7 +241,7 @@
     }
 
     public void showFigures(Collection<Figure> f) {
-        HashSet<Integer> newHiddenNodes = new HashSet<Integer>(getHiddenNodes());
+        HashSet<Integer> newHiddenNodes = new HashSet<>(getHiddenNodes());
         for (Figure fig : f) {
             newHiddenNodes.removeAll(fig.getSource().getSourceNodesAsSet());
         }
@@ -268,7 +250,7 @@
 
 
     public Set<Figure> getSelectedFigures() {
-        Set<Figure> result = new HashSet<Figure>();
+        Set<Figure> result = new HashSet<>();
         for (Figure f : diagram.getFigures()) {
             for (InputNode node : f.getSource().getSourceNodes()) {
                 if (getSelectedNodes().contains(node.getId())) {
@@ -284,7 +266,7 @@
     }
 
     public void showOnly(final Set<Integer> nodes) {
-        final HashSet<Integer> allNodes = new HashSet<Integer>(getGraphToView().getGroup().getAllNodes());
+        final HashSet<Integer> allNodes = new HashSet<>(getGraphToView().getGroup().getAllNodes());
         allNodes.removeAll(nodes);
         setHiddenNodes(allNodes);
     }
@@ -331,7 +313,7 @@
     }
 
     private static List<String> calculateStringList(Group g) {
-        List<String> result = new ArrayList<String>();
+        List<String> result = new ArrayList<>();
         for (InputGraph graph : g.getGraphs()) {
             result.add(graph.getName());
         }
@@ -365,14 +347,14 @@
         if (diagram == null) {
             diagram = Diagram.createDiagram(getGraphToView(), Settings.get().get(Settings.NODE_TEXT, Settings.NODE_TEXT_DEFAULT));
             getFilterChain().apply(diagram, getSequenceFilterChain());
-            if (diagram.getGraph().getSourceGraphs() != null) {
+            if (getFirstPosition() != getSecondPosition()) {
                 CustomFilter f = new CustomFilter(
-                        "difference", "colorize('state', 'same', white);" +
-                        "colorize('state', 'changed', orange);" +
-                        "colorize('state', 'new', green);" +
-                        "colorize('state', 'deleted', red);");
+                        "difference", "colorize('state', 'same', white);"
+                        + "colorize('state', 'changed', orange);"
+                        + "colorize('state', 'new', green);"
+                        + "colorize('state', 'deleted', red);");
                 f.apply(diagram);
-            }
+           }
         }
 
         return diagram;
@@ -390,13 +372,14 @@
         return inputGraph;
     }
 
+    @Override
     public void changed(RangeSliderModel source) {
         inputGraph = null;
         diagramChanged();
     }
 
     void setSelectedFigures(List<Figure> list) {
-        Set<Integer> newSelectedNodes = new HashSet<Integer>();
+        Set<Integer> newSelectedNodes = new HashSet<>();
         for (Figure f : list) {
             newSelectedNodes.addAll(f.getSource().getSourceNodesAsSet());
         }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorInputGraphProvider.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorInputGraphProvider.java	Thu Feb 02 16:07:52 2012 -0800
@@ -25,8 +25,8 @@
 package com.sun.hotspot.igv.view;
 
 import com.sun.hotspot.igv.data.InputGraph;
+import com.sun.hotspot.igv.data.InputNode;
 import com.sun.hotspot.igv.data.services.InputGraphProvider;
-import com.sun.hotspot.igv.data.InputNode;
 import java.util.Set;
 
 /**
@@ -41,10 +41,12 @@
         this.editor = editor;
     }
     
+    @Override
     public InputGraph getGraph() {
         return editor.getDiagramModel().getGraphToView();
     }
 
+    @Override
     public void setSelectedNodes(Set<InputNode> nodes) {
         editor.setSelectedNodes(nodes);
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorTopComponent.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorTopComponent.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,66 +24,34 @@
 package com.sun.hotspot.igv.view;
 
 import com.sun.hotspot.igv.data.ChangedEvent;
+import com.sun.hotspot.igv.data.ChangedListener;
 import com.sun.hotspot.igv.data.InputNode;
-import com.sun.hotspot.igv.filter.FilterChain;
-import com.sun.hotspot.igv.graph.Diagram;
-import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.view.actions.EnableBlockLayoutAction;
-import com.sun.hotspot.igv.view.actions.ExpandPredecessorsAction;
-import com.sun.hotspot.igv.view.actions.ExpandSuccessorsAction;
-import com.sun.hotspot.igv.view.actions.ExtractAction;
-import com.sun.hotspot.igv.view.actions.HideAction;
-import com.sun.hotspot.igv.view.actions.NextDiagramAction;
-import com.sun.hotspot.igv.view.actions.OverviewAction;
-import com.sun.hotspot.igv.view.actions.PredSuccAction;
-import com.sun.hotspot.igv.view.actions.PrevDiagramAction;
-import com.sun.hotspot.igv.view.actions.ShowAllAction;
-import com.sun.hotspot.igv.view.actions.ZoomInAction;
-import com.sun.hotspot.igv.view.actions.ZoomOutAction;
-import com.sun.hotspot.igv.data.ChangedListener;
 import com.sun.hotspot.igv.data.Properties;
 import com.sun.hotspot.igv.data.Properties.PropertyMatcher;
 import com.sun.hotspot.igv.data.services.InputGraphProvider;
+import com.sun.hotspot.igv.filter.FilterChain;
 import com.sun.hotspot.igv.filter.FilterChainProvider;
+import com.sun.hotspot.igv.graph.Diagram;
+import com.sun.hotspot.igv.graph.Figure;
 import com.sun.hotspot.igv.graph.services.DiagramProvider;
-import com.sun.hotspot.igv.util.RangeSlider;
 import com.sun.hotspot.igv.svg.BatikSVG;
 import com.sun.hotspot.igv.util.LookupHistory;
-import com.sun.hotspot.igv.view.actions.PanModeAction;
-import com.sun.hotspot.igv.view.actions.SelectionModeAction;
-import java.awt.BorderLayout;
-import java.awt.CardLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Graphics2D;
+import com.sun.hotspot.igv.util.RangeSlider;
+import com.sun.hotspot.igv.view.actions.*;
+import java.awt.*;
 import java.awt.event.HierarchyBoundsListener;
 import java.awt.event.HierarchyEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.KeyListener;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
+import java.io.*;
 import java.util.List;
-import java.util.Set;
-import javax.swing.Action;
-import javax.swing.Box;
-import javax.swing.ButtonGroup;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JToggleButton;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
+import java.util.*;
+import javax.swing.*;
 import javax.swing.border.Border;
 import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
 import org.openide.actions.RedoAction;
 import org.openide.actions.UndoAction;
 import org.openide.awt.Toolbar;
@@ -91,15 +59,14 @@
 import org.openide.awt.UndoRedo;
 import org.openide.util.Lookup;
 import org.openide.util.NbBundle;
+import org.openide.util.Utilities;
+import org.openide.util.actions.Presenter;
 import org.openide.util.lookup.AbstractLookup;
 import org.openide.util.lookup.InstanceContent;
 import org.openide.util.lookup.ProxyLookup;
 import org.openide.windows.Mode;
 import org.openide.windows.TopComponent;
 import org.openide.windows.WindowManager;
-import org.openide.NotifyDescriptor;
-import org.openide.util.Utilities;
-import org.openide.util.actions.Presenter;
 
 /**
  * 
@@ -110,7 +77,6 @@
     private DiagramViewer scene;
     private InstanceContent content;
     private InstanceContent graphContent;
-    private EnableBlockLayoutAction blockLayoutAction;
     private OverviewAction overviewAction;
     private PredSuccAction predSuccAction;
     private SelectionModeAction selectionModeAction;
@@ -127,6 +93,7 @@
     private DiagramViewModel rangeSliderModel;
     private ExportCookie exportCookie = new ExportCookie() {
 
+        @Override
         public void export(File f) {
 
             Graphics2D svgGenerator = BatikSVG.createGraphicsObject();
@@ -161,16 +128,18 @@
 
     private DiagramProvider diagramProvider = new DiagramProvider() {
 
+        @Override
         public Diagram getDiagram() {
             return getModel().getDiagramToView();
         }
 
+        @Override
         public ChangedEvent<DiagramProvider> getChangedEvent() {
             return diagramChangedEvent;
         }
     };
 
-    private ChangedEvent<DiagramProvider> diagramChangedEvent = new ChangedEvent<DiagramProvider>(diagramProvider);
+    private ChangedEvent<DiagramProvider> diagramChangedEvent = new ChangedEvent<>(diagramProvider);
     
 
     private void updateDisplayName() {
@@ -249,12 +218,6 @@
         toolBar.add(ShowAllAction.get(ZoomInAction.class));
         toolBar.add(ShowAllAction.get(ZoomOutAction.class));
 
-        blockLayoutAction = new EnableBlockLayoutAction();
-        JToggleButton button = new JToggleButton(blockLayoutAction);
-        button.setSelected(true);
-        toolBar.add(button);
-        blockLayoutAction.addPropertyChangeListener(this);
-
         overviewAction = new OverviewAction();
         overviewButton = new JToggleButton(overviewAction);
         overviewButton.setSelected(false);
@@ -262,7 +225,7 @@
         overviewAction.addPropertyChangeListener(this);
 
         predSuccAction = new PredSuccAction();
-        button = new JToggleButton(predSuccAction);
+        JToggleButton button = new JToggleButton(predSuccAction);
         button.setSelected(true);
         toolBar.add(button);
         predSuccAction.addPropertyChangeListener(this);
@@ -309,14 +272,17 @@
 
         scene.getComponent().addHierarchyBoundsListener(new HierarchyBoundsListener() {
 
+            @Override
             public void ancestorMoved(HierarchyEvent e) {
             }
 
+            @Override
             public void ancestorResized(HierarchyEvent e) {
                 if (!notFirstTime && scene.getComponent().getBounds().width > 0) {
                     notFirstTime = true;
                     SwingUtilities.invokeLater(new Runnable() {
 
+                        @Override
                         public void run() {
                             EditorTopComponent.this.scene.initialize();
                         }
@@ -333,9 +299,11 @@
     }
     private KeyListener keyListener = new KeyListener() {
 
+        @Override
         public void keyTyped(KeyEvent e) {
         }
 
+        @Override
         public void keyPressed(KeyEvent e) {
             if (e.getKeyCode() == KeyEvent.VK_S) {
                 EditorTopComponent.this.overviewButton.setSelected(true);
@@ -343,6 +311,7 @@
             }
         }
 
+        @Override
         public void keyReleased(KeyEvent e) {
             if (e.getKeyCode() == KeyEvent.VK_S) {
                 EditorTopComponent.this.overviewButton.setSelected(false);
@@ -443,9 +412,10 @@
 
     private ChangedListener<DiagramViewModel> diagramChangedListener = new ChangedListener<DiagramViewModel>() {
 
+        @Override
         public void changed(DiagramViewModel source) {
             updateDisplayName();
-            Collection<Object> list = new ArrayList<Object>();
+            Collection<Object> list = new ArrayList<>();
             list.add(new EditorInputGraphProvider(EditorTopComponent.this));
             graphContent.set(list, null);
             diagramProvider.getChangedEvent().fire();
@@ -459,7 +429,7 @@
 
     public void setSelection(PropertyMatcher matcher) {
 
-        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<Figure>(getModel().getDiagramToView().getFigures());
+        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<>(getModel().getDiagramToView().getFigures());
         List<Figure> list = selector.selectMultiple(matcher);
         setSelectedFigures(list);
     }
@@ -471,8 +441,8 @@
 
     public void setSelectedNodes(Set<InputNode> nodes) {
 
-        List<Figure> list = new ArrayList<Figure>();
-        Set<Integer> ids = new HashSet<Integer>();
+        List<Figure> list = new ArrayList<>();
+        Set<Integer> ids = new HashSet<>();
         for (InputNode n : nodes) {
             ids.add(n.getId());
         }
@@ -489,6 +459,7 @@
         setSelectedFigures(list);
     }
 
+    @Override
     public void propertyChange(PropertyChangeEvent evt) {
         if (evt.getSource() == this.predSuccAction) {
             boolean b = (Boolean) predSuccAction.getValue(PredSuccAction.STATE);
@@ -500,9 +471,6 @@
             } else {
                 showScene();
             }
-        } else if (evt.getSource() == this.blockLayoutAction) {
-            boolean b = (Boolean) blockLayoutAction.getValue(EnableBlockLayoutAction.STATE);
-            this.getModel().setShowBlocks(b);
         } else if (evt.getSource() == this.selectionModeAction || evt.getSource() == this.panModeAction) {
             if (panModeAction.isSelected()) {
                 scene.setInteractionMode(DiagramViewer.InteractionMode.PANNING);
@@ -520,14 +488,14 @@
 
     public void hideNodes() {
         Set<Integer> selectedNodes = this.getModel().getSelectedNodes();
-        HashSet<Integer> nodes = new HashSet<Integer>(getModel().getHiddenNodes());
+        HashSet<Integer> nodes = new HashSet<>(getModel().getHiddenNodes());
         nodes.addAll(selectedNodes);
         this.getModel().showNot(nodes);
     }
 
     public void expandPredecessors() {
         Set<Figure> oldSelection = getModel().getSelectedFigures();
-        Set<Figure> figures = new HashSet<Figure>();
+        Set<Figure> figures = new HashSet<>();
 
         for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) {
             boolean ok = false;
@@ -552,7 +520,7 @@
 
     public void expandSuccessors() {
         Set<Figure> oldSelection = getModel().getSelectedFigures();
-        Set<Figure> figures = new HashSet<Figure>();
+        Set<Figure> figures = new HashSet<>();
 
         for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) {
             boolean ok = false;
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/ExtendedSatelliteComponent.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/ExtendedSatelliteComponent.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,11 +23,10 @@
  */
 package com.sun.hotspot.igv.view;
 
-import org.netbeans.api.visual.widget.Scene;
-
-import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
+import javax.swing.JComponent;
+import org.netbeans.api.visual.widget.Scene;
 
 /**
  * @author David Kaspar
@@ -48,6 +47,7 @@
         addMouseMotionListener(this);
     }
 
+    @Override
     public void addNotify() {
         super.addNotify();
         scene.addSceneListener(this);
@@ -59,6 +59,7 @@
         repaint();
     }
 
+    @Override
     public void removeNotify() {
         scene.getView().removeComponentListener(this);
         scene.removeSceneListener(this);
@@ -74,6 +75,7 @@
         }
     }
 
+    @Override
     public void paint(Graphics g) {
         Graphics2D gr = (Graphics2D) g;
         super.paint(g);
@@ -122,27 +124,34 @@
         }
     }
 
+    @Override
     public void mouseClicked(MouseEvent e) {
     }
 
+    @Override
     public void mousePressed(MouseEvent e) {
         moveVisibleRect(e.getPoint());
     }
 
+    @Override
     public void mouseReleased(MouseEvent e) {
         moveVisibleRect(e.getPoint());
     }
 
+    @Override
     public void mouseEntered(MouseEvent e) {
     }
 
+    @Override
     public void mouseExited(MouseEvent e) {
     }
 
+    @Override
     public void mouseDragged(MouseEvent e) {
         moveVisibleRect(e.getPoint());
     }
 
+    @Override
     public void mouseMoved(MouseEvent e) {
     }
 
@@ -175,27 +184,34 @@
         this.repaint();
     }
 
+    @Override
     public void sceneRepaint() {
     //repaint ();
     }
 
+    @Override
     public void sceneValidating() {
     }
 
+    @Override
     public void sceneValidated() {
     }
 
+    @Override
     public void componentResized(ComponentEvent e) {
         repaint();
     }
 
+    @Override
     public void componentMoved(ComponentEvent e) {
         repaint();
     }
 
+    @Override
     public void componentShown(ComponentEvent e) {
     }
 
+    @Override
     public void componentHidden(ComponentEvent e) {
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/GraphViewerImplementation.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/GraphViewerImplementation.java	Thu Feb 02 16:07:52 2012 -0800
@@ -34,6 +34,7 @@
  */
 public class GraphViewerImplementation implements GraphViewer {
 
+    @Override
     public void view(InputGraph graph) {
         Diagram diagram = Diagram.createDiagram(graph, Settings.get().get(Settings.NODE_TEXT, Settings.NODE_TEXT_DEFAULT));
         EditorTopComponent tc = new EditorTopComponent(diagram);
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/NodeQuickSearch.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/NodeQuickSearch.java	Thu Feb 02 16:07:52 2012 -0800
@@ -55,6 +55,7 @@
      * @param request Search request object that contains information what to search for
      * @param response Search response object that stores search results. Note that it's important to react to return value of SearchResponse.addResult(...) method and stop computation if false value is returned.
      */
+    @Override
     public void evaluate(SearchRequest request, SearchResponse response) {
         String query = request.getText();
         if (query.trim().isEmpty()) {
@@ -83,12 +84,13 @@
             List<InputNode> matches = null;
             try {
                 RegexpPropertyMatcher matcher = new RegexpPropertyMatcher(name, value, Pattern.CASE_INSENSITIVE);
-                Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<InputNode>(p.getGraph().getNodes());
+                Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<>(p.getGraph().getNodes());
 
                 matches = selector.selectMultiple(matcher);
             } catch (Exception e) {
                 final String msg = e.getMessage();
                 response.addResult(new Runnable() {
+                    @Override
                         public void run() {
                             Message desc = new NotifyDescriptor.Message("An exception occurred during the search, "
                                     + "perhaps due to a malformed query string:\n" + msg,
@@ -101,8 +103,9 @@
             }
 
             if (matches != null) {
-                final Set<InputNode> set = new HashSet<InputNode>(matches);
+                final Set<InputNode> set = new HashSet<>(matches);
                 response.addResult(new Runnable() {
+                    @Override
                         public void run() {
                             final EditorTopComponent comp = EditorTopComponent.getActive();
                             if (comp != null) {
@@ -117,10 +120,11 @@
                 // Single matches
                 for (final InputNode n : matches) {
                     response.addResult(new Runnable() {
+                        @Override
                             public void run() {
                                 final EditorTopComponent comp = EditorTopComponent.getActive();
                                 if (comp != null) {
-                                    final Set<InputNode> tmpSet = new HashSet<InputNode>();
+                                    final Set<InputNode> tmpSet = new HashSet<>();
                                     tmpSet.add(n);
                                     comp.setSelectedNodes(tmpSet);
                                     comp.requestActive();
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/CustomizablePanAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/CustomizablePanAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -74,6 +74,7 @@
         this.modifiersEx = modifiersEx;
     }
 
+    @Override
     protected boolean isLocked() {
         return scrollPane != null;
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/EnableBlockLayoutAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.view.actions;
-
-import java.awt.event.ActionEvent;
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.ImageIcon;
-import org.openide.util.ImageUtilities;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class EnableBlockLayoutAction extends AbstractAction {
-
-    private boolean state;
-    public static final String STATE = "state";
-
-    public EnableBlockLayoutAction() {
-        state = true;
-        putValue(AbstractAction.SMALL_ICON, new ImageIcon(ImageUtilities.loadImage(iconResource())));
-        putValue(STATE, true);
-        putValue(Action.SHORT_DESCRIPTION, "Cluster nodes into blocks");
-    }
-
-    public void actionPerformed(ActionEvent ev) {
-        this.state = !state;
-        this.putValue(STATE, state);
-    }
-
-    protected String iconResource() {
-        return "com/sun/hotspot/igv/view/images/blocks.gif";
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExpandPredecessorsAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExpandPredecessorsAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -33,6 +33,7 @@
  */
 public final class ExpandPredecessorsAction extends CallableSystemAction {
 
+    @Override
     public void performAction() {
         EditorTopComponent editor = EditorTopComponent.getActive();
         if (editor != null) {
@@ -40,6 +41,7 @@
         }
     }
 
+    @Override
     public String getName() {
         return "Expand Above";
     }
@@ -49,6 +51,7 @@
         super.initialize();
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExpandSuccessorsAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExpandSuccessorsAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -33,6 +33,7 @@
  */
 public final class ExpandSuccessorsAction extends CallableSystemAction {
 
+    @Override
     public void performAction() {
         EditorTopComponent editor = EditorTopComponent.getActive();
         if (editor != null) {
@@ -40,6 +41,7 @@
         }
     }
 
+    @Override
     public String getName() {
         return "Expand Below";
     }
@@ -49,6 +51,7 @@
         super.initialize();
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExportAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExportAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -32,12 +32,7 @@
 import javax.swing.JFileChooser;
 import javax.swing.KeyStroke;
 import javax.swing.filechooser.FileFilter;
-import org.openide.util.HelpCtx;
-import org.openide.util.Lookup;
-import org.openide.util.LookupEvent;
-import org.openide.util.LookupListener;
-import org.openide.util.NbBundle;
-import org.openide.util.Utilities;
+import org.openide.util.*;
 import org.openide.util.actions.CallableSystemAction;
 
 /**
@@ -53,24 +48,28 @@
         putValue(Action.SHORT_DESCRIPTION, "Export current graph as SVG file");
         putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK));
         lookup = Utilities.actionsGlobalContext();
-        result = lookup.lookup(new Lookup.Template<ExportCookie>(ExportCookie.class));
+        result = lookup.lookup(new Lookup.Template<>(ExportCookie.class));
         result.addLookupListener(this);
         resultChanged(null);
     }
 
+    @Override
     public void resultChanged(LookupEvent e) {
         super.setEnabled(result.allInstances().size() > 0);
     }
 
+    @Override
     public void performAction() {
 
         JFileChooser fc = new JFileChooser();
         fc.setFileFilter(new FileFilter() {
 
+            @Override
             public boolean accept(File f) {
                 return true;
             }
 
+            @Override
             public String getDescription() {
                 return "SVG files (*.svg)";
             }
@@ -97,6 +96,7 @@
         }
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(ExportAction.class, "CTL_ExportAction");
     }
@@ -106,6 +106,7 @@
         return "com/sun/hotspot/igv/view/images/export.png";
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExtractAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExtractAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -37,6 +37,7 @@
  */
 public final class ExtractAction extends CallableSystemAction {
 
+    @Override
     public void performAction() {
         EditorTopComponent editor = EditorTopComponent.getActive();
         if (editor != null) {
@@ -49,6 +50,7 @@
         putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK, false));
     }
 
+    @Override
     public String getName() {
         return "Extract action";
     }
@@ -58,6 +60,7 @@
         super.initialize();
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/HideAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/HideAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -37,6 +37,7 @@
  */
 public final class HideAction extends CallableSystemAction {
 
+    @Override
     public void performAction() {
         EditorTopComponent editor = EditorTopComponent.getActive();
         if (editor != null) {
@@ -49,6 +50,7 @@
         putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_H, Event.CTRL_MASK, false));
     }
 
+    @Override
     public String getName() {
         return "Hide";
     }
@@ -58,6 +60,7 @@
         super.initialize();
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/NextDiagramAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/NextDiagramAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,16 +23,12 @@
  */
 package com.sun.hotspot.igv.view.actions;
 
-import com.sun.hotspot.igv.view.DiagramViewModel;
 import com.sun.hotspot.igv.data.ChangedListener;
 import com.sun.hotspot.igv.util.ContextAction;
+import com.sun.hotspot.igv.view.DiagramViewModel;
 import javax.swing.Action;
 import javax.swing.ImageIcon;
-import org.openide.util.HelpCtx;
-import org.openide.util.ImageUtilities;
-import org.openide.util.Lookup;
-import org.openide.util.NbBundle;
-import org.openide.util.Utilities;
+import org.openide.util.*;
 
 /**
  *
@@ -51,10 +47,12 @@
         putValue(Action.SMALL_ICON, new ImageIcon(ImageUtilities.loadImage("com/sun/hotspot/igv/view/images/next_diagram.png")));
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(NextDiagramAction.class, "CTL_NextDiagramAction");
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
@@ -96,10 +94,12 @@
         return model.getSecondPosition() != model.getPositions().size() - 1;
     }
 
+    @Override
     public Action createContextAwareInstance(Lookup arg0) {
         return new NextDiagramAction(arg0);
     }
 
+    @Override
     public void changed(DiagramViewModel source) {
         update(source);
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/OverviewAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/OverviewAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -44,6 +44,7 @@
         setState(false);
     }
 
+    @Override
     public void actionPerformed(ActionEvent ev) {
         setState(!state);
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/PanModeAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/PanModeAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -53,6 +53,7 @@
         return "com/sun/hotspot/igv/view/images/pan_mode.png";
     }
 
+    @Override
     public void actionPerformed(ActionEvent e) {
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/PredSuccAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/PredSuccAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -45,6 +45,7 @@
         putValue(Action.SHORT_DESCRIPTION, "Show neighboring nodes of fully visible nodes semi-transparent");
     }
 
+    @Override
     public void actionPerformed(ActionEvent ev) {
         this.state = !state;
         this.putValue(STATE, state);
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/PrevDiagramAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/PrevDiagramAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -24,15 +24,11 @@
 package com.sun.hotspot.igv.view.actions;
 
 import com.sun.hotspot.igv.data.ChangedListener;
+import com.sun.hotspot.igv.util.ContextAction;
 import com.sun.hotspot.igv.view.DiagramViewModel;
-import com.sun.hotspot.igv.util.ContextAction;
 import javax.swing.Action;
 import javax.swing.ImageIcon;
-import org.openide.util.HelpCtx;
-import org.openide.util.ImageUtilities;
-import org.openide.util.Lookup;
-import org.openide.util.NbBundle;
-import org.openide.util.Utilities;
+import org.openide.util.*;
 
 /**
  *
@@ -51,10 +47,12 @@
         putValue(Action.SMALL_ICON, new ImageIcon(ImageUtilities.loadImage("com/sun/hotspot/igv/view/images/prev_diagram.png")));
     }
 
+    @Override
     public String getName() {
         return NbBundle.getMessage(PrevDiagramAction.class, "CTL_PrevDiagramAction");
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
@@ -96,10 +94,12 @@
         return model.getFirstPosition() != 0;
     }
 
+    @Override
     public Action createContextAwareInstance(Lookup arg0) {
         return new PrevDiagramAction(arg0);
     }
 
+    @Override
     public void changed(DiagramViewModel source) {
         update(source);
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/SelectionModeAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/SelectionModeAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -51,6 +51,7 @@
         return "com/sun/hotspot/igv/view/images/selection_mode.png";
     }
 
+    @Override
     public void actionPerformed(ActionEvent e) {
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ShowAllAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ShowAllAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,7 +23,7 @@
  */
 package com.sun.hotspot.igv.view.actions;
 
-import com.sun.hotspot.igv.view.*;
+import com.sun.hotspot.igv.view.EditorTopComponent;
 import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import javax.swing.Action;
@@ -37,6 +37,7 @@
  */
 public final class ShowAllAction extends CallableSystemAction {
 
+    @Override
     public void performAction() {
         EditorTopComponent editor = EditorTopComponent.getActive();
         if (editor != null) {
@@ -49,6 +50,7 @@
         putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK));
     }
 
+    @Override
     public String getName() {
         return "Show all";
     }
@@ -58,6 +60,7 @@
         super.initialize();
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ZoomInAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ZoomInAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -37,6 +37,7 @@
  */
 public final class ZoomInAction extends CallableSystemAction {
 
+    @Override
     public void performAction() {
         EditorTopComponent editor = EditorTopComponent.getActive();
         if (editor != null) {
@@ -44,6 +45,7 @@
         }
     }
 
+    @Override
     public String getName() {
         return "Zoom in";
     }
@@ -53,6 +55,7 @@
         putValue(Action.SHORT_DESCRIPTION, "Zoom in");
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ZoomOutAction.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ZoomOutAction.java	Thu Feb 02 16:07:52 2012 -0800
@@ -37,6 +37,7 @@
  */
 public final class ZoomOutAction extends CallableSystemAction {
 
+    @Override
     public void performAction() {
         EditorTopComponent editor = EditorTopComponent.getActive();
         if (editor != null) {
@@ -50,6 +51,7 @@
         putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, Event.CTRL_MASK, false));
     }
 
+    @Override
     public String getName() {
         return "Zoom out";
     }
@@ -59,6 +61,7 @@
         super.initialize();
     }
 
+    @Override
     public HelpCtx getHelpCtx() {
         return HelpCtx.DEFAULT_HELP;
     }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/BlockWidget.java	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2008, 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.sun.hotspot.igv.view.widgets;
-
-import com.sun.hotspot.igv.data.InputBlock;
-import com.sun.hotspot.igv.graph.Diagram;
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Graphics2D;
-import java.awt.Rectangle;
-import java.awt.Stroke;
-import java.awt.geom.Rectangle2D;
-import org.netbeans.api.visual.widget.Scene;
-import org.netbeans.api.visual.widget.Widget;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-public class BlockWidget extends Widget {
-
-    public static final int BORDER = 20;
-    public static final Color BACKGROUND_COLOR = new Color(235, 235, 255);
-    private static final Font titleFont = new Font("Serif", Font.PLAIN, 14).deriveFont(Font.BOLD);
-    private InputBlock blockNode;
-    private Diagram diagram;
-
-    public BlockWidget(Scene scene, Diagram d, InputBlock blockNode) {
-        super(scene);
-        this.blockNode = blockNode;
-        this.diagram = d;
-        this.setBackground(BACKGROUND_COLOR);
-        this.setOpaque(true);
-        this.setCheckClipping(true);
-    }
-
-    @Override
-    protected void paintWidget() {
-        super.paintWidget();
-        Graphics2D g = this.getGraphics();
-        Stroke old = g.getStroke();
-        g.setColor(Color.BLUE);
-        Rectangle r = new Rectangle(this.getPreferredBounds());
-        r.width--;
-        r.height--;
-        if (this.getBounds().width > 0 && this.getBounds().height > 0) {
-            g.setStroke(new BasicStroke(2));
-            g.drawRect(r.x, r.y, r.width, r.height);
-        }
-
-        Color titleColor = Color.BLACK;
-        g.setColor(titleColor);
-        g.setFont(titleFont);
-
-        String s = "B" + blockNode.getName();
-        Rectangle2D r1 = g.getFontMetrics().getStringBounds(s, g);
-        g.drawString(s, r.x + 5, r.y + (int) r1.getHeight());
-        g.setStroke(old);
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/FigureWidget.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/FigureWidget.java	Thu Feb 02 16:07:52 2012 -0800
@@ -23,19 +23,13 @@
  */
 package com.sun.hotspot.igv.view.widgets;
 
+import com.sun.hotspot.igv.data.Properties;
 import com.sun.hotspot.igv.graph.Figure;
-import com.sun.hotspot.igv.view.DiagramScene;
+import com.sun.hotspot.igv.util.DoubleClickAction;
 import com.sun.hotspot.igv.util.DoubleClickHandler;
-import com.sun.hotspot.igv.data.Properties;
-import com.sun.hotspot.igv.util.DoubleClickAction;
 import com.sun.hotspot.igv.util.PropertiesSheet;
-import java.awt.AlphaComposite;
-import java.awt.Color;
-import java.awt.Composite;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.Point;
-import java.awt.Rectangle;
+import com.sun.hotspot.igv.view.DiagramScene;
+import java.awt.*;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Set;
@@ -47,10 +41,10 @@
 import javax.swing.event.MenuListener;
 import org.netbeans.api.visual.action.PopupMenuProvider;
 import org.netbeans.api.visual.action.WidgetAction;
+import org.netbeans.api.visual.layout.LayoutFactory;
 import org.netbeans.api.visual.model.ObjectState;
+import org.netbeans.api.visual.widget.LabelWidget;
 import org.netbeans.api.visual.widget.Widget;
-import org.netbeans.api.visual.layout.LayoutFactory;
-import org.netbeans.api.visual.widget.LabelWidget;
 import org.openide.nodes.AbstractNode;
 import org.openide.nodes.Children;
 import org.openide.nodes.Node;
@@ -122,7 +116,7 @@
         middleWidget.getActions().addAction(new DoubleClickAction(this));
 	middleWidget.setCheckClipping(true);
 
-        labelWidgets = new ArrayList<LabelWidget>();
+        labelWidgets = new ArrayList<>();
 
         String[] strings = figure.getLines();
 
@@ -228,6 +222,7 @@
         return getProperties().get("name");
     }
 
+    @Override
     public Properties getProperties() {
         return figure.getProperties();
     }
@@ -238,11 +233,6 @@
 
     @Override
     protected void paintChildren() {
-
-        if (diagramScene.getZoomFactor() < ZOOM_FACTOR && diagramScene.getModel().getShowBlocks()) {
-            return;
-        }
-
         Composite oldComposite = null;
         if (boundary) {
             oldComposite = getScene().getGraphics().getComposite();
@@ -269,6 +259,7 @@
         }
     }
  
+    @Override
     public JPopupMenu getPopupMenu(Widget widget, Point point) {
         JPopupMenu menu = diagramScene.createPopupMenu();
         menu.addSeparator();
@@ -299,6 +290,7 @@
             this.successors = successors;
         }
 
+        @Override
         public void menuSelected(MenuEvent e) {
             if (menu.getItemCount() > 0) {
                 // already built before
@@ -339,28 +331,31 @@
             }
         }
 
+        @Override
         public void menuDeselected(MenuEvent e) {
             // ignore
         }
 
+        @Override
         public void menuCanceled(MenuEvent e) {
             // ignore
         }
     }
 
+    @Override
     public void handleDoubleClick(Widget w, WidgetAction.WidgetMouseEvent e) {
 
         if (diagramScene.isAllVisible()) {
-            final Set<Integer> hiddenNodes = new HashSet<Integer>(diagramScene.getModel().getGraphToView().getGroup().getAllNodes());
+            final Set<Integer> hiddenNodes = new HashSet<>(diagramScene.getModel().getGraphToView().getGroup().getAllNodes());
             hiddenNodes.removeAll(this.getFigure().getSource().getSourceNodesAsSet());
             this.diagramScene.getModel().showNot(hiddenNodes);
         } else if (isBoundary()) {
 
-            final Set<Integer> hiddenNodes = new HashSet<Integer>(diagramScene.getModel().getHiddenNodes());
+            final Set<Integer> hiddenNodes = new HashSet<>(diagramScene.getModel().getHiddenNodes());
             hiddenNodes.removeAll(this.getFigure().getSource().getSourceNodesAsSet());
             this.diagramScene.getModel().showNot(hiddenNodes);
         } else {
-            final Set<Integer> hiddenNodes = new HashSet<Integer>(diagramScene.getModel().getHiddenNodes());
+            final Set<Integer> hiddenNodes = new HashSet<>(diagramScene.getModel().getHiddenNodes());
             hiddenNodes.addAll(this.getFigure().getSource().getSourceNodesAsSet());
             this.diagramScene.getModel().showNot(hiddenNodes);
         }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/InputSlotWidget.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/InputSlotWidget.java	Thu Feb 02 16:07:52 2012 -0800
@@ -53,6 +53,7 @@
         return inputSlot;
     }
     
+    @Override
     protected int calculateSlotWidth() {
         List<InputSlot> slots = getSlot().getFigure().getInputSlots();
         assert slots.contains(getSlot());
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/LineWidget.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/LineWidget.java	Thu Feb 02 16:07:52 2012 -0800
@@ -28,12 +28,7 @@
 import com.sun.hotspot.igv.graph.InputSlot;
 import com.sun.hotspot.igv.graph.OutputSlot;
 import com.sun.hotspot.igv.view.DiagramScene;
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Graphics2D;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.Stroke;
+import java.awt.*;
 import java.awt.geom.Line2D;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -84,7 +79,7 @@
         this.from = from;
         this.to = to;
         this.predecessor = predecessor;
-        this.successors = new ArrayList<LineWidget>();
+        this.successors = new ArrayList<>();
         if (predecessor != null) {
             predecessor.addSuccessor(this);
         }
@@ -129,16 +124,19 @@
 
         this.getActions().addAction(ActionFactory.createSelectAction(new SelectProvider() {
 
+            @Override
             public boolean isAimingAllowed(Widget arg0, Point arg1, boolean arg2) {
                 return true;
             }
 
+            @Override
             public boolean isSelectionAllowed(Widget arg0, Point arg1, boolean arg2) {
                 return true;
             }
 
+            @Override
             public void select(Widget arg0, Point arg1, boolean arg2) {
-                Set<Figure> set = new HashSet<Figure>();
+                Set<Figure> set = new HashSet<>();
                 for (Connection c : LineWidget.this.connections) {
                     set.add(c.getInputSlot().getFigure());
                     set.add(c.getOutputSlot().getFigure());
@@ -241,8 +239,8 @@
 
     private void setHighlighted(boolean b) {
         this.highlighted = b;
-	Set<Object> highlightedObjects = new HashSet<Object>(scene.getHighlightedObjects());
-	Set<Object> highlightedObjectsChange = new HashSet<Object>();
+	Set<Object> highlightedObjects = new HashSet<>(scene.getHighlightedObjects());
+	Set<Object> highlightedObjectsChange = new HashSet<>();
         for (Connection c : connections) {
 		highlightedObjectsChange.add(c.getInputSlot().getFigure());
 		highlightedObjectsChange.add(c.getInputSlot());
@@ -311,6 +309,7 @@
         }
     }
 
+    @Override
     public JPopupMenu getPopupMenu(Widget widget, Point localLocation) {
         JPopupMenu menu = new JPopupMenu();
         menu.add(scene.createGotoAction(outputSlot.getFigure()));
@@ -324,14 +323,17 @@
         final LineWidget w = this;
         menu.addPopupMenuListener(new PopupMenuListener() {
 
+            @Override
             public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
                 w.setRecursivePopupVisible(true);
             }
 
+            @Override
             public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
                 w.setRecursivePopupVisible(false);
             }
 
+            @Override
             public void popupMenuCanceled(PopupMenuEvent e) {
             }
         });
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/OutputSlotWidget.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/OutputSlotWidget.java	Thu Feb 02 16:07:52 2012 -0800
@@ -28,7 +28,6 @@
 import com.sun.hotspot.igv.view.DiagramScene;
 import java.awt.Point;
 import java.util.List;
-import org.netbeans.api.visual.widget.Scene;
 import org.netbeans.api.visual.widget.Widget;
 
 /**
@@ -55,6 +54,7 @@
         return outputSlot;
     }
 
+    @Override
     protected int calculateSlotWidth() {
         
         List<OutputSlot> slots = getSlot().getFigure().getOutputSlots();
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/SlotWidget.java	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/SlotWidget.java	Thu Feb 02 16:07:52 2012 -0800
@@ -26,13 +26,11 @@
 import com.sun.hotspot.igv.graph.Figure;
 import com.sun.hotspot.igv.graph.OutputSlot;
 import com.sun.hotspot.igv.graph.Slot;
-import com.sun.hotspot.igv.selectioncoordinator.SelectionCoordinator;
 import com.sun.hotspot.igv.util.DoubleClickHandler;
 import com.sun.hotspot.igv.view.DiagramScene;
 import java.awt.Color;
 import java.awt.Font;
 import java.awt.Graphics2D;
-import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.geom.Rectangle2D;
 import java.util.HashSet;
@@ -155,10 +153,11 @@
         return getFigureWidget().getFigure().getWidth() / count;
     }
 
+    @Override
     public void handleDoubleClick(Widget w, WidgetAction.WidgetMouseEvent e) {
-        Set<Integer> hiddenNodes = new HashSet<Integer>(diagramScene.getModel().getHiddenNodes());
+        Set<Integer> hiddenNodes = new HashSet<>(diagramScene.getModel().getHiddenNodes());
         if (diagramScene.isAllVisible()) {
-            hiddenNodes = new HashSet<Integer>(diagramScene.getModel().getGraphToView().getGroup().getAllNodes());
+            hiddenNodes = new HashSet<>(diagramScene.getModel().getGraphToView().getGroup().getAllNodes());
         } 
 
         boolean progress = false;
--- a/src/share/tools/IdealGraphVisualizer/nbproject/project.properties	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/tools/IdealGraphVisualizer/nbproject/project.properties	Thu Feb 02 16:07:52 2012 -0800
@@ -1,58 +1,44 @@
-app.icon=branding/core/core.jar/org/netbeans/core/startup/frame48.gif
-app.name=idealgraphvisualizer
-app.title=IdealGraphVisualizer
-branding.token=${app.name}
-modules=\
-    ${project.com.sun.hotspot.igv.graph}:\
-    ${project.com.sun.hotspot.igv.coordinator}:\
-    ${project.com.sun.hotspot.igv.filter}:\
-    ${project.com.sun.hotspot.igv.hierarchicallayout}:\
-    ${project.com.sun.hotspot.igv.layout}:\
-    ${project.com.sun.hotspot.igv.controlflow}:\
-    ${project.com.sun.hotspot.igv.data}:\
-    ${project.com.sun.hotspot.igv.view}:\
-    ${project.com.sun.hotspot.igv.bytecodes}:\
-    ${project.com.sun.hotspot.igv.difference}:\
-    ${project.com.sun.hotspot.igv.settings}:\
-    ${project.com.sun.hotspot.igv.util}:\
-    ${project.com.sun.hotspot.igv.rhino}:\
-    ${project.com.sun.hotspot.igv.svg}:\
-    ${project.com.sun.hotspot.connection}:\
-    ${project.com.sun.hotspot.igv.servercompilerscheduler}:\
-    ${project.com.sun.hotspot.igv.filterwindow}:\
-    ${project.com.sun.hotspot.igv.graphtotext}:\
-    ${project.com.sun.hotspot.igv.java6scriptingproxy}:\
-    ${project.com.sun.hotspot.igv.graphtexteditor}:\
-    ${project.com.sun.hotspot.igv.structuredtext}:\
-    ${project.com.sun.hotspot.igv.texteditor}:\
-    ${project.com.sun.hotspot.igv.selectioncoordinator}:\
-    ${project.com.sun.hotspot.igv.graal}
-project.com.sun.hotspot.connection=NetworkConnection
-project.com.sun.hotspot.igv.bytecodes=Bytecodes
-project.com.sun.hotspot.igv.controlflow=ControlFlow
-project.com.sun.hotspot.igv.coordinator=Coordinator
-project.com.sun.hotspot.igv.data=Data
-project.com.sun.hotspot.igv.difference=Difference
-project.com.sun.hotspot.igv.filter=Filter
-project.com.sun.hotspot.igv.filterwindow=FilterWindow
-project.com.sun.hotspot.igv.graal=Graal
-project.com.sun.hotspot.igv.graph=Graph
-project.com.sun.hotspot.igv.graphtexteditor=GraphTextEditor
-project.com.sun.hotspot.igv.graphtotext=GraphToText
-project.com.sun.hotspot.igv.hierarchicallayout=HierarchicalLayout
-project.com.sun.hotspot.igv.java6scriptingproxy=Java6ScriptingProxy
-project.com.sun.hotspot.igv.layout=Layout
-project.com.sun.hotspot.igv.rhino=RhinoScriptEngineProxy
-project.com.sun.hotspot.igv.selectioncoordinator=SelectionCoordinator
-project.com.sun.hotspot.igv.servercompilerscheduler=ServerCompiler
-project.com.sun.hotspot.igv.settings=Settings
-project.com.sun.hotspot.igv.structuredtext=StructuredText
-project.com.sun.hotspot.igv.svg=BatikSVGProxy
-project.com.sun.hotspot.igv.texteditor=TextEditor
-project.com.sun.hotspot.igv.view=View
-project.com.sun.hotspot.igv.util=Util
-
-# Disable assertions for RequestProcessor to prevent annoying messages in case
-# of multiple SceneAnimator update tasks in the default RequestProcessor.
-run.args.extra = -J-client -J-da:org.openide.util.RequestProcessor
-debug.args.extra = -J-client -J-da:org.openide.util.RequestProcessor
+app.icon=branding/core/core.jar/org/netbeans/core/startup/frame48.gif
+app.name=idealgraphvisualizer
+app.title=IdealGraphVisualizer
+branding.token=${app.name}
+modules=\
+    ${project.com.sun.hotspot.igv.graph}:\
+    ${project.com.sun.hotspot.igv.coordinator}:\
+    ${project.com.sun.hotspot.igv.filter}:\
+    ${project.com.sun.hotspot.igv.hierarchicallayout}:\
+    ${project.com.sun.hotspot.igv.layout}:\
+    ${project.com.sun.hotspot.igv.data}:\
+    ${project.com.sun.hotspot.igv.view}:\
+    ${project.com.sun.hotspot.igv.bytecodes}:\
+    ${project.com.sun.hotspot.igv.difference}:\
+    ${project.com.sun.hotspot.igv.settings}:\
+    ${project.com.sun.hotspot.igv.util}:\
+    ${project.com.sun.hotspot.igv.svg}:\
+    ${project.com.sun.hotspot.connection}:\
+    ${project.com.sun.hotspot.igv.servercompilerscheduler}:\
+    ${project.com.sun.hotspot.igv.filterwindow}:\
+    ${project.com.sun.hotspot.igv.selectioncoordinator}:\
+    ${project.com.sun.hotspot.igv.graal}
+project.com.sun.hotspot.connection=NetworkConnection
+project.com.sun.hotspot.igv.bytecodes=Bytecodes
+project.com.sun.hotspot.igv.coordinator=Coordinator
+project.com.sun.hotspot.igv.data=Data
+project.com.sun.hotspot.igv.difference=Difference
+project.com.sun.hotspot.igv.filter=Filter
+project.com.sun.hotspot.igv.filterwindow=FilterWindow
+project.com.sun.hotspot.igv.graal=Graal
+project.com.sun.hotspot.igv.graph=Graph
+project.com.sun.hotspot.igv.hierarchicallayout=HierarchicalLayout
+project.com.sun.hotspot.igv.layout=Layout
+project.com.sun.hotspot.igv.selectioncoordinator=SelectionCoordinator
+project.com.sun.hotspot.igv.servercompilerscheduler=ServerCompiler
+project.com.sun.hotspot.igv.settings=Settings
+project.com.sun.hotspot.igv.svg=BatikSVGProxy
+project.com.sun.hotspot.igv.view=View
+project.com.sun.hotspot.igv.util=Util
+
+# Disable assertions for RequestProcessor to prevent annoying messages in case
+# of multiple SceneAnimator update tasks in the default RequestProcessor.
+run.args.extra = -J-client -J-da:org.openide.util.RequestProcessor
+debug.args.extra = -J-client -J-da:org.openide.util.RequestProcessor
--- a/src/share/vm/code/debugInfoRec.hpp	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/vm/code/debugInfoRec.hpp	Thu Feb 02 16:07:52 2012 -0800
@@ -101,7 +101,7 @@
                       methodHandle   method,
                       int         bci,
                       bool        reexecute,
-                      bool        rethrow_exception,
+                      bool        rethrow_exception = false,
                       bool        is_method_handle_invoke = false,
                       bool        return_oop = false,
                       DebugToken* locals      = NULL,
--- a/src/share/vm/code/nmethod.cpp	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/vm/code/nmethod.cpp	Thu Feb 02 16:07:52 2012 -0800
@@ -1235,6 +1235,14 @@
     }
     _method = NULL;            // Clear the method of this dead nmethod
   }
+
+#ifdef GRAAL
+    if (_graal_compiled_method != NULL) {
+      HotSpotCompiledMethod::set_nmethod(_graal_compiled_method, 0);
+      _graal_compiled_method = NULL;
+    }
+#endif
+
   // Make the class unloaded - i.e., change state and notify sweeper
   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
   if (is_in_use()) {
--- a/src/share/vm/compiler/compileBroker.cpp	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/vm/compiler/compileBroker.cpp	Thu Feb 02 16:07:52 2012 -0800
@@ -1120,12 +1120,14 @@
                                blocking);*/
   }
 
+#ifdef GRAAL
   if (!JavaThread::current()->is_compiling()) {
     method->set_queued_for_compilation();
     GraalCompiler::instance()->compile_method(method, osr_bci, blocking);
   } else {
     // Recursive compile request => ignore.
   }
+#endif
 
   /*if (blocking) {
     wait_for_completion(task);
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Thu Feb 02 16:07:52 2012 -0800
@@ -275,10 +275,10 @@
 
   int stack_slots = _total_frame_size / HeapWordSize; // conversion to words
   methodHandle method = getMethodFromHotSpotMethod(HotSpotTargetMethod::method(JNIHandles::resolve(target_method_obj))); 
-  {
-    nm = GraalEnv::register_method(method, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table,
-      &_implicit_exception_table, GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, true, false, install_code);
-  }
+
+  nm = GraalEnv::register_method(method, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table,
+    &_implicit_exception_table, GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, true, false, install_code);
+
   method->clear_queued_for_compilation();
 }
 
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Thu Feb 02 16:07:52 2012 -0800
@@ -378,7 +378,9 @@
   
   constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants();
   int byteCode = (op & 0xFF);
-  if (byteCode != Bytecodes::_checkcast && byteCode != Bytecodes::_instanceof && byteCode != Bytecodes::_new && byteCode != Bytecodes::_anewarray && byteCode != Bytecodes::_multianewarray) {
+  if (byteCode != Bytecodes::_checkcast && byteCode != Bytecodes::_instanceof && byteCode != Bytecodes::_new && byteCode != Bytecodes::_anewarray
+      && byteCode != Bytecodes::_multianewarray && byteCode != Bytecodes::_ldc && byteCode != Bytecodes::_ldc_w && byteCode != Bytecodes::_ldc2_w)
+  {
     index = cp->remap_instruction_operand_from_cache(GraalCompiler::to_cp_index_u2(index));
   }
   constantTag tag = cp->tag_at(index);
--- a/src/share/vm/graal/graalJavaAccess.hpp	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Thu Feb 02 16:07:52 2012 -0800
@@ -68,6 +68,7 @@
     int_field(HotSpotMethodResolved, maxLocals)                                         \
     int_field(HotSpotMethodResolved, maxStackSize)                                      \
     boolean_field(HotSpotMethodResolved, canBeInlined)                                  \
+    oop_field(HotSpotMethodResolved, callback, "Lcom/oracle/max/cri/ci/CiGenericCallback;") \
   end_class                                                                             \
   start_class(HotSpotMethodData)                                                        \
     oop_field(HotSpotMethodData, compiler, "Lcom/oracle/max/graal/hotspot/Compiler;")   \
--- a/src/share/vm/graal/graal_paths.hpp	Thu Feb 02 15:40:30 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
- 
-    prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.cri");
-    prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.criutils");
-    prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.asm");
-    prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.graal.graph");
-    prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.graal.nodes");
-    prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.graal.compiler");
-    prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.graal.java");
-    prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.graal.printer");
-    prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.graal.snippets");
-    prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.graal.hotspot");
--- a/src/share/vm/memory/heap.cpp	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/vm/memory/heap.cpp	Thu Feb 02 16:07:52 2012 -0800
@@ -127,7 +127,7 @@
   assert(_number_of_reserved_segments >= _number_of_committed_segments, "just checking");
 
   // reserve space for _segmap
-  if (!_segmap.initialize(align_to_page_size(_number_of_reserved_segments), align_to_page_size(_number_of_committed_segments))) {
+  if (!_segmap.initialize(align_to_allocation_size(_number_of_reserved_segments), align_to_allocation_size(_number_of_committed_segments))) {
     return false;
   }
   assert(_segmap.committed_size() >= (size_t) _number_of_committed_segments, "could not commit  enough space for segment map");
--- a/src/share/vm/prims/jni.cpp	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/vm/prims/jni.cpp	Thu Feb 02 16:07:52 2012 -0800
@@ -5124,11 +5124,13 @@
     *vm = (JavaVM *)(&main_vm);
     *(JNIEnv**)penv = thread->jni_environment();
 
+#ifdef GRAAL
     if (UseGraal) {
       GraalCompiler* compiler = GraalCompiler::instance();
       ciObjectFactory::initialize(); 
       compiler->initialize();
     }
+#endif
 
     // Tracks the time application was running before GC
     RuntimeService::record_application_start();
--- a/src/share/vm/runtime/arguments.cpp	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/vm/runtime/arguments.cpp	Thu Feb 02 16:07:52 2012 -0800
@@ -2096,9 +2096,22 @@
       }
     }
     if (PrintVMOptions) tty->print_cr("GRAAL=%s", graal_dir);
-
+    
     SysClassPath scp_compiler(Arguments::get_sysclasspath());
-#include "graal/graal_paths.hpp"
+    struct dirent* dentry;
+    char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(graal_dir));
+    errno = 0;
+    DIR* graal_dir_handle = os::opendir(graal_dir);
+    while ((dentry = os::readdir(graal_dir_handle, (struct dirent *)tdbuf)) != NULL) {
+      if (strcmp(dentry->d_name, ".") != 0 && strcmp(dentry->d_name, "..")) {
+        prepend_to_graal_classpath(scp_compiler, graal_dir, dentry->d_name);
+        if (PrintVMOptions) {
+          tty->print_cr("Adding project directory %s to bootclasspath", dentry->d_name);
+        }
+      }
+    }
+    os::closedir(graal_dir_handle);
+    FREE_C_HEAP_ARRAY(char, tdbuf);
     scp_compiler.expand_endorsed();
 
     Arguments::set_compilerclasspath(scp_compiler.combined_path());
--- a/src/share/vm/runtime/java.cpp	Thu Feb 02 15:40:30 2012 -0800
+++ b/src/share/vm/runtime/java.cpp	Thu Feb 02 16:07:52 2012 -0800
@@ -425,9 +425,11 @@
   #define BEFORE_EXIT_DONE    2
   static jint volatile _before_exit_status = BEFORE_EXIT_NOT_RUN;
 
+#ifdef GRAAL
   if (UseGraal) {
     GraalCompiler::instance()->exit();
   }
+#endif
 
   // Note: don't use a Mutex to guard the entire before_exit(), as
   // JVMTI post_thread_end_event and post_vm_death_event will run native code.