changeset 6462:b3f5dc099f9d

removed XIR
author Doug Simon <doug.simon@oracle.com>
date Sun, 30 Sep 2012 13:21:20 +0200
parents 989df22d4012
children 41f0849e107b
files graal/com.oracle.graal.compiler.phases/src/com/oracle/graal/compiler/GraalOptions.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirAssembler.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirOp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/Marks.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64DirectCallOp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64IndirectCallOp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64SafepointOp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotXirGenerator.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRXirInstruction.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewObjectArrayNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewPrimitiveArrayNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java graal/com.oracle.max.cri/overview.html graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirArgument.java graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirAssembler.java graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirGenerator.java graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirSite.java graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirSnippet.java graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirTemplate.java graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/package-info.java mx/projects src/share/vm/runtime/arguments.cpp
diffstat 39 files changed, 104 insertions(+), 4049 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.phases/src/com/oracle/graal/compiler/GraalOptions.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.compiler.phases/src/com/oracle/graal/compiler/GraalOptions.java	Sun Sep 30 13:21:20 2012 +0200
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.compiler;
 
-import com.oracle.graal.nodes.*;
 
 
 /**
@@ -259,22 +258,6 @@
      */
     public static int InstanceOfMaxHints = 1;
 
-    /**
-     * Use HIR lowering instead of LIR lowering for certain instructions.
-     * Only instructions in methods whose fully qualified name contains this option will be HIR lowered.
-     */
-    public static String HIRLowerCheckcast = "";
-    public static String HIRLowerInstanceOf = "";
-    public static String HIRLowerNewInstance = "";
-    public static String HIRLowerNewArray = "";
-    public static String HIRLowerMonitors = "";
-    public static String HIRLowerNewMultiArray = "";
-
-    /**
-     * Use XIR to lower {@link Invoke} nodes.
-     */
-    public static boolean XIRLowerInvokes = false;
-
     static {
         // turn detailed assertions on when the general assertions are on (misusing the assert keyword for this)
         assert (DetailedAsserts = true) == true;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Sun Sep 30 13:21:20 2012 +0200
@@ -43,7 +43,6 @@
 import com.oracle.graal.lir.cfg.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.max.cri.xir.*;
 
 public class GraalCompiler {
 
@@ -58,19 +57,13 @@
     public final GraalCodeCacheProvider runtime;
 
     /**
-     * The XIR generator that lowers Java operations to machine operations.
-     */
-    public final XirGenerator xir;
-
-    /**
      * The backend that this compiler has been configured for.
      */
     public final Backend backend;
 
-    public GraalCompiler(GraalCodeCacheProvider runtime, TargetDescription target, Backend backend, XirGenerator xirGen) {
+    public GraalCompiler(GraalCodeCacheProvider runtime, TargetDescription target, Backend backend) {
         this.runtime = runtime;
         this.target = target;
-        this.xir = xirGen;
         this.backend = backend;
     }
 
@@ -94,7 +87,7 @@
                 final FrameMap frameMap = Debug.scope("BackEnd", lir, new Callable<FrameMap>() {
 
                     public FrameMap call() {
-                        return emitLIR(lir, graph, method, assumptions);
+                        return emitLIR(lir, graph, method);
                     }
                 });
                 return Debug.scope("CodeGen", frameMap, new Callable<CompilationResult>() {
@@ -238,9 +231,9 @@
         });
     }
 
-    public FrameMap emitLIR(final LIR lir, StructuredGraph graph, final ResolvedJavaMethod method, Assumptions assumptions) {
+    public FrameMap emitLIR(final LIR lir, StructuredGraph graph, final ResolvedJavaMethod method) {
         final FrameMap frameMap = backend.newFrameMap(runtime.getRegisterConfig(method));
-        final LIRGenerator lirGenerator = backend.newLIRGenerator(graph, frameMap, method, lir, xir, assumptions);
+        final LIRGenerator lirGenerator = backend.newLIRGenerator(graph, frameMap, method, lir);
 
         Debug.scope("LIRGen", lirGenerator, new Runnable() {
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Sun Sep 30 13:21:20 2012 +0200
@@ -421,7 +421,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()) instanceof LIRXirInstruction) {
+                if (defPos < interval.spillDefinitionPos() - 2) {
                     // second definition found, so no spill optimization possible for this interval
                     interval.setSpillState(SpillState.NoOptimization);
                 } else {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Sun Sep 30 13:21:20 2012 +0200
@@ -31,7 +31,6 @@
 import java.util.Map.Entry;
 
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CompilationResult.Mark;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.util.*;
@@ -41,7 +40,6 @@
 import com.oracle.graal.lir.StandardOp.JumpOp;
 import com.oracle.graal.lir.StandardOp.LabelOp;
 import com.oracle.graal.lir.StandardOp.ParametersOp;
-import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.asm.TargetMethodAssembler.CallPositionListener;
 import com.oracle.graal.lir.cfg.*;
 import com.oracle.graal.nodes.*;
@@ -50,17 +48,8 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.virtual.*;
 import com.oracle.max.asm.*;
-import com.oracle.max.cri.xir.*;
-import com.oracle.max.cri.xir.XirAssembler.XirConstant;
-import com.oracle.max.cri.xir.XirAssembler.XirInstruction;
-import com.oracle.max.cri.xir.XirAssembler.XirMark;
-import com.oracle.max.cri.xir.XirAssembler.XirOperand;
-import com.oracle.max.cri.xir.XirAssembler.XirParameter;
-import com.oracle.max.cri.xir.XirAssembler.XirRegister;
-import com.oracle.max.cri.xir.XirAssembler.XirTemp;
 import com.oracle.max.criutils.*;
 
 /**
@@ -75,8 +64,6 @@
     public final NodeMap<Value> nodeOperands;
 
     protected final LIR lir;
-    protected final XirSupport xirSupport;
-    protected final XirGenerator xir;
     private final DebugInfoBuilder debugInfoBuilder;
 
     private Block currentBlock;
@@ -104,8 +91,7 @@
      */
     private final ArrayList<StackSlot> lockDataSlots;
 
-
-    public LIRGenerator(Graph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, LIR lir, XirGenerator xir, Assumptions assumptions) {
+    public LIRGenerator(Graph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, LIR lir) {
         this.graph = graph;
         this.runtime = runtime;
         this.target = target;
@@ -113,8 +99,6 @@
         this.method = method;
         this.nodeOperands = graph.createNodeMap();
         this.lir = lir;
-        this.xir = xir;
-        this.xirSupport = new XirSupport(assumptions);
         this.debugInfoBuilder = new DebugInfoBuilder(nodeOperands);
         this.blockLastLockCount = new BlockMap<>(lir.cfg);
         this.lockDataSlots = new ArrayList<>();
@@ -438,10 +422,6 @@
             return false;
         }
         LIRInstruction lirInstruction = instructions.get(instructions.size() - 1);
-        if (lirInstruction instanceof LIRXirInstruction) {
-            LIRXirInstruction lirXirInstruction = (LIRXirInstruction) lirInstruction;
-            return (lirXirInstruction.falseSuccessor != null) && (lirXirInstruction.trueSuccessor != null);
-        }
         return lirInstruction instanceof StandardOp.JumpOp;
     }
 
@@ -488,14 +468,6 @@
         }
     }
 
-    @Override
-    public void visitCheckCast(CheckCastNode x) {
-        XirSnippet snippet = xir.genCheckCast(site(x, x.object()), toXirArgument(x.object()), toXirArgument(x.targetClassInstruction()), x.targetClass(), x.profile());
-        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()));
-    }
-
     /**
      * Increases the number of currently locked monitors and makes sure that a lock data slot is available for the new lock.
      */
@@ -526,77 +498,6 @@
     }
 
     @Override
-    public void visitMonitorEnter(MonitorEnterNode x) {
-        if (x.eliminated()) {
-            // No code is emitted for eliminated locks.
-            lock();
-        } else {
-
-            // The state before the monitor enter is used for null checks, so it must not contain the newly locked object.
-            LIRFrameState stateBefore = state();
-            lock();
-
-            XirArgument obj = toXirArgument(x.object());
-            XirArgument lockAddress = toXirArgument(emitLea(peekLock()));
-
-            // The state after the monitor enter is used for deoptimization, after the monitor has blocked, so it must contain the newly locked object.
-            LIRFrameState stateAfter = stateFor(x.stateAfter(), -1);
-
-            XirSnippet snippet = xir.genMonitorEnter(site(x, x.object()), obj, lockAddress);
-            emitXir(snippet, x, stateBefore, stateAfter, true, null, null);
-        }
-    }
-
-    @Override
-    public void visitMonitorExit(MonitorExitNode x) {
-        if (x.eliminated()) {
-            // No code is emitted for eliminated locks.
-            unlock();
-        } else {
-            // The state before the monitor exit is used for null checks, so it must contain the locked object.
-            LIRFrameState stateBefore = state();
-
-            XirArgument obj = toXirArgument(x.object());
-            XirArgument lockAddress = toXirArgument(emitLea(peekLock()));
-
-            unlock();
-
-            XirSnippet snippet = xir.genMonitorExit(site(x, x.object()), obj, lockAddress);
-            emitXir(snippet, x, stateBefore, true);
-        }
-    }
-
-    @Override
-    public void visitNewInstance(NewInstanceNode x) {
-        XirSnippet snippet = xir.genNewInstance(site(x), x.instanceClass());
-        emitXir(snippet, x, state(), true);
-    }
-
-    @Override
-    public void visitNewPrimitiveArray(NewPrimitiveArrayNode x) {
-        XirArgument length = toXirArgument(x.length());
-        XirSnippet snippet = xir.genNewArray(site(x), length, x.elementType().kind(), null, null);
-        emitXir(snippet, x, state(), true);
-    }
-
-    @Override
-    public void visitNewObjectArray(NewObjectArrayNode x) {
-        XirArgument length = toXirArgument(x.length());
-        XirSnippet snippet = xir.genNewArray(site(x), length, Kind.Object, x.elementType(), x.elementType().arrayOf());
-        emitXir(snippet, x, state(), true);
-    }
-
-    @Override
-    public void visitNewMultiArray(NewMultiArrayNode x) {
-        XirArgument[] dims = new XirArgument[x.dimensionCount()];
-        for (int i = 0; i < dims.length; i++) {
-            dims[i] = toXirArgument(x.dimension(i));
-        }
-        XirSnippet snippet = xir.genNewMultiArray(site(x), dims, x.type());
-        emitXir(snippet, x, state(), true);
-    }
-
-    @Override
     public void visitReturn(ReturnNode x) {
         Value operand = Value.IllegalValue;
         if (!x.kind().isVoid()) {
@@ -684,8 +585,6 @@
             emitNullCheckBranch((IsNullNode) node, trueSuccessor, falseSuccessor, info);
         } else if (node instanceof CompareNode) {
             emitCompareBranch((CompareNode) node, trueSuccessor, falseSuccessor, info);
-        } else if (node instanceof InstanceOfNode) {
-            emitInstanceOfBranch((InstanceOfNode) node, trueSuccessor, falseSuccessor, info);
         } else if (node instanceof ConstantNode) {
             emitConstantBranch(((ConstantNode) node).asConstant().asBoolean(), trueSuccessor, falseSuccessor, info);
         } else {
@@ -715,12 +614,6 @@
         }
     }
 
-    private void emitInstanceOfBranch(InstanceOfNode x, LabelRef trueSuccessor, LabelRef falseSuccessor, LIRFrameState info) {
-        XirArgument obj = toXirArgument(x.object());
-        XirSnippet snippet = xir.genInstanceOf(site(x, x.object()), obj, toXirArgument(x.targetClassInstruction()), x.targetClass(), x.profile());
-        emitXir(snippet, x, info, null, false, trueSuccessor, falseSuccessor);
-    }
-
     public void emitConstantBranch(boolean value, LabelRef trueSuccessorBlock, LabelRef falseSuccessorBlock, LIRFrameState info) {
         LabelRef block = value ? trueSuccessorBlock : falseSuccessorBlock;
         if (block != null) {
@@ -740,8 +633,6 @@
             return emitNullCheckConditional((IsNullNode) node, trueValue, falseValue);
         } else if (node instanceof CompareNode) {
             return emitCompareConditional((CompareNode) node, trueValue, falseValue);
-        } else if (node instanceof InstanceOfNode) {
-            return emitInstanceOfConditional((InstanceOfNode) node, trueValue, falseValue);
         } else if (node instanceof ConstantNode) {
             return emitConstantConditional(((ConstantNode) node).asConstant().asBoolean(), trueValue, falseValue);
         } else {
@@ -753,14 +644,6 @@
         return emitCMove(operand(node.object()), Constant.NULL_OBJECT, Condition.EQ, false, trueValue, falseValue);
     }
 
-    private Variable emitInstanceOfConditional(InstanceOfNode x, Value trueValue, Value falseValue) {
-        XirArgument obj = toXirArgument(x.object());
-        XirArgument trueArg = toXirArgument(trueValue);
-        XirArgument falseArg = toXirArgument(falseValue);
-        XirSnippet snippet = xir.genMaterializeInstanceOf(site(x, x.object()), obj, toXirArgument(x.targetClassInstruction()), trueArg, falseArg, x.targetClass(), x.profile());
-        return (Variable) emitXir(snippet, null, null, false);
-    }
-
     private Variable emitConstantConditional(boolean value, Value trueValue, Value falseValue) {
         return emitMove(value ? trueValue : falseValue);
     }
@@ -810,11 +693,6 @@
 
     @Override
     public void emitInvoke(Invoke x) {
-        if (GraalOptions.XIRLowerInvokes) {
-            emitInvokeXIR(x);
-            return;
-        }
-
         AbstractCallTargetNode callTarget = (AbstractCallTargetNode) x.callTarget();
         Kind[] signature = callTarget.signature();
         CallingConvention cc = frameMap.registerConfig.getCallingConvention(callTarget.callType(), signature, target(), false);
@@ -847,76 +725,8 @@
 
     protected abstract void emitIndirectCall(IndirectCallTargetNode callTarget, Value result, Value[] parameters, LIRFrameState callState);
 
-    public void emitInvokeXIR(Invoke x) {
-        MethodCallTargetNode callTarget = x.methodCallTarget();
-        JavaMethod targetMethod = callTarget.targetMethod();
-
-        XirSnippet snippet = null;
-        XirArgument receiver;
-        switch (callTarget.invokeKind()) {
-            case Static:
-                snippet = xir.genInvokeStatic(site(x.node()), targetMethod);
-                break;
-            case Special:
-                receiver = toXirArgument(callTarget.receiver());
-                snippet = xir.genInvokeSpecial(site(x.node(), callTarget.receiver()), receiver, targetMethod);
-                break;
-            case Virtual:
-                assert callTarget.receiver().kind() == Kind.Object : callTarget + ": " + callTarget.targetMethod().toString();
-                receiver = toXirArgument(callTarget.receiver());
-                snippet = xir.genInvokeVirtual(site(x.node(), callTarget.receiver()), receiver, targetMethod, x.isMegamorphic());
-                break;
-            case Interface:
-                assert callTarget.receiver().kind() == Kind.Object : callTarget;
-                receiver = toXirArgument(callTarget.receiver());
-                snippet = xir.genInvokeInterface(site(x.node(), callTarget.receiver()), receiver, targetMethod);
-                break;
-        }
-
-        Value destinationAddress = null;
-        if (!target().invokeSnippetAfterArguments) {
-            // 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.
-            LIRFrameState addrInfo = stateFor(stateBeforeCallWithArguments(x.stateAfter(), callTarget, x.bci()), x.leafGraphId());
-            destinationAddress = emitXir(snippet, x.node(), addrInfo, false);
-        }
-
-        Value resultOperand = resultOperandFor(x.node().kind());
-
-        Kind[] signature = MetaUtil.signatureToKinds(callTarget.targetMethod().signature(), callTarget.isStatic() ? null : callTarget.targetMethod().holder().kind());
-        CallingConvention cc = frameMap.registerConfig.getCallingConvention(JavaCall, signature, target(), false);
-        frameMap.callsMethod(cc, JavaCall);
-        List<Value> argList = visitInvokeArguments(cc, callTarget.arguments());
-
-        if (target().invokeSnippetAfterArguments) {
-            // This is the version currently active for HotSpot.
-            LIRFrameState addrInfo = stateFor(stateBeforeCallWithArguments(x.stateAfter(), callTarget, x.bci()), null, null, x.leafGraphId());
-            destinationAddress = emitXir(snippet, x.node(), addrInfo, false);
-        }
-
-        final Map<XirMark, Mark> marks = snippet.marks;
-
-        CallPositionListener callPositionListener = new CallPositionListener() {
-            public void beforeCall(TargetMethodAssembler tasm) {
-            }
-            public void atCall(TargetMethodAssembler tasm) {
-                if (marks != null) {
-                    marks.put(XirMark.CALLSITE, tasm.recordMark(null, new Mark[0]));
-                }
-            }
-        };
-
-        LIRFrameState callInfo = stateFor(x.stateDuring(), null, x instanceof InvokeWithExceptionNode ? getLIRBlock(((InvokeWithExceptionNode) x).exceptionEdge()) : null, x.leafGraphId());
-        emitCall(targetMethod, resultOperand, argList, destinationAddress, callInfo, callPositionListener);
-
-        if (isLegal(resultOperand)) {
-            setResult(x.node(), emitMove(resultOperand));
-        }
-    }
-
     protected abstract void emitCall(Object targetMethod, Value result, List<Value> arguments, Value targetAddress, LIRFrameState info, CallPositionListener ecl);
 
-
     private static Value toStackKind(Value value) {
         if (value.getKind().stackKind() != value.getKind()) {
             // We only have stack-kinds in the LIR, so convert the operand kind for values from the calling convention.
@@ -1148,167 +958,6 @@
         }
     }
 
-    protected XirArgument toXirArgument(Value v) {
-        if (v == null) {
-            return null;
-        }
-        return XirArgument.forInternalObject(v);
-    }
-
-    protected XirArgument toXirArgument(ValueNode i) {
-        if (i == null) {
-            return null;
-        }
-        return XirArgument.forInternalObject(loadNonConst(operand(i)));
-    }
-
-    private Value allocateOperand(XirSnippet snippet, XirOperand op) {
-        if (op instanceof XirParameter)  {
-            XirParameter param = (XirParameter) op;
-            return allocateOperand(snippet.arguments[param.parameterIndex], op, param.canBeConstant);
-        } else if (op instanceof XirRegister) {
-            XirRegister reg = (XirRegister) op;
-            return reg.register;
-        } else if (op instanceof XirTemp) {
-            return newVariable(op.kind);
-        } else {
-            GraalInternalError.shouldNotReachHere();
-            return null;
-        }
-    }
-
-    private Value allocateOperand(XirArgument arg, XirOperand var, boolean canBeConstant) {
-        if (arg.constant != null) {
-            return arg.constant;
-        }
-
-        Value value = (Value) arg.object;
-        if (canBeConstant) {
-            return value;
-        }
-        Variable variable = load(value);
-        if (var.kind == Kind.Byte || var.kind == Kind.Boolean) {
-            Variable tempVar = new Variable(value.getKind(), lir.nextVariable(), Register.RegisterFlag.Byte);
-            emitMove(variable, tempVar);
-            variable = tempVar;
-        }
-        return variable;
-    }
-
-    protected Value emitXir(XirSnippet snippet, ValueNode x, LIRFrameState info, boolean setInstructionResult) {
-        return emitXir(snippet, x, info, null, setInstructionResult, null, null);
-    }
-
-    protected Value emitXir(XirSnippet snippet, ValueNode instruction, LIRFrameState info, LIRFrameState infoAfter, boolean setInstructionResult, LabelRef trueSuccessor, LabelRef falseSuccessor) {
-        if (GraalOptions.PrintXirTemplates) {
-            TTY.println("Emit XIR template " + snippet.template.name);
-        }
-
-        final Value[] operandsArray = new Value[snippet.template.variableCount];
-
-        frameMap.reserveOutgoing(snippet.template.outgoingStackSize);
-
-        XirOperand resultOperand = snippet.template.resultOperand;
-
-        if (snippet.template.allocateResultOperand) {
-            Value outputOperand = IllegalValue;
-            // This snippet has a result that must be separately allocated
-            // Otherwise it is assumed that the result is part of the inputs
-            if (resultOperand.kind != Kind.Void && resultOperand.kind != Kind.Illegal) {
-                if (setInstructionResult) {
-                    outputOperand = newVariable(instruction.kind());
-                } else {
-                    outputOperand = newVariable(resultOperand.kind);
-                }
-                assert operandsArray[resultOperand.index] == null;
-            }
-            operandsArray[resultOperand.index] = outputOperand;
-            if (GraalOptions.PrintXirTemplates) {
-                TTY.println("Output operand: " + outputOperand);
-            }
-        }
-
-        for (XirTemp t : snippet.template.temps) {
-            if (t instanceof XirRegister) {
-                XirRegister reg = (XirRegister) t;
-                if (!t.reserve) {
-                    operandsArray[t.index] = reg.register;
-                }
-            }
-        }
-
-        for (XirConstant c : snippet.template.constants) {
-            assert operandsArray[c.index] == null;
-            operandsArray[c.index] = c.value;
-        }
-
-        XirOperand[] inputOperands = snippet.template.inputOperands;
-        XirOperand[] inputTempOperands = snippet.template.inputTempOperands;
-        XirOperand[] tempOperands = snippet.template.tempOperands;
-
-        Value[] inputOperandArray = new Value[inputOperands.length + inputTempOperands.length];
-        Value[] tempOperandArray = new Value[tempOperands.length];
-        int[] inputOperandIndicesArray = new int[inputOperands.length + inputTempOperands.length];
-        int[] tempOperandIndicesArray = new int[tempOperands.length];
-        for (int i = 0; i < inputOperands.length; i++) {
-            XirOperand x = inputOperands[i];
-            Value op = allocateOperand(snippet, x);
-            operandsArray[x.index] = op;
-            inputOperandArray[i] = op;
-            inputOperandIndicesArray[i] = x.index;
-            if (GraalOptions.PrintXirTemplates) {
-                TTY.println("Input operand: " + x);
-            }
-        }
-
-        assert inputTempOperands.length == 0 : "cwi: I think this code is never used.  If you see this exception being thrown, please tell me...";
-
-        for (int i = 0; i < tempOperands.length; i++) {
-            XirOperand x = tempOperands[i];
-            Value op = allocateOperand(snippet, x);
-            operandsArray[x.index] = op;
-            tempOperandArray[i] = op;
-            tempOperandIndicesArray[i] = x.index;
-            if (GraalOptions.PrintXirTemplates) {
-                TTY.println("Temp operand: " + x);
-            }
-        }
-
-        for (Value operand : operandsArray) {
-            assert operand != null;
-        }
-
-        Value allocatedResultOperand = operandsArray[resultOperand.index];
-        if (!isVariable(allocatedResultOperand) && !isRegister(allocatedResultOperand)) {
-            allocatedResultOperand = IllegalValue;
-        }
-
-        if (setInstructionResult && isLegal(allocatedResultOperand)) {
-            Value operand = operand(instruction);
-            if (operand == null) {
-                setResult(instruction, allocatedResultOperand);
-            } else {
-                assert operand == allocatedResultOperand;
-            }
-        }
-
-
-        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!
-            emitXir(snippet, operandsArray, allocatedResultOperand,
-                    inputOperandArray, tempOperandArray, inputOperandIndicesArray, tempOperandIndicesArray,
-                    (allocatedResultOperand == IllegalValue) ? -1 : resultOperand.index,
-                    info, infoAfter, trueSuccessor, falseSuccessor);
-            Debug.metric("LIRXIRInstructions").increment();
-        }
-
-        return operandsArray[resultOperand.index];
-    }
-
-    protected abstract void emitXir(XirSnippet snippet, Value[] operands, Value outputOperand, Value[] inputs, Value[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex,
-                    LIRFrameState info, LIRFrameState infoAfter, LabelRef trueSuccessor, LabelRef falseSuccessor);
-
     protected final Value callRuntime(RuntimeCall runtimeCall, LIRFrameState info, Value... args) {
         // get a result register
         Kind result = runtimeCall.getResultKind();
@@ -1344,67 +993,6 @@
         return emitMove(location);
     }
 
-    protected XirSupport site(ValueNode x) {
-        return xirSupport.site(x, null);
-    }
-
-    protected XirSupport site(ValueNode x, ValueNode receiver) {
-        return xirSupport.site(x, receiver);
-    }
-
-    /**
-     * Implements site-specific information for the XIR interface.
-     */
-    static class XirSupport implements XirSite {
-        final Assumptions assumptions;
-        ValueNode current;
-        ValueNode receiver;
-
-
-        public XirSupport(Assumptions assumptions) {
-            this.assumptions = assumptions;
-        }
-
-        public boolean isNonNull(XirArgument argument) {
-            return false;
-        }
-
-        public boolean requiresNullCheck() {
-            return receiver == null || !(receiver.stamp() instanceof ObjectStamp && ((ObjectStamp) receiver.stamp()).nonNull());
-        }
-
-        public boolean requiresBoundsCheck() {
-            return true;
-        }
-
-        public boolean requiresReadBarrier() {
-            return current == null || true;
-        }
-
-        public boolean requiresWriteBarrier() {
-            return current == null || true;
-        }
-
-        public boolean requiresArrayStoreCheck() {
-            return true;
-        }
-
-        public Assumptions assumptions() {
-            return assumptions;
-        }
-
-        XirSupport site(ValueNode v, ValueNode r) {
-            current = v;
-            receiver = r;
-            return this;
-        }
-
-        @Override
-        public String toString() {
-            return "XirSupport<" + current + ">";
-        }
-    }
-
     public FrameMap frameMap() {
         return frameMap;
     }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Sun Sep 30 13:21:20 2012 +0200
@@ -29,7 +29,6 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
-import com.oracle.max.cri.xir.*;
 
 /**
  * The {@code Backend} class represents a compiler backend for Graal.
@@ -48,12 +47,10 @@
         return new FrameMap(runtime, target, registerConfig);
     }
 
-    public abstract LIRGenerator newLIRGenerator(Graph graph, FrameMap frameMap, ResolvedJavaMethod method, LIR lir, XirGenerator xir, Assumptions assumptions);
+    public abstract LIRGenerator newLIRGenerator(Graph graph, FrameMap frameMap, ResolvedJavaMethod method, LIR lir);
 
     public abstract TargetMethodAssembler newAssembler(FrameMap frameMap, LIR lir);
 
-    public abstract XirAssembler newXirAssembler();
-
     /**
      * Emits code to do stack overflow checking.
      *
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java	Sun Sep 30 13:21:20 2012 +0200
@@ -72,7 +72,6 @@
 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.xir.*;
 
 /**
  * This class implements the X86-specific portion of the LIR generator.
@@ -98,8 +97,8 @@
         }
     }
 
-    public AMD64LIRGenerator(Graph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, LIR lir, XirGenerator xir, Assumptions assumptions) {
-        super(graph, runtime, target, frameMap, method, lir, xir, assumptions);
+    public AMD64LIRGenerator(Graph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, LIR lir) {
+        super(graph, runtime, target, frameMap, method, lir);
         lir.spillMoveFactory = new AMD64SpillMoveFactory();
     }
 
@@ -574,12 +573,6 @@
     }
 
     @Override
-    protected void emitXir(XirSnippet snippet, Value[] operands, Value outputOperand, Value[] inputs, Value[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex,
-                    LIRFrameState info, LIRFrameState infoAfter, LabelRef trueSuccessor, LabelRef falseSuccessor) {
-        append(new AMD64XirOp(snippet, operands, outputOperand, inputs, temps, inputOperandIndices, tempOperandIndices, outputOperandIndex, info, infoAfter, trueSuccessor, falseSuccessor));
-    }
-
-    @Override
     protected void emitSequentialSwitch(Constant[] keyConstants, LabelRef[] keyTargets, LabelRef defaultTarget, Value key) {
         // Making a copy of the switch value is necessary because jump table destroys the input value
         if (key.getKind() == Kind.Int) {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirAssembler.java	Sun Sep 30 13:19:38 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,222 +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.graal.compiler.target.amd64;
-
-import static com.oracle.max.cri.xir.XirTemplate.GlobalFlags.*;
-
-import java.util.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.xir.*;
-
-/**
- * AMD64 version of {@link XirAssembler}.
- *
- */
-public class AMD64XirAssembler extends XirAssembler {
-    public AMD64XirAssembler(TargetDescription target) {
-        super(target);
-    }
-
-    @Override
-    protected XirTemplate buildTemplate(String name, boolean isStub) {
-        List<XirInstruction> fastPath = new ArrayList<>(instructions.size());
-        List<XirInstruction> slowPath = new ArrayList<>();
-
-        int flags = 0;
-
-        if (isStub) {
-            flags |= GLOBAL_STUB.mask;
-        }
-
-        List<XirInstruction> currentList = fastPath;
-
-        XirOperand fixedRDX = null;
-        XirOperand fixedRAX = null;
-        XirOperand fixedRCX = null;
-        XirOperand fixedRSI = null;
-        XirOperand fixedRDI = null;
-        HashSet<XirLabel> boundLabels = new HashSet<>();
-
-        for (XirInstruction i : instructions) {
-            boolean appended = false;
-            switch (i.op) {
-                case Mov:
-                    break;
-
-                case Add:
-                case Sub:
-                case Div:
-                case Mul:
-                case Mod:
-                case Shl:
-                case Shr:
-                case And:
-                case Or:
-                case Xor:
-                    // Convert to two operand form
-                    XirOperand xOp = i.x();
-                    if (i.op == XirOp.Div || i.op == XirOp.Mod) {
-                        if (fixedRDX == null) {
-                            fixedRDX = createRegisterTemp("divModTemp", Kind.Int, AMD64.rdx);
-                        }
-                        // Special treatment to make sure that the left input of % and / is in RAX
-                        if (fixedRAX == null) {
-                            fixedRAX = createRegisterTemp("divModLeftInput", Kind.Int, AMD64.rax);
-                        }
-                        currentList.add(new XirInstruction(i.x().kind, XirOp.Mov, fixedRAX, i.x()));
-                        xOp = fixedRAX;
-                    } else {
-                        if (i.result != i.x()) {
-                            currentList.add(new XirInstruction(i.result.kind, XirOp.Mov, i.result, i.x()));
-                            xOp = i.result;
-                        }
-                    }
-
-                    XirOperand yOp = i.y();
-                    if ((i.op == XirOp.Shl || i.op == XirOp.Shr) && (!(i.y() instanceof XirConstantOperand))) {
-                        // Special treatment to make sure that the shift count is always in RCX
-                        if (fixedRCX == null) {
-                            fixedRCX = createRegisterTemp("fixedShiftCount", i.y().kind, AMD64.rcx);
-                        }
-                        currentList.add(new XirInstruction(i.result.kind, XirOp.Mov, fixedRCX, i.y()));
-                        yOp = fixedRCX;
-                    } else if (i.op == XirOp.Mul && (i.y() instanceof XirConstantOperand)) {
-                        // Cannot multiply directly with a constant, so introduce a new temporary variable
-                        XirOperand tempLocation = createTemp("mulTempLocation", i.y().kind);
-                        currentList.add(new XirInstruction(i.result.kind, XirOp.Mov, tempLocation, i.y()));
-                        yOp = tempLocation;
-
-                    }
-
-                    XirOperand resultOp = i.result;
-                    if (i.op == XirOp.Div) {
-                        resultOp = fixedRAX;
-                    } else if (i.op == XirOp.Mod) {
-                        resultOp = fixedRDX;
-                    }
-
-                    if (xOp != i.x() || yOp != i.y() || resultOp != i.result) {
-                        currentList.add(new XirInstruction(i.result.kind, i.op, resultOp, xOp, yOp));
-                        appended = true;
-                    }
-
-                    if (resultOp != i.result) {
-                        currentList.add(new XirInstruction(i.result.kind, XirOp.Mov, i.result, resultOp));
-                    }
-                    break;
-
-                case RepeatMoveWords:
-                case RepeatMoveBytes:
-                    if (fixedRSI == null) {
-                        fixedRSI = createRegisterTemp("fixedRSI", target.wordKind, AMD64.rsi);
-                    }
-                    if (fixedRDI == null) {
-                        fixedRDI = createRegisterTemp("fixedRDI", target.wordKind, AMD64.rdi);
-                    }
-                    if (fixedRCX == null) {
-                        fixedRCX = createRegisterTemp("fixedRCX", target.wordKind, AMD64.rcx);
-                    }
-                    currentList.add(new XirInstruction(target.wordKind, XirOp.Mov, fixedRSI, i.x()));
-                    currentList.add(new XirInstruction(target.wordKind, XirOp.Mov, fixedRDI, i.y()));
-                    currentList.add(new XirInstruction(target.wordKind, XirOp.Mov, fixedRCX, i.z()));
-                    currentList.add(new XirInstruction(Kind.Illegal, i.op, i.result, fixedRSI, fixedRDI, fixedRCX));
-                    appended = true;
-                    break;
-
-                case NullCheck:
-                case PointerLoad:
-                case LoadEffectiveAddress:
-                case PointerStore:
-                case PointerLoadDisp:
-                case PointerStoreDisp:
-                    break;
-                case PointerCAS:
-                    if (fixedRAX == null) {
-                        fixedRAX = createRegisterTemp("fixedRAX", target.wordKind, AMD64.rax);
-                    }
-                    // x = source of cmpxch
-                    // y = new value
-                    // z = old value (i.e., the one compared to). Must be in RAX (and so must the result).
-                    currentList.add(new XirInstruction(target.wordKind, XirOp.Mov, fixedRAX, i.z()));
-                    currentList.add(new XirInstruction(i.kind, i.op, i.result, i.x(), i.y(), fixedRAX));
-                    appended = true;
-                    break;
-                case CallRuntime:
-                    flags |= HAS_RUNTIME_CALL.mask;
-                    break;
-                case Jmp:
-                    // jmp can be either into the snippet or to a runtime target
-                    flags |= i.extra instanceof XirLabel ? HAS_CONTROL_FLOW.mask : HAS_RUNTIME_CALL.mask;
-                    break;
-                case Jeq:
-                case Jneq:
-                case Jgt:
-                case Jgteq:
-                case Jugteq:
-                case Jlt:
-                case Jlteq:
-                case DecAndJumpNotZero:
-                case Jbset:
-                    flags |= HAS_CONTROL_FLOW.mask;
-                    break;
-                case Bind:
-                    XirLabel label = (XirLabel) i.extra;
-                    currentList = label.inline ? fastPath : slowPath;
-                    assert !boundLabels.contains(label) : "label may be bound only once";
-                    boundLabels.add(label);
-                    break;
-                case Safepoint:
-                case Push:
-                case Pop:
-                case Mark:
-                case Nop:
-                case ShouldNotReachHere:
-                    break;
-                default:
-                    assert false : "Unknown XIR operation " + i.op;
-            }
-            if (!appended) {
-                currentList.add(i);
-            }
-        }
-        for (XirLabel label : labels) {
-            assert label.name == XirLabel.TrueSuccessor || label.name == XirLabel.FalseSuccessor || boundLabels.contains(label) : "label " + label.name + " is not bound!";
-        }
-        XirInstruction[] fp = fastPath.toArray(new XirInstruction[fastPath.size()]);
-        XirInstruction[] sp = slowPath.size() > 0 ? slowPath.toArray(new XirInstruction[slowPath.size()]) : null;
-        XirLabel[] xirLabels = labels.toArray(new XirLabel[labels.size()]);
-        XirParameter[] xirParameters = parameters.toArray(new XirParameter[parameters.size()]);
-        XirTemp[] temporaryOperands = temps.toArray(new XirTemp[temps.size()]);
-        XirConstant[] constantOperands = constants.toArray(new XirConstant[constants.size()]);
-        XirMark[] marksArray = marks.toArray(new XirMark[marks.size()]);
-        return new XirTemplate(name, this.variableCount, this.allocateResultOperand, resultOperand, fp, sp, xirLabels, xirParameters, temporaryOperands, constantOperands, flags, marksArray, outgoingStackSize);
-    }
-
-    @Override
-    public XirAssembler copy() {
-        return new AMD64XirAssembler(target);
-    }
-}
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirOp.java	Sun Sep 30 13:19:38 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,496 +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.graal.compiler.target.amd64;
-
-import static com.oracle.graal.api.code.CallingConvention.Type.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
-import static com.oracle.graal.api.meta.Value.*;
-
-import java.util.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CompilationResult.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.amd64.*;
-import com.oracle.graal.lir.asm.*;
-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.xir.*;
-import com.oracle.max.cri.xir.XirAssembler.RuntimeCallInformation;
-import com.oracle.max.cri.xir.XirAssembler.XirInstruction;
-import com.oracle.max.cri.xir.XirAssembler.XirLabel;
-import com.oracle.max.cri.xir.XirAssembler.XirMark;
-
-public class AMD64XirOp extends LIRXirInstruction {
-    public AMD64XirOp(XirSnippet snippet, Value[] operands, Value outputOperand, Value[] inputs, Value[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex,
-                        LIRFrameState info, LIRFrameState infoAfter, LabelRef trueSuccessor, LabelRef falseSuccessor) {
-        super(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.stubs.add(new SlowPath(labels));
-        }
-    }
-
-    private class SlowPath extends AMD64Code {
-        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();
-        }
-
-        @Override
-        public String description() {
-            return "slow path for " + snippet.template.name;
-        }
-    }
-
-
-    protected void emitXirInstructions(TargetMethodAssembler tasm, AMD64MacroAssembler masm, XirInstruction[] instructions, Label[] labels, Value[] 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: {
-                    Value result = operands[inst.result.index];
-                    Value source = operands[inst.x().index];
-                    AMD64Move.move(tasm, masm, result, source);
-                    break;
-                }
-
-                case PointerLoad: {
-                    Value result = operands[inst.result.index];
-                    Value pointer = operands[inst.x().index];
-                    RegisterValue register = assureInRegister(tasm, masm, pointer);
-
-                    AMD64Move.load(tasm, masm, result, new Address(inst.kind, register), (Boolean) inst.extra ? state : null);
-                    break;
-                }
-
-                case PointerStore: {
-                    Value value = assureNot64BitConstant(tasm, masm, operands[inst.y().index]);
-                    Value pointer = operands[inst.x().index];
-                    assert isRegister(pointer);
-
-                    AMD64Move.store(tasm, masm, new Address(inst.kind, pointer), value, (Boolean) inst.extra ? state : null);
-                    break;
-                }
-
-                case PointerLoadDisp: {
-                    XirAssembler.AddressAccessInformation addressInformation = (XirAssembler.AddressAccessInformation) inst.extra;
-                    boolean canTrap = addressInformation.canTrap;
-
-                    Address.Scale scale = addressInformation.scale;
-                    int displacement = addressInformation.disp;
-
-                    Value result = operands[inst.result.index];
-                    Value pointer = operands[inst.x().index];
-                    Value index = operands[inst.y().index];
-
-                    pointer = assureInRegister(tasm, masm, pointer);
-                    assert isRegister(pointer);
-
-                    Address src;
-                    if (isConstant(index)) {
-                        assert index.getKind() == Kind.Int;
-                        Constant constantIndex = (Constant) index;
-                        src = new Address(inst.kind, pointer, constantIndex.asInt() * scale.value + displacement);
-                    } else {
-                        src = new Address(inst.kind, pointer, index, scale, displacement);
-                    }
-
-                    AMD64Move.load(tasm, masm, result, src, canTrap ? state : null);
-                    break;
-                }
-
-                case LoadEffectiveAddress: {
-                    XirAssembler.AddressAccessInformation addressInformation = (XirAssembler.AddressAccessInformation) inst.extra;
-
-                    Address.Scale scale = addressInformation.scale;
-                    int displacement = addressInformation.disp;
-
-                    Value result = operands[inst.result.index];
-                    Value pointer = operands[inst.x().index];
-                    Value index = operands[inst.y().index];
-
-                    pointer = assureInRegister(tasm, masm, pointer);
-                    assert isRegister(pointer);
-                    Address src = new Address(Kind.Illegal, pointer, index, scale, displacement);
-                    masm.leaq(asRegister(result), src);
-                    break;
-                }
-
-                case PointerStoreDisp: {
-                    XirAssembler.AddressAccessInformation addressInformation = (XirAssembler.AddressAccessInformation) inst.extra;
-                    boolean canTrap = addressInformation.canTrap;
-
-                    Address.Scale scale = addressInformation.scale;
-                    int displacement = addressInformation.disp;
-
-                    Value value = assureNot64BitConstant(tasm, masm, operands[inst.z().index]);
-                    Value pointer = operands[inst.x().index];
-                    Value index = operands[inst.y().index];
-
-                    pointer = assureInRegister(tasm, masm, pointer);
-                    assert isRegister(pointer);
-
-                    Address dst;
-                    if (isConstant(index)) {
-                        assert index.getKind() == Kind.Int;
-                        Constant constantIndex = (Constant) index;
-                        dst = new Address(inst.kind, pointer, IllegalValue, scale, constantIndex.asInt() * scale.value + displacement);
-                    } else {
-                        dst = new Address(inst.kind, pointer, index, scale, displacement);
-                    }
-
-                    AMD64Move.store(tasm, masm, dst, value, canTrap ? state : 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];
-
-                    Value exchangedVal = operands[inst.y().index];
-                    Value exchangedAddress = operands[inst.x().index];
-                    RegisterValue pointerRegister = assureInRegister(tasm, masm, exchangedAddress);
-                    Address addr = new Address(tasm.target.wordKind, pointerRegister);
-
-                    if ((Boolean) inst.extra && state != null) {
-                        tasm.recordImplicitException(masm.codeBuffer.position(), state);
-                    }
-                    masm.cmpxchgq(asRegister(exchangedVal), addr);
-
-                    break;
-
-                case CallRuntime: {
-                    Kind[] signature = new Kind[inst.arguments.length];
-                    for (int i = 0; i < signature.length; i++) {
-                        signature[i] = inst.arguments[i].kind;
-                    }
-
-                    CallingConvention cc = tasm.frameMap.registerConfig.getCallingConvention(RuntimeCall, signature, tasm.target, false);
-                    for (int i = 0; i < inst.arguments.length; i++) {
-                        Value argumentLocation = cc.locations[i];
-                        Value 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) ? stateAfter : state);
-
-                    if (inst.result != null && inst.result.kind != Kind.Illegal && inst.result.kind != Kind.Void) {
-                        Register returnRegister = tasm.frameMap.registerConfig.getReturnRegister(inst.result.kind);
-                        Value 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];
-                    Value value = operands[inst.x().index];
-                    if (value.getKind() == Kind.Long) {
-                        masm.decq(asRegister(value));
-                    } else {
-                        assert value.getKind() == Kind.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];
-                    Value pointer = operands[inst.x().index];
-                    Value offset = operands[inst.y().index];
-                    Value bit = operands[inst.z().index];
-                    assert isConstant(offset) && isConstant(bit);
-                    Constant constantOffset = (Constant) offset;
-                    Constant constantBit = (Constant) bit;
-                    Address src = new Address(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 state != null : "Must have debug info in order to create a safepoint.";
-                    tasm.recordSafepoint(masm.codeBuffer.position(), state);
-                    break;
-                }
-                case NullCheck: {
-                    tasm.recordImplicitException(masm.codeBuffer.position(), state);
-                    Value pointer = operands[inst.x().index];
-                    masm.nullCheck(asRegister(pointer));
-                    break;
-                }
-                case Push: {
-                    RegisterValue value = assureInRegister(tasm, masm, operands[inst.x().index]);
-                    masm.push(asRegister(value));
-                    break;
-                }
-                case Pop: {
-                    Value result = operands[inst.result.index];
-                    if (isRegister(result)) {
-                        masm.pop(asRegister(result));
-                    } else {
-                        Register 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 ShouldNotReachHere: {
-                    AMD64Call.shouldNotReachHere(tasm, masm);
-                    break;
-                }
-                default:
-                    throw GraalInternalError.shouldNotReachHere("Unknown XIR operation " + inst.op);
-            }
-        }
-    }
-
-    private static void emitXirViaLir(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Arithmetic intOp, AMD64Arithmetic longOp, AMD64Arithmetic floatOp,
-                    AMD64Arithmetic doubleOp, Value left, Value right, Value result) {
-        AMD64Arithmetic code;
-        switch (result.getKind()) {
-            case Int: code = intOp; break;
-            case Long: code = longOp; break;
-            case Float: code = floatOp; break;
-            case Double: code = doubleOp; break;
-            default: throw GraalInternalError.shouldNotReachHere();
-        }
-        assert left == result;
-        if (isRegister(right) && right.getKind() != result.getKind()) {
-            // 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.getKind()), null);
-        } else {
-            AMD64Arithmetic.emit(tasm, masm, code, result, right, null);
-        }
-    }
-
-    private static void emitXirCompare(TargetMethodAssembler tasm, AMD64MacroAssembler masm, XirInstruction inst, ConditionFlag cflag, Value[] ops, Label label) {
-        Value x = ops[inst.x().index];
-        Value y = ops[inst.y().index];
-        AMD64Compare code;
-        switch (x.getKind()) {
-            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 GraalInternalError.shouldNotReachHere();
-        }
-        AMD64Compare.emit(tasm, masm, code, x, y);
-        masm.jcc(cflag, label);
-    }
-
-    private static Value assureNot64BitConstant(TargetMethodAssembler tasm, AMD64MacroAssembler masm, Value value) {
-        if (isConstant(value) && (value.getKind() == Kind.Long || value.getKind() == Kind.Object)) {
-            RegisterValue register = tasm.frameMap.registerConfig.getScratchRegister().asValue(value.getKind());
-            AMD64Move.move(tasm, masm, register, value);
-            return register;
-        }
-        return value;
-    }
-
-    private static RegisterValue assureInRegister(TargetMethodAssembler tasm, AMD64MacroAssembler masm, Value pointer) {
-        if (isConstant(pointer)) {
-            RegisterValue register = tasm.frameMap.registerConfig.getScratchRegister().asValue(pointer.getKind());
-            AMD64Move.move(tasm, masm, register, pointer);
-            return register;
-        }
-
-        assert isRegister(pointer) : "should be register, but is: " + pointer;
-        return (RegisterValue) pointer;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Sun Sep 30 13:21:20 2012 +0200
@@ -23,6 +23,7 @@
 package com.oracle.graal.hotspot;
 
 import java.lang.reflect.*;
+
 import com.oracle.graal.api.*;
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.interpreter.*;
@@ -35,7 +36,6 @@
 import com.oracle.graal.hotspot.target.amd64.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.xir.*;
 
 /**
  * Singleton class holding the instance of the GraalCompiler.
@@ -118,15 +118,9 @@
             // these options are important - graal will not generate correct code without them
             GraalOptions.StackShadowPages = config.stackShadowPages;
 
-            XirGenerator generator = new HotSpotXirGenerator(config, getTarget(), getRuntime().getGlobalStubRegisterConfig(), this);
-            if (Logger.ENABLED) {
-                generator = LoggingProxy.getProxy(XirGenerator.class, generator);
-            }
+            Backend backend = new HotSpotAMD64Backend(getRuntime(), getTarget());
 
-            Backend backend = new HotSpotAMD64Backend(runtime, target);
-            generator.initialize(backend.newXirAssembler());
-
-            compiler = new GraalCompiler(getRuntime(), getTarget(), backend, generator);
+            compiler = new GraalCompiler(getRuntime(), getTarget(), backend);
             if (GraalOptions.CacheGraphs) {
                 cache = new HotSpotGraphCache();
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/Marks.java	Sun Sep 30 13:21:20 2012 +0200
@@ -0,0 +1,51 @@
+/*
+ * 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.graal.hotspot.bridge;
+
+/**
+ * Constants used to mark special positions in code being installed into
+ * the code cache by Graal C++ code. These constants need to be kept in
+ * sync with those of the same name defined in graalCodeInstaller.hpp.
+ */
+public interface Marks {
+
+    // These constants need to correspond to those of the same name in graalCodeInstaller.hpp
+    Integer MARK_VERIFIED_ENTRY            = 0x0001;
+    Integer MARK_UNVERIFIED_ENTRY          = 0x0002;
+    Integer MARK_OSR_ENTRY                 = 0x0003;
+    Integer MARK_UNWIND_ENTRY              = 0x0004;
+    Integer MARK_EXCEPTION_HANDLER_ENTRY   = 0x0005;
+    Integer MARK_DEOPT_HANDLER_ENTRY       = 0x0006;
+    Integer MARK_STATIC_CALL_STUB          = 0x1000;
+    Integer MARK_INVOKEINTERFACE           = 0x2001;
+    Integer MARK_INVOKESTATIC              = 0x2002;
+    Integer MARK_INVOKESPECIAL             = 0x2003;
+    Integer MARK_INVOKEVIRTUAL             = 0x2004;
+    Integer MARK_INLINE_INVOKEVIRTUAL      = 0x2005;
+    Integer MARK_IMPLICIT_NULL             = 0x3000;
+    Integer MARK_POLL_NEAR                 = 0x3001;
+    Integer MARK_POLL_RETURN_NEAR          = 0x3002;
+    Integer MARK_POLL_FAR                  = 0x3003;
+    Integer MARK_POLL_RETURN_FAR           = 0x3004;
+
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Sun Sep 30 13:21:20 2012 +0200
@@ -39,7 +39,6 @@
 import com.oracle.graal.hotspot.counters.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.snippets.*;
-import com.oracle.graal.hotspot.target.amd64.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.snippets.*;
 import com.oracle.max.criutils.*;
@@ -288,7 +287,6 @@
         }
         CompilationStatistics.clear("final");
         MethodEntryCounters.printCounters(graalRuntime);
-        HotSpotXirGenerator.printCounters(TTY.out().out());
         SnippetCounter.printGroups(TTY.out().out());
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Sun Sep 30 13:21:20 2012 +0200
@@ -38,9 +38,9 @@
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
+import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.snippets.*;
-import com.oracle.graal.hotspot.target.amd64.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
@@ -149,7 +149,7 @@
      * Decodes a mark to a mnemonic if possible.
      */
     private static String getMarkName(Mark mark) {
-        Field[] fields = HotSpotXirGenerator.class.getDeclaredFields();
+        Field[] fields = Marks.class.getDeclaredFields();
         for (Field f : fields) {
             if (Modifier.isStatic(f.getModifiers()) && f.getName().startsWith("MARK_")) {
                 f.setAccessible(true);
@@ -237,7 +237,7 @@
             graph.replaceFixedWithFixed(arrayLengthNode, safeReadArrayLength);
         } else if (n instanceof Invoke) {
             Invoke invoke = (Invoke) n;
-            if (!GraalOptions.XIRLowerInvokes && invoke.callTarget() instanceof MethodCallTargetNode) {
+            if (invoke.callTarget() instanceof MethodCallTargetNode) {
                 MethodCallTargetNode callTarget = invoke.methodCallTarget();
                 NodeInputList<ValueNode> parameters = callTarget.arguments();
                 ValueNode receiver = parameters.size() <= 0 ? null : parameters.get(0);
@@ -410,29 +410,17 @@
             FloatingReadNode hub = graph.add(new FloatingReadNode(object, LocationNode.create(LocationNode.FINAL_LOCATION, Kind.Object, config.hubOffset, graph), null, StampFactory.objectNonNull(), guard));
             graph.replaceFloating(loadHub, hub);
         } else if (n instanceof CheckCastNode) {
-            if (matches(graph, GraalOptions.HIRLowerCheckcast)) {
-                checkcastSnippets.lower((CheckCastNode) n, tool);
-            }
+            checkcastSnippets.lower((CheckCastNode) n, tool);
         } else if (n instanceof InstanceOfNode) {
-            if (matches(graph, GraalOptions.HIRLowerInstanceOf)) {
-                instanceofSnippets.lower((InstanceOfNode) n, tool);
-            }
+            instanceofSnippets.lower((InstanceOfNode) n, tool);
         } else if (n instanceof NewInstanceNode) {
-            if (matches(graph, GraalOptions.HIRLowerNewInstance)) {
-                newObjectSnippets.lower((NewInstanceNode) n, tool);
-            }
+            newObjectSnippets.lower((NewInstanceNode) n, tool);
         } else if (n instanceof NewArrayNode) {
-            if (matches(graph, GraalOptions.HIRLowerNewArray)) {
-                newObjectSnippets.lower((NewArrayNode) n, tool);
-            }
+            newObjectSnippets.lower((NewArrayNode) n, tool);
         } else if (n instanceof MonitorEnterNode) {
-            if (matches(graph, GraalOptions.HIRLowerMonitors)) {
-                monitorSnippets.lower((MonitorEnterNode) n, tool);
-            }
+            monitorSnippets.lower((MonitorEnterNode) n, tool);
         } else if (n instanceof MonitorExitNode) {
-            if (matches(graph, GraalOptions.HIRLowerMonitors)) {
-                monitorSnippets.lower((MonitorExitNode) n, tool);
-            }
+            monitorSnippets.lower((MonitorExitNode) n, tool);
         } else if (n instanceof TLABAllocateNode) {
             newObjectSnippets.lower((TLABAllocateNode) n, tool);
         } else if (n instanceof InitializeObjectNode) {
@@ -440,25 +428,12 @@
         } else if (n instanceof InitializeArrayNode) {
             newObjectSnippets.lower((InitializeArrayNode) n, tool);
         } else if (n instanceof NewMultiArrayNode) {
-            if (matches(graph, GraalOptions.HIRLowerNewMultiArray)) {
-                newObjectSnippets.lower((NewMultiArrayNode) n, tool);
-            }
+            newObjectSnippets.lower((NewMultiArrayNode) n, tool);
         } else {
             assert false : "Node implementing Lowerable not handled: " + n;
         }
     }
 
-    private static boolean matches(StructuredGraph graph, String filter) {
-        if (filter != null) {
-            if (filter.length() == 0) {
-                return true;
-            }
-            ResolvedJavaMethod method = graph.method();
-            return method != null && MetaUtil.format("%H.%n", method).contains(filter);
-        }
-        return false;
-    }
-
     private static IndexedLocationNode createArrayLocation(Graph graph, Kind elementKind, ValueNode index) {
         return IndexedLocationNode.create(LocationNode.getArrayLocation(elementKind), elementKind, elementKind.getArrayBaseOffset(), index, graph, true);
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64DirectCallOp.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64DirectCallOp.java	Sun Sep 30 13:21:20 2012 +0200
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.hotspot.target.amd64;
 
-import static com.oracle.graal.hotspot.target.amd64.HotSpotAMD64Backend.*;
 import static com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind.*;
 
 import com.oracle.graal.api.code.CompilationResult.Mark;
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.*;
 import com.oracle.graal.lir.amd64.*;
@@ -70,7 +70,7 @@
                 @Override
                 public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
                     assert callsiteMark != null : "static call site has not yet been emitted";
-                    tasm.recordMark(MARK_STATIC_CALL_STUB, callsiteMark);
+                    tasm.recordMark(Marks.MARK_STATIC_CALL_STUB, callsiteMark);
                     masm.movq(AMD64.rbx, 0L);
                     Label dummy = new Label();
                     masm.jmp(dummy);
@@ -84,13 +84,13 @@
     @Override
     public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
         if (invokeKind == Static || invokeKind == Special) {
-            tasm.recordMark(invokeKind == Static ? MARK_INVOKESTATIC : MARK_INVOKESPECIAL);
+            tasm.recordMark(invokeKind == Static ? Marks.MARK_INVOKESTATIC : Marks.MARK_INVOKESPECIAL);
         } else {
             assert invokeKind == Virtual || invokeKind == Interface;
             // The mark for an invocation that uses an inline cache must be placed at the instruction
             // that loads the klassOop from the inline cache so that the C++ code can find it
             // and replace the inline null value with Universe::non_oop_word()
-            tasm.recordMark(invokeKind == Virtual ? MARK_INVOKEVIRTUAL : MARK_INVOKEINTERFACE);
+            tasm.recordMark(invokeKind == Virtual ? Marks.MARK_INVOKEVIRTUAL : Marks.MARK_INVOKEINTERFACE);
             AMD64Move.move(tasm, masm, AMD64.rax.asValue(Kind.Object), Constant.NULL_OBJECT);
         }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64IndirectCallOp.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64IndirectCallOp.java	Sun Sep 30 13:21:20 2012 +0200
@@ -23,11 +23,11 @@
 package com.oracle.graal.hotspot.target.amd64;
 
 import static com.oracle.graal.api.code.ValueUtil.*;
-import static com.oracle.graal.hotspot.target.amd64.HotSpotAMD64Backend.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.Opcode;
 import com.oracle.graal.lir.amd64.*;
@@ -58,7 +58,7 @@
 
     @Override
     public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-        tasm.recordMark(MARK_INLINE_INVOKEVIRTUAL);
+        tasm.recordMark(Marks.MARK_INLINE_INVOKEVIRTUAL);
         Register callReg = asRegister(targetAddress);
         assert callReg != METHOD_OOP;
         AMD64Call.indirectCall(tasm, masm, callReg, targetMethod, state);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64SafepointOp.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64SafepointOp.java	Sun Sep 30 13:21:20 2012 +0200
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.hotspot.target.amd64;
 
-import static com.oracle.graal.hotspot.target.amd64.HotSpotAMD64Backend.*;
 import static com.oracle.max.asm.target.amd64.AMD64.*;
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.hotspot.*;
+import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.Opcode;
 import com.oracle.graal.lir.amd64.*;
@@ -53,11 +53,11 @@
         int pos = asm.codeBuffer.position();
         if (config.isPollingPageFar) {
             asm.movq(scratch, config.safepointPollingAddress);
-            tasm.recordMark(MARK_POLL_FAR);
+            tasm.recordMark(Marks.MARK_POLL_FAR);
             tasm.recordSafepoint(pos, state);
             asm.movq(scratch, new Address(tasm.target.wordKind, scratch.asValue()));
         } else {
-            tasm.recordMark(MARK_POLL_NEAR);
+            tasm.recordMark(Marks.MARK_POLL_NEAR);
             tasm.recordSafepoint(pos, state);
             asm.movq(scratch, new Address(tasm.target.wordKind, rip.asValue()));
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java	Sun Sep 30 13:21:20 2012 +0200
@@ -37,6 +37,7 @@
 import com.oracle.graal.compiler.target.amd64.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
+import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.counters.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
@@ -48,56 +49,25 @@
 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.xir.*;
 
 /**
  * HotSpot AMD64 specific backend.
  */
 public class HotSpotAMD64Backend extends Backend {
 
-    // this needs to correspond to graal_CodeInstaller.hpp
-    // @formatter:off
-    public static final Integer MARK_VERIFIED_ENTRY            = 0x0001;
-    public static final Integer MARK_UNVERIFIED_ENTRY          = 0x0002;
-    public static final Integer MARK_OSR_ENTRY                 = 0x0003;
-    public static final Integer MARK_UNWIND_ENTRY              = 0x0004;
-    public static final Integer MARK_EXCEPTION_HANDLER_ENTRY   = 0x0005;
-    public static final Integer MARK_DEOPT_HANDLER_ENTRY       = 0x0006;
-
-    public static final Integer MARK_STATIC_CALL_STUB          = 0x1000;
-
-    public static final Integer MARK_INVOKEINTERFACE           = 0x2001;
-    public static final Integer MARK_INVOKESTATIC              = 0x2002;
-    public static final Integer MARK_INVOKESPECIAL             = 0x2003;
-    public static final Integer MARK_INVOKEVIRTUAL             = 0x2004;
-    public static final Integer MARK_INLINE_INVOKEVIRTUAL      = 0x2005;
-
-    public static final Integer MARK_IMPLICIT_NULL             = 0x3000;
-    public static final Integer MARK_POLL_NEAR                 = 0x3001;
-    public static final Integer MARK_POLL_RETURN_NEAR          = 0x3002;
-    public static final Integer MARK_POLL_FAR                  = 0x3003;
-    public static final Integer MARK_POLL_RETURN_FAR           = 0x3004;
-
-    // @formatter:on
     public HotSpotAMD64Backend(CodeCacheProvider runtime, TargetDescription target) {
         super(runtime, target);
     }
 
     @Override
-    public LIRGenerator newLIRGenerator(Graph graph, FrameMap frameMap, ResolvedJavaMethod method, LIR lir, XirGenerator xir, Assumptions assumptions) {
-        return new HotSpotAMD64LIRGenerator(graph, runtime, target, frameMap, method, lir, xir, assumptions);
-    }
-
-    @Override
-    public AMD64XirAssembler newXirAssembler() {
-        return new AMD64XirAssembler(target);
+    public LIRGenerator newLIRGenerator(Graph graph, FrameMap frameMap, ResolvedJavaMethod method, LIR lir) {
+        return new HotSpotAMD64LIRGenerator(graph, runtime, target, frameMap, method, lir);
     }
 
     static final class HotSpotAMD64LIRGenerator extends AMD64LIRGenerator {
 
-        private HotSpotAMD64LIRGenerator(Graph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, LIR lir, XirGenerator xir,
-                        Assumptions assumptions) {
-            super(graph, runtime, target, frameMap, method, lir, xir, assumptions);
+        private HotSpotAMD64LIRGenerator(Graph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, LIR lir) {
+            super(graph, runtime, target, frameMap, method, lir);
         }
 
         @Override
@@ -206,10 +176,10 @@
                 Register scratch = regConfig.getScratchRegister();
                 if (config.isPollingPageFar) {
                     asm.movq(scratch, config.safepointPollingAddress);
-                    tasm.recordMark(MARK_POLL_RETURN_FAR);
+                    tasm.recordMark(Marks.MARK_POLL_RETURN_FAR);
                     asm.movq(scratch, new Address(tasm.target.wordKind, scratch.asValue()));
                 } else {
-                    tasm.recordMark(MARK_POLL_RETURN_NEAR);
+                    tasm.recordMark(Marks.MARK_POLL_RETURN_NEAR);
                     asm.movq(scratch, new Address(tasm.target.wordKind, rip.asValue()));
                 }
             }
@@ -246,11 +216,11 @@
         Label unverifiedStub = new Label();
 
         // Emit the prefix
-        tasm.recordMark(MARK_OSR_ENTRY);
+        tasm.recordMark(Marks.MARK_OSR_ENTRY);
 
         boolean isStatic = Modifier.isStatic(method.accessFlags());
         if (!isStatic) {
-            tasm.recordMark(MARK_UNVERIFIED_ENTRY);
+            tasm.recordMark(Marks.MARK_UNVERIFIED_ENTRY);
             CallingConvention cc = regConfig.getCallingConvention(JavaCallee, new Kind[] {Kind.Object}, target, false);
             Register inlineCacheKlass = rax; // see definition of IC_Klass in c1_LIRAssembler_x86.cpp
             Register receiver = asRegister(cc.locations[0]);
@@ -261,18 +231,18 @@
         }
 
         asm.align(config.codeEntryAlignment);
-        tasm.recordMark(MARK_VERIFIED_ENTRY);
+        tasm.recordMark(Marks.MARK_VERIFIED_ENTRY);
 
         // Emit code for the LIR
         lir.emitCode(tasm);
 
         boolean frameOmitted = tasm.frameContext == null;
         if (!frameOmitted) {
-            tasm.recordMark(MARK_EXCEPTION_HANDLER_ENTRY);
+            tasm.recordMark(Marks.MARK_EXCEPTION_HANDLER_ENTRY);
             AMD64Call.directCall(tasm, asm, config.handleExceptionStub, null);
             AMD64Call.shouldNotReachHere(tasm, asm);
 
-            tasm.recordMark(MARK_DEOPT_HANDLER_ENTRY);
+            tasm.recordMark(Marks.MARK_DEOPT_HANDLER_ENTRY);
             AMD64Call.directCall(tasm, asm, config.handleDeoptStub, null);
             AMD64Call.shouldNotReachHere(tasm, asm);
         } else {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotXirGenerator.java	Sun Sep 30 13:19:38 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1029 +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.graal.hotspot.target.amd64;
-
-import static com.oracle.graal.api.code.ValueUtil.*;
-import static com.oracle.graal.hotspot.target.amd64.TemplateFlag.*;
-import static com.oracle.graal.hotspot.target.amd64.HotSpotAMD64Backend.*;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-import sun.misc.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.Address.*;
-import com.oracle.graal.api.code.Register.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.meta.*;
-import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.xir.*;
-import com.oracle.max.cri.xir.XirAssembler.XirConstant;
-import com.oracle.max.cri.xir.XirAssembler.XirLabel;
-import com.oracle.max.cri.xir.XirAssembler.XirMark;
-import com.oracle.max.cri.xir.XirAssembler.XirOperand;
-import com.oracle.max.cri.xir.XirAssembler.XirParameter;
-
-public class HotSpotXirGenerator implements XirGenerator {
-
-    private final HotSpotVMConfig config;
-    private final TargetDescription target;
-    private final RegisterConfig registerConfig;
-    private final HotSpotGraalRuntime compiler;
-
-
-    private XirAssembler globalAsm;
-
-    public HotSpotXirGenerator(HotSpotVMConfig config, TargetDescription target, RegisterConfig registerConfig, HotSpotGraalRuntime compiler) {
-        this.config = config;
-        this.target = target;
-        this.registerConfig = registerConfig;
-        this.compiler = compiler;
-    }
-
-    private XirConstant wordConst(XirAssembler asm, long value) {
-        if (target.wordKind == Kind.Long) {
-            return asm.createConstant(Constant.forLong(value));
-        } else {
-            assert target.wordKind == Kind.Int;
-            return asm.createConstant(Constant.forInt((int) value));
-        }
-    }
-
-    private XirArgument wordArg(long value) {
-        if (target.wordKind == Kind.Long) {
-            return XirArgument.forLong(value);
-        } else {
-            assert target.wordKind == Kind.Int;
-            return XirArgument.forInt((int) value);
-        }
-    }
-
-    private SimpleTemplates invokeInterfaceTemplates = new SimpleTemplates(NULL_CHECK) {
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags) {
-            asm.restart();
-            XirParameter receiver = asm.createInputParameter("receiver", Kind.Object);
-            XirParameter addr = asm.createConstantInputParameter("addr", target.wordKind);
-            XirOperand temp = asm.createRegisterTemp("temp", target.wordKind, AMD64.rax);
-            XirOperand tempO = asm.createRegister("tempO", Kind.Object, AMD64.rax);
-
-            if (is(NULL_CHECK, flags)) {
-                asm.mark(MARK_IMPLICIT_NULL);
-                asm.pload(target.wordKind, temp, receiver, true);
-            }
-            asm.mark(MARK_INVOKEINTERFACE);
-            // Initialize the klassOop slot of an inline cache with null - the C++ Graal code will convert this to Universe::non_oop_word()
-            asm.mov(tempO, asm.createConstant(Constant.NULL_OBJECT));
-
-            return asm.finishTemplate(addr, "invokeinterface");
-        }
-    };
-
-    private SimpleTemplates invokeVirtualTemplates = new SimpleTemplates(NULL_CHECK) {
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags) {
-            asm.restart();
-            XirParameter receiver = asm.createInputParameter("receiver", Kind.Object);
-            XirParameter addr = asm.createConstantInputParameter("addr", target.wordKind);
-            XirOperand temp = asm.createRegisterTemp("temp", target.wordKind, AMD64.rax);
-            XirOperand tempO = asm.createRegister("tempO", Kind.Object, AMD64.rax);
-
-            if (is(NULL_CHECK, flags)) {
-                asm.mark(MARK_IMPLICIT_NULL);
-                asm.pload(target.wordKind, temp, receiver, true);
-            }
-            asm.mark(MARK_INVOKEVIRTUAL);
-            // Initialize the klassOop slot of an inline cache with null - the C++ Graal code will convert this to Universe::non_oop_word()
-            asm.mov(tempO, asm.createConstant(Constant.NULL_OBJECT));
-
-            return asm.finishTemplate(addr, "invokevirtual");
-        }
-    };
-
-    private IndexTemplates inlinedInvokeVirtualTemplates = new IndexTemplates(NULL_CHECK) {
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags, int vtableEntryOffset) {
-            asm.restart();
-            XirParameter receiver = asm.createInputParameter("receiver", Kind.Object);
-            XirOperand temp = asm.createRegisterTemp("temp", target.wordKind, AMD64.rax);
-            XirOperand method = asm.createRegisterTemp("method", Kind.Object, AMD64.rbx);
-
-            // load class from receiver
-            if (is(NULL_CHECK, flags)) {
-                asm.mark(MARK_IMPLICIT_NULL);
-            }
-            asm.pload(target.wordKind, temp, receiver, asm.i(config.hubOffset), true);
-            // load vtable entry
-            asm.pload(target.wordKind, method, temp, asm.i(vtableEntryOffset), false);
-            // load entry point from methodOop
-            asm.mark(MARK_IMPLICIT_NULL);
-            asm.pload(target.wordKind, temp, method, asm.i(config.methodCompiledEntryOffset), true);
-            asm.mark(MARK_INLINE_INVOKEVIRTUAL);
-
-            return asm.finishTemplate(temp, "invokevirtual");
-        }
-    };
-
-    private SimpleTemplates invokeSpecialTemplates = new SimpleTemplates(NULL_CHECK) {
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags) {
-            asm.restart();
-            XirParameter receiver = asm.createInputParameter("receiver", Kind.Object);
-            XirParameter addr = asm.createConstantInputParameter("addr", target.wordKind);
-            XirOperand temp = asm.createRegisterTemp("temp", target.wordKind, AMD64.rax);
-            XirLabel stub = asm.createOutOfLineLabel("call stub");
-
-            if (is(NULL_CHECK, flags)) {
-                asm.mark(MARK_IMPLICIT_NULL);
-                asm.pload(target.wordKind, temp, receiver, true);
-            }
-            asm.mark(MARK_INVOKESPECIAL);
-
-            // -- out of line -------------------------------------------------------
-            asm.bindOutOfLine(stub);
-            XirOperand method = asm.createRegisterTemp("method", target.wordKind, AMD64.rbx);
-            asm.mark(MARK_STATIC_CALL_STUB, XirMark.CALLSITE);
-            asm.mov(method, wordConst(asm, 0));
-            XirLabel dummy = asm.createOutOfLineLabel("dummy");
-            asm.jmp(dummy);
-            asm.bindOutOfLine(dummy);
-
-            return asm.finishTemplate(addr, "invokespecial");
-        }
-    };
-
-    private SimpleTemplates invokeStaticTemplates = new SimpleTemplates() {
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags) {
-            asm.restart();
-            XirParameter addr = asm.createConstantInputParameter("addr", target.wordKind);
-
-            XirLabel stub = asm.createOutOfLineLabel("call stub");
-            asm.mark(MARK_INVOKESTATIC);
-
-            // -- out of line -------------------------------------------------------
-            asm.bindOutOfLine(stub);
-            XirOperand method = asm.createRegisterTemp("method", target.wordKind, AMD64.rbx);
-            asm.mark(MARK_STATIC_CALL_STUB, XirMark.CALLSITE);
-            asm.mov(method, wordConst(asm, 0));
-            XirLabel dummy = asm.createOutOfLineLabel("dummy");
-            asm.jmp(dummy);
-            asm.bindOutOfLine(dummy);
-
-            return asm.finishTemplate(addr, "invokestatic");
-        }
-    };
-
-    private SimpleTemplates monitorEnterTemplates = new SimpleTemplates(NULL_CHECK) {
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags) {
-            asm.restart(Kind.Void);
-            XirParameter object = asm.createInputParameter("object", Kind.Object);
-            XirParameter lock = asm.createInputParameter("lock", target.wordKind);
-
-            if (is(NULL_CHECK, flags)) {
-                asm.mark(MARK_IMPLICIT_NULL);
-                asm.pload(target.wordKind, asm.createTemp("temp", target.wordKind), object, true);
-            }
-
-
-            // (thomaswue) It is important to use for this runtime call the debug info AFTER the monitor enter. Otherwise the monitor object
-            // is not correctly garbage collected.
-            final boolean useInfoAfter = true;
-
-            if (config.useFastLocking) {
-                useRegisters(asm, AMD64.rax, AMD64.rbx);
-                useRegisters(asm, getGeneralParameterRegister(0));
-                useRegisters(asm, getGeneralParameterRegister(1));
-                asm.callRuntime(config.fastMonitorEnterStub, null, useInfoAfter, object, lock);
-            } else {
-                asm.reserveOutgoingStack(target.wordSize * 2);
-                XirOperand rsp = asm.createRegister("rsp", target.wordKind, asRegister(AMD64.RSP));
-                asm.pstore(Kind.Object, rsp, asm.i(target.wordSize), object, false);
-                asm.pstore(target.wordKind, rsp, asm.i(0), lock, false);
-                asm.callRuntime(config.monitorEnterStub, null, useInfoAfter);
-            }
-
-            return asm.finishTemplate("monitorEnter");
-        }
-    };
-
-    private Register getGeneralParameterRegister(int index) {
-        return registerConfig.getCallingConventionRegisters(CallingConvention.Type.RuntimeCall, RegisterFlag.CPU)[index];
-    }
-
-    private SimpleTemplates monitorExitTemplates = new SimpleTemplates(NULL_CHECK) {
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags) {
-            asm.restart(Kind.Void);
-            XirParameter object = asm.createInputParameter("object", Kind.Object);
-            XirParameter lock = asm.createInputParameter("lock", target.wordKind);
-
-            if (config.useFastLocking) {
-                useRegisters(asm, AMD64.rax, AMD64.rbx);
-                useRegisters(asm, getGeneralParameterRegister(0));
-                useRegisters(asm, getGeneralParameterRegister(1));
-                asm.callRuntime(config.fastMonitorExitStub, null, object, lock);
-            } else {
-                asm.reserveOutgoingStack(target.wordSize);
-                asm.pstore(target.wordKind, asm.createRegister("rsp", target.wordKind, asRegister(AMD64.RSP)), asm.i(0), lock, false);
-                asm.callRuntime(config.monitorExitStub, null);
-            }
-
-            return asm.finishTemplate("monitorExit");
-        }
-    };
-
-    private final IndexTemplates newInstanceTemplates = new IndexTemplates() {
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags, int size) {
-            XirOperand result = asm.restart(target.wordKind);
-            XirOperand hub = asm.createInputParameter("hub", Kind.Object);
-
-            XirOperand temp1 = asm.createRegisterTemp("temp1", target.wordKind, AMD64.rcx);
-            XirOperand temp1o = asm.createRegister("temp1o", Kind.Object, AMD64.rcx);
-            XirOperand temp2 = asm.createRegisterTemp("temp2", target.wordKind, AMD64.rbx);
-            XirOperand temp2i = asm.createRegister("temp2i", Kind.Int, AMD64.rbx);
-            useRegisters(asm, AMD64.rsi);
-            XirLabel tlabFull = asm.createOutOfLineLabel("tlab full");
-            XirLabel resume = asm.createInlineLabel("resume");
-
-            // check if the class is already initialized
-            asm.pload(Kind.Int, temp2i, hub, asm.i(config.klassStateOffset), false);
-            asm.jneq(tlabFull, temp2i, asm.i(config.klassStateFullyInitialized));
-
-            XirOperand thread = asm.createRegisterTemp("thread", target.wordKind, config.threadRegister);
-            asm.pload(target.wordKind, result, thread, asm.i(config.threadTlabTopOffset), false);
-            asm.add(temp1, result, wordConst(asm, size));
-            asm.pload(target.wordKind, temp2, thread, asm.i(config.threadTlabEndOffset), false);
-
-            asm.jgt(tlabFull, temp1, temp2);
-            asm.pstore(target.wordKind, thread, asm.i(config.threadTlabTopOffset), temp1, false);
-
-            asm.bindInline(resume);
-
-            asm.pload(target.wordKind, temp1, hub, asm.i(config.prototypeMarkWordOffset), false);
-            asm.pstore(target.wordKind, result, asm.i(config.markOffset), temp1, false);
-            asm.mov(temp1o, hub); // need a temporary register since Intel cannot store 64-bit constants to memory
-            asm.pstore(Kind.Object, result, asm.i(config.hubOffset), temp1o, false);
-
-            if (size > 2 * target.wordSize) {
-                asm.mov(temp1, wordConst(asm, 0));
-                for (int offset = 2 * target.wordSize; offset < size; offset += target.wordSize) {
-                    asm.pstore(target.wordKind, result, asm.i(offset), temp1, false);
-                }
-            }
-
-            // -- out of line -------------------------------------------------------
-            asm.bindOutOfLine(tlabFull);
-            XirOperand arg = asm.createRegisterTemp("runtime call argument", Kind.Object, AMD64.rdx);
-            asm.mov(arg, hub);
-            useRegisters(asm, AMD64.rax);
-            asm.callRuntime(config.newInstanceStub, result);
-            asm.jmp(resume);
-
-            return asm.finishTemplate("new instance");
-        }
-    };
-
-    private SimpleTemplates newObjectArrayTemplates = new SimpleTemplates() {
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags) {
-            emitNewTypeArray(asm, Kind.Object, config.useFastNewObjectArray, config.newObjectArrayStub);
-            return asm.finishTemplate("newObjectArray");
-        }
-    };
-
-    private void emitNewTypeArray(XirAssembler asm, Kind kind, boolean useFast, long slowPathStub) {
-        XirOperand result = asm.restart(target.wordKind);
-
-        XirParameter lengthParam = asm.createInputParameter("length", Kind.Int, true);
-
-        XirOperand length = asm.createRegisterTemp("length", Kind.Int, AMD64.rbx);
-        XirOperand hub = asm.createRegisterTemp("hub", Kind.Object, AMD64.rdx);
-
-        // Registers rsi, rcx, rdi, and rax are needed by the runtime call.
-        // Hub needs to be on rdx, length on rbx.
-        XirOperand temp1 = asm.createRegisterTemp("temp1", target.wordKind, AMD64.rcx);
-        XirOperand temp1o = asm.createRegister("temp1o", Kind.Object, AMD64.rcx);
-        XirOperand temp2 = asm.createRegisterTemp("temp2", target.wordKind, AMD64.rax);
-        XirOperand temp3 = asm.createRegisterTemp("temp3", target.wordKind, AMD64.rdi);
-        XirOperand size = asm.createRegisterTemp("size", Kind.Int, AMD64.rsi);
-
-        asm.mov(hub, asm.createConstantInputParameter("hub", Kind.Object));
-        asm.mov(length, lengthParam);
-
-        if (useFast) {
-
-            XirLabel slowPath = asm.createOutOfLineLabel("slowPath");
-
-            XirLabel done = asm.createInlineLabel("done");
-
-            // Check for negative array size.
-            // TODO: Also check for upper bound
-            asm.jlt(slowPath, length, asm.i(0));
-
-            final int aligning = target.wordSize;
-            final int arrayLengthOffset = target.wordSize * 2;
-            final int arrayElementOffset = kind.getArrayBaseOffset();
-
-            // Calculate aligned size
-            asm.mov(size, length);
-            int scale = CodeUtil.log2(target.sizeInBytes(kind));
-            if (scale != 0) {
-                asm.shl(size, size, asm.i(scale));
-            }
-            asm.add(size, size, asm.i(arrayElementOffset + aligning - 1));
-            long mask = 0xFFFFFFFFL;
-            mask <<= CodeUtil.log2(aligning);
-            asm.and(size, size, asm.i((int) mask));
-
-            // Try tlab allocation
-            XirOperand thread = asm.createRegisterTemp("thread", target.wordKind, config.threadRegister);
-            asm.pload(target.wordKind, result, thread, asm.i(config.threadTlabTopOffset), false);
-            asm.add(temp1, result, size);
-            asm.pload(target.wordKind, temp2, thread, asm.i(config.threadTlabEndOffset), false);
-            asm.jgt(slowPath, temp1, temp2);
-            asm.pstore(target.wordKind, thread, asm.i(config.threadTlabTopOffset), temp1, false);
-
-            // Now the new object is in result, store mark word and klass
-            asm.pload(target.wordKind, temp1, hub, asm.i(config.prototypeMarkWordOffset), false);
-            asm.pstore(target.wordKind, result, asm.i(config.markOffset), temp1, false);
-            asm.mov(temp1o, hub); // need a temporary register since Intel cannot store 64-bit constants to memory
-            asm.pstore(Kind.Object, result, asm.i(config.hubOffset), temp1o, false);
-
-            // Store array length
-            asm.pstore(Kind.Int, result, asm.i(arrayLengthOffset), length, false);
-
-            // Initialize with 0
-            XirLabel top = asm.createInlineLabel("top");
-            asm.sub(size, size, asm.i(arrayElementOffset));
-            asm.shr(size, size, asm.i(Scale.Times8.log2));
-            asm.jeq(done, size, asm.i(0));
-            asm.xor(temp3, temp3, temp3);
-            asm.bindInline(top);
-            asm.pstore(target.wordKind, result, size, temp3, arrayElementOffset - target.wordSize, Scale.Times8, false);
-            asm.decAndJumpNotZero(top, size);
-
-            asm.bindInline(done);
-
-            // Slow path
-            asm.bindOutOfLine(slowPath);
-            asm.callRuntime(slowPathStub, result);
-            asm.jmp(done);
-        } else {
-            asm.callRuntime(slowPathStub, result);
-        }
-    }
-
-    private KindTemplates newTypeArrayTemplates = new KindTemplates() {
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags, Kind kind) {
-            emitNewTypeArray(asm, kind, config.useFastNewTypeArray, config.newTypeArrayStub);
-            return asm.finishTemplate("newTypeArray<" + kind.toString() + ">");
-        }
-    };
-
-    private final IndexTemplates multiNewArrayTemplate = new IndexTemplates() {
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags, int dimensions) {
-            XirOperand result = asm.restart(Kind.Object);
-
-            XirOperand hub = asm.createRegisterTemp("hub", Kind.Object, AMD64.rax);
-            XirOperand rank = asm.createRegisterTemp("rank", Kind.Int, AMD64.rbx);
-            XirOperand sizes = asm.createRegisterTemp("sizes", Kind.Long, AMD64.rcx);
-            XirOperand thread = asm.createRegisterTemp("thread", Kind.Long, config.threadRegister);
-            asm.add(sizes, thread, asm.l(config.threadMultiNewArrayStorageOffset));
-            for (int i = 0; i < dimensions; i++) {
-                XirParameter length = asm.createInputParameter("length" + i, Kind.Int, true);
-                asm.pstore(Kind.Int, sizes, asm.i(i * target.sizeInBytes(Kind.Int)), length, false);
-            }
-
-            asm.mov(hub, asm.createConstantInputParameter("hub", Kind.Object));
-
-            asm.mov(rank, asm.i(dimensions));
-            // not necessary because we already have a temp in rax:  useRegisters(asm, AMD64.rax);
-            asm.callRuntime(config.newMultiArrayStub, result);
-            return asm.finishTemplate("multiNewArray" + dimensions);
-        }
-    };
-
-    enum CheckcastCounter {
-        hintsHit("hit a hint type"),
-        hintsMissed("missed the hint types"),
-        exact("tested type is (statically) final"),
-        noHints_class("profile information is not used (test type is a class)"),
-        noHints_iface("profile information is not used (test type is an interface)"),
-        noHints_unknown("test type is not a compile-time constant"),
-        isNull("object tested is null"),
-        exception("type test failed with a ClassCastException");
-
-        public final String desc;
-
-        private CheckcastCounter(String desc) {
-            this.desc = desc;
-        }
-
-        static final CheckcastCounter[] VALUES = values();
-    }
-
-    private static final long[] checkcastCounters = new long[CheckcastCounter.VALUES.length];
-
-    private IndexTemplates checkCastTemplates = new IndexTemplates(NULL_CHECK, EXACT_HINTS) {
-
-        private void incCounter(XirAssembler asm, XirOperand counter, XirParameter counters, CheckcastCounter offset) {
-            int disp = Unsafe.getUnsafe().arrayBaseOffset(long[].class);
-            Scale scale = Scale.fromInt(Unsafe.getUnsafe().arrayIndexScale(long[].class));
-            XirConstant index = asm.i(offset.ordinal());
-            asm.pload(Kind.Long, counter, counters, index, disp, scale, false);
-            asm.add(counter, counter, asm.i(1));
-            asm.pstore(Kind.Long, counters, index, counter, disp, scale, false);
-        }
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags, int hintCount) {
-            asm.restart(Kind.Void);
-            boolean exact = is(EXACT_HINTS, flags);
-            XirParameter counters = GraalOptions.SnippetCounters ? asm.createConstantInputParameter("counters", Kind.Object) : null;
-            XirParameter object = asm.createInputParameter("object", Kind.Object);
-            final XirOperand hub = exact ? null : asm.createConstantInputParameter("hub", Kind.Object);
-
-            XirOperand objHub = asm.createTemp("objHub", Kind.Object);
-            XirOperand counter = counters != null ? asm.createTemp("counter", Kind.Long) : null;
-
-            XirLabel success = asm.createInlineLabel("success");
-            XirLabel slowPath = asm.createOutOfLineLabel("slow path");
-
-            if (is(NULL_CHECK, flags)) {
-                // null can be cast to anything
-                if (counters != null) {
-                    XirLabel isNotNull = asm.createInlineLabel("isNull");
-                    asm.jneq(isNotNull, object, asm.o(null));
-                    incCounter(asm, counter, counters, CheckcastCounter.isNull);
-                    asm.jmp(success);
-                    asm.bindInline(isNotNull);
-                } else {
-                    asm.jeq(success, object, asm.o(null));
-                }
-
-            }
-
-            asm.pload(Kind.Object, objHub, object, asm.i(config.hubOffset), false);
-            if (hintCount == 0) {
-                assert !exact;
-                if (counters != null) {
-                    CheckcastCounter cc;
-                    if (is(NULL_TYPE, flags)) {
-                        cc = CheckcastCounter.noHints_unknown;
-                    } else if (is(INTERFACE_TYPE, flags)) {
-                        cc = CheckcastCounter.noHints_iface;
-                    } else {
-                        cc = CheckcastCounter.noHints_class;
-                    }
-                    incCounter(asm, counter, counters, cc);
-                }
-
-                checkSubtype(asm, objHub, objHub, hub);
-                asm.jeq(slowPath, objHub, asm.o(null));
-                asm.bindInline(success);
-
-                // -- out of line -------------------------------------------------------
-                asm.bindOutOfLine(slowPath);
-            } else {
-                XirLabel hintsSuccess = counters == null ? success : asm.createInlineLabel("hintsSuccess");
-                XirOperand scratchObject = asm.createRegisterTemp("scratch", Kind.Object, AMD64.r10);
-                // if we get an exact match: succeed immediately
-                for (int i = 0; i < hintCount; i++) {
-                    XirParameter hintHub = asm.createConstantInputParameter("hintHub" + i, Kind.Object);
-                    asm.mov(scratchObject, hintHub);
-                    if (i < hintCount - 1) {
-                        asm.jeq(hintsSuccess, objHub, scratchObject);
-                    } else {
-                        asm.jneq(slowPath, objHub, scratchObject);
-                    }
-                }
-
-                if (counters != null) {
-                    asm.bindInline(hintsSuccess);
-                    incCounter(asm, counter, counters, exact ? CheckcastCounter.exact : CheckcastCounter.hintsHit);
-                }
-
-                asm.bindInline(success);
-
-                // -- out of line -------------------------------------------------------
-                asm.bindOutOfLine(slowPath);
-                if (!exact) {
-                    if (counters != null) {
-                        incCounter(asm, counter, counters, CheckcastCounter.hintsMissed);
-                    }
-                    checkSubtype(asm, objHub, objHub, hub);
-                    asm.jneq(success, objHub, asm.o(null));
-                }
-            }
-
-            if (counters != null) {
-                incCounter(asm, counter, counters, CheckcastCounter.exception);
-            }
-            DeoptimizationReason deoptReason = exact ? DeoptimizationReason.OptimizedTypeCheckViolated : DeoptimizationReason.ClassCastException;
-            XirOperand scratch = asm.createRegisterTemp("scratch", target.wordKind, AMD64.r10);
-            asm.mov(scratch, wordConst(asm, compiler.getRuntime().encodeDeoptActionAndReason(DeoptimizationAction.InvalidateReprofile, deoptReason)));
-            asm.callRuntime(RuntimeCall.Deoptimize, null);
-            asm.shouldNotReachHere();
-
-            return asm.finishTemplate("checkcast");
-        }
-    };
-
-    private IndexTemplates instanceOfTemplates = new IndexTemplates(NULL_CHECK, EXACT_HINTS) {
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags, int hintCount) {
-            asm.restart(Kind.Void);
-            XirParameter object = asm.createInputParameter("object", Kind.Object);
-            final XirOperand hub = is(EXACT_HINTS, flags) ? null : asm.createConstantInputParameter("hub", Kind.Object);
-
-            XirOperand objHub = asm.createTemp("objHub", Kind.Object);
-
-            XirLabel trueSucc = asm.createInlineLabel(XirLabel.TrueSuccessor);
-            XirLabel falseSucc = asm.createInlineLabel(XirLabel.FalseSuccessor);
-
-            if (is(NULL_CHECK, flags)) {
-                // null isn't "instanceof" anything
-                asm.jeq(falseSucc, object, asm.o(null));
-            }
-
-            asm.pload(Kind.Object, objHub, object, asm.i(config.hubOffset), false);
-            if (hintCount == 0) {
-                assert !is(EXACT_HINTS, flags);
-                checkSubtype(asm, objHub, objHub, hub);
-                asm.jeq(falseSucc, objHub, asm.o(null));
-                asm.jmp(trueSucc);
-            } else {
-                XirLabel slowPath = null;
-                XirOperand scratchObject = asm.createRegisterTemp("scratch", Kind.Object, AMD64.r10);
-
-                // if we get an exact match: succeed immediately
-                for (int i = 0; i < hintCount; i++) {
-                    XirParameter hintHub = asm.createConstantInputParameter("hintHub" + i, Kind.Object);
-                    asm.mov(scratchObject, hintHub);
-                    if (i < hintCount - 1) {
-                        asm.jeq(trueSucc, objHub, scratchObject);
-                    } else {
-                        if (is(EXACT_HINTS, flags)) {
-                            asm.jneq(falseSucc, objHub, scratchObject);
-                            asm.jmp(trueSucc);
-                        } else {
-                            slowPath = asm.createOutOfLineLabel("slow path");
-                            asm.jneq(slowPath, objHub, scratchObject);
-                            asm.jmp(trueSucc);
-                        }
-                    }
-                }
-
-                // -- out of line -------------------------------------------------------
-                if (slowPath != null) {
-                    asm.bindOutOfLine(slowPath);
-                    checkSubtype(asm, objHub, objHub, hub);
-                    asm.jeq(falseSucc, objHub, asm.o(null));
-                    asm.jmp(trueSucc);
-                }
-            }
-
-            return asm.finishTemplate("instanceof");
-        }
-    };
-
-    private IndexTemplates materializeInstanceOfTemplates = new IndexTemplates(NULL_CHECK, EXACT_HINTS) {
-
-        @Override
-        protected XirTemplate create(XirAssembler asm, long flags, int hintCount) {
-            XirOperand result = asm.restart(Kind.Int);
-            XirParameter object = asm.createInputParameter("object", Kind.Object);
-            final XirOperand hub = is(EXACT_HINTS, flags) ? null : asm.createConstantInputParameter("hub", Kind.Object);
-            XirOperand trueValue = asm.createInputParameter("trueValue", Kind.Int);
-            XirOperand falseValue = asm.createInputParameter("falseValue", Kind.Int);
-
-            XirOperand objHub = asm.createTemp("objHub", Kind.Object);
-
-            XirLabel end = asm.createInlineLabel("end");
-            XirLabel falseSucc = asm.createInlineLabel("ko");
-
-            if (is(NULL_CHECK, flags)) {
-                // null isn't "instanceof" anything
-                asm.jeq(falseSucc, object, asm.o(null));
-            }
-
-            asm.pload(Kind.Object, objHub, object, asm.i(config.hubOffset), false);
-            asm.mov(result, trueValue);
-
-            if (hintCount == 0) {
-                assert !is(EXACT_HINTS, flags);
-                checkSubtype(asm, objHub, objHub, hub);
-                asm.jneq(end, objHub, asm.o(null));
-                asm.bindInline(falseSucc);
-                asm.mov(result, falseValue);
-                asm.bindInline(end);
-            } else {
-                XirLabel slowPath = null;
-                XirOperand scratchObject = asm.createRegisterTemp("scratch", Kind.Object, AMD64.r10);
-
-                // if we get an exact match: succeed immediately
-                for (int i = 0; i < hintCount; i++) {
-                    XirParameter hintHub = asm.createConstantInputParameter("hintHub" + i, Kind.Object);
-                    asm.mov(scratchObject, hintHub);
-                    if (i < hintCount - 1) {
-                        asm.jeq(end, objHub, scratchObject);
-                    } else {
-                        if (is(EXACT_HINTS, flags)) {
-                            asm.jeq(end, objHub, scratchObject);
-                        } else {
-                            slowPath = asm.createOutOfLineLabel("slow path");
-                            asm.jeq(end, objHub, scratchObject);
-                            asm.jmp(slowPath);
-                        }
-                    }
-                }
-                asm.bindInline(falseSucc);
-                asm.mov(result, falseValue);
-                asm.bindInline(end);
-
-                // -- out of line -------------------------------------------------------
-                if (slowPath != null) {
-                    asm.bindOutOfLine(slowPath);
-                    checkSubtype(asm, objHub, objHub, hub);
-                    asm.jeq(falseSucc, objHub, asm.o(null));
-                    asm.jmp(end);
-                }
-            }
-
-            return asm.finishTemplate("instanceof");
-        }
-    };
-
-    private SimpleTemplates typeCheckTemplates = new SimpleTemplates(NULL_CHECK) {
-       @Override
-       protected XirTemplate create(XirAssembler asm, long flags) {
-           asm.restart(Kind.Void);
-           XirParameter objHub = asm.createInputParameter("objectHub", Kind.Object);
-           XirOperand hub = asm.createConstantInputParameter("hub", Kind.Object);
-           XirLabel falseSucc = asm.createInlineLabel(XirLabel.FalseSuccessor);
-
-           XirOperand checkHub = asm.createTemp("checkHub", Kind.Object);
-
-           if (is(NULL_CHECK, flags)) {
-               asm.mark(MARK_IMPLICIT_NULL);
-           }
-
-           asm.mov(checkHub, hub);
-           // if we get an exact match: continue.
-           asm.jneq(falseSucc, objHub, checkHub);
-
-           return asm.finishTemplate("typeCheck");
-       }
-    };
-
-    @Override
-    public XirSnippet genInvokeInterface(XirSite site, XirArgument receiver, JavaMethod method) {
-        return new XirSnippet(invokeInterfaceTemplates.get(site), receiver, wordArg(0));
-    }
-
-    @Override
-    public XirSnippet genInvokeVirtual(XirSite site, XirArgument receiver, JavaMethod method, boolean megamorph) {
-        int vtableEntryOffset = 0;
-
-        if (GraalOptions.InlineVTableStubs && (GraalOptions.AlwaysInlineVTableStubs || megamorph)) {
-            HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method;
-            if (!hsMethod.holder().isInterface()) {
-                vtableEntryOffset = hsMethod.vtableEntryOffset();
-            }
-        }
-        if (vtableEntryOffset > 0) {
-            return new XirSnippet(inlinedInvokeVirtualTemplates.get(site, vtableEntryOffset), receiver);
-        } else {
-            return new XirSnippet(invokeVirtualTemplates.get(site), receiver, wordArg(0));
-        }
-    }
-
-    @Override
-    public XirSnippet genInvokeSpecial(XirSite site, XirArgument receiver, JavaMethod method) {
-        return new XirSnippet(invokeSpecialTemplates.get(site), receiver, wordArg(0));
-    }
-
-    @Override
-    public XirSnippet genInvokeStatic(XirSite site, JavaMethod method) {
-        return new XirSnippet(invokeStaticTemplates.get(site), wordArg(0));
-    }
-
-    @Override
-    public XirSnippet genMonitorEnter(XirSite site, XirArgument receiver, XirArgument lockAddress) {
-        return new XirSnippet(monitorEnterTemplates.get(site), receiver, lockAddress);
-    }
-
-    @Override
-    public XirSnippet genMonitorExit(XirSite site, XirArgument receiver, XirArgument lockAddress) {
-        return new XirSnippet(monitorExitTemplates.get(site), receiver, lockAddress);
-    }
-
-    @Override
-    public XirSnippet genNewInstance(XirSite site, JavaType type) {
-        HotSpotResolvedJavaType resolvedType = (HotSpotResolvedJavaType) type;
-        int instanceSize = resolvedType.instanceSize();
-        assert instanceSize >= 0;
-        return new XirSnippet(newInstanceTemplates.get(site, instanceSize), XirArgument.forObject(resolvedType.klassOop()));
-    }
-
-    @Override
-    public XirSnippet genNewArray(XirSite site, XirArgument length, Kind elementKind, JavaType componentType, JavaType arrayType) {
-        if (elementKind == Kind.Object) {
-            assert arrayType instanceof ResolvedJavaType;
-            return new XirSnippet(newObjectArrayTemplates.get(site), length, XirArgument.forObject(((HotSpotJavaType) arrayType).klassOop()));
-        } else {
-            assert arrayType == null;
-            JavaType primitiveArrayType = compiler.getCompilerToVM().getPrimitiveArrayType(elementKind);
-            return new XirSnippet(newTypeArrayTemplates.get(site, elementKind), length, XirArgument.forObject(((HotSpotJavaType) primitiveArrayType).klassOop()));
-        }
-    }
-
-    @Override
-    public XirSnippet genNewMultiArray(XirSite site, XirArgument[] lengths, JavaType type) {
-        XirArgument[] params = Arrays.copyOf(lengths, lengths.length + 1);
-        params[lengths.length] = XirArgument.forObject(((HotSpotJavaType) type).klassOop());
-        return new XirSnippet(multiNewArrayTemplate.get(site, lengths.length), params);
-    }
-
-    @Override
-    public XirSnippet genCheckCast(XirSite site, XirArgument receiver, XirArgument hub, ResolvedJavaType type, JavaTypeProfile profile) {
-        final boolean useCounters = GraalOptions.SnippetCounters;
-        TypeCheckHints hints = new TypeCheckHints(type, profile, site.assumptions(), GraalOptions.CheckcastMinHintHitProbability, GraalOptions.CheckcastMaxHints);
-        int hintsLength = hints.types.length;
-        if (hintsLength == 0) {
-            if (useCounters) {
-                if (type == null) {
-                    return new XirSnippet(checkCastTemplates.get(site, 0, NULL_TYPE), XirArgument.forObject(checkcastCounters), receiver, hub);
-                } else if (type.isInterface()) {
-                    return new XirSnippet(checkCastTemplates.get(site, 0, INTERFACE_TYPE), XirArgument.forObject(checkcastCounters), receiver, hub);
-                } else {
-                    return new XirSnippet(checkCastTemplates.get(site, 0), XirArgument.forObject(checkcastCounters), receiver, hub);
-                }
-            } else {
-                return new XirSnippet(checkCastTemplates.get(site, 0), receiver, hub);
-            }
-        } else {
-            XirArgument[] params = new XirArgument[(useCounters ? 1 : 0) + hintsLength + (hints.exact ? 1 : 2)];
-            int i = 0;
-            if (useCounters) {
-                params[i++] = XirArgument.forObject(checkcastCounters);
-            }
-            params[i++] = receiver;
-            if (!hints.exact) {
-                params[i++] = hub;
-            }
-            for (ResolvedJavaType hint : hints.types) {
-                params[i++] = XirArgument.forObject(((HotSpotJavaType) hint).klassOop());
-            }
-            XirTemplate template = hints.exact ? checkCastTemplates.get(site, hintsLength, EXACT_HINTS) : checkCastTemplates.get(site, hintsLength);
-            return new XirSnippet(template, params);
-        }
-    }
-
-    @Override
-    public XirSnippet genInstanceOf(XirSite site, XirArgument object, XirArgument hub, ResolvedJavaType type, JavaTypeProfile profile) {
-        TypeCheckHints hints = new TypeCheckHints(type, profile, site.assumptions(), GraalOptions.InstanceOfMinHintHitProbability, GraalOptions.InstanceOfMaxHints);
-        int hintsLength = hints.types.length;
-        if (hintsLength == 0) {
-            return new XirSnippet(instanceOfTemplates.get(site, 0), object, hub);
-        } else {
-            XirArgument[] params = new XirArgument[hintsLength + (hints.exact ? 1 : 2)];
-            int i = 0;
-            params[i++] = object;
-            if (!hints.exact) {
-                params[i++] = hub;
-            }
-            for (ResolvedJavaType hint : hints.types) {
-                params[i++] = XirArgument.forObject(((HotSpotJavaType) hint).klassOop());
-            }
-            XirTemplate template = hints.exact ? instanceOfTemplates.get(site, hintsLength, EXACT_HINTS) : instanceOfTemplates.get(site, hintsLength);
-            return new XirSnippet(template, params);
-        }
-    }
-
-    @Override
-    public XirSnippet genMaterializeInstanceOf(XirSite site, XirArgument object, XirArgument hub, XirArgument trueValue, XirArgument falseValue, ResolvedJavaType type, JavaTypeProfile profile) {
-        TypeCheckHints hints = new TypeCheckHints(type, profile, site.assumptions(), GraalOptions.InstanceOfMinHintHitProbability, GraalOptions.InstanceOfMaxHints);
-        int hintsLength = hints.types.length;
-        if (hintsLength == 0) {
-            return new XirSnippet(materializeInstanceOfTemplates.get(site, 0), object, hub, trueValue, falseValue);
-        } else {
-            XirArgument[] params = new XirArgument[hintsLength + (hints.exact ? 3 : 4)];
-            int i = 0;
-            params[i++] = object;
-            if (!hints.exact) {
-                params[i++] = hub;
-            }
-            params[i++] = trueValue;
-            params[i++] = falseValue;
-            for (ResolvedJavaType hint : hints.types) {
-                params[i++] = XirArgument.forObject(((HotSpotJavaType) hint).klassOop());
-            }
-            XirTemplate template = hints.exact ? materializeInstanceOfTemplates.get(site, hintsLength, EXACT_HINTS) : materializeInstanceOfTemplates.get(site, hintsLength);
-            return new XirSnippet(template, params);
-        }
-    }
-
-    @Override
-    public XirSnippet genTypeBranch(XirSite site, XirArgument thisHub, XirArgument otherHub, JavaType type) {
-        assert type instanceof ResolvedJavaType;
-        return new XirSnippet(typeCheckTemplates.get(site), thisHub, otherHub);
-    }
-
-    @Override
-    public void initialize(XirAssembler asm) {
-        this.globalAsm = asm;
-    }
-
-    private void checkSubtype(XirAssembler asm, XirOperand result, XirOperand objHub, XirOperand hub) {
-        asm.push(objHub);
-        asm.push(hub);
-        asm.callRuntime(config.instanceofStub, null);
-        asm.pop(result);
-        asm.pop(result);
-    }
-
-    private static void useRegisters(XirAssembler asm, Register... registers) {
-        if (registers != null) {
-            for (Register register : registers) {
-                asm.createRegisterTemp("reg", Kind.Illegal, register);
-            }
-        }
-    }
-
-    public boolean is(TemplateFlag check, long flags) {
-        return (flags & check.bits()) == check.bits();
-    }
-
-    /**
-     * Base class for all the ondemand template generators. It is not normally subclassed directly, but through one of
-     * its subclasses (SimpleTemplates, KindTemplates, IndexTemplates).
-     */
-    private abstract class Templates {
-
-        private ConcurrentHashMap<Long, XirTemplate> templates = new ConcurrentHashMap<>();
-        private final long mask;
-
-        /**
-         * Each flag passed to this method will cause templates with and without it to be generated.
-         */
-        public Templates(TemplateFlag... flags) {
-            this.mask = getBits((int) INDEX_MASK, null, flags);
-        }
-
-        protected abstract XirTemplate create(XirAssembler asm, long flags);
-
-        protected long getBits(int index, XirSite site, TemplateFlag... flags) {
-            long bits = index;
-            if (site != null) {
-                bits |= site.requiresNullCheck() ? NULL_CHECK.bits() : 0;
-                bits |= site.requiresReadBarrier() ? READ_BARRIER.bits() : 0;
-                bits |= site.requiresWriteBarrier() ? WRITE_BARRIER.bits() : 0;
-                bits |= site.requiresArrayStoreCheck() ? STORE_CHECK.bits() : 0;
-                bits |= site.requiresBoundsCheck() ? BOUNDS_CHECK.bits() : 0;
-            }
-            if (flags != null) {
-                for (TemplateFlag flag : flags) {
-                    bits |= flag.bits();
-                }
-            }
-            return bits;
-        }
-
-        protected XirTemplate getInternal(long flags) {
-            long maskedFlags = flags & mask;
-            XirTemplate template = templates.get(maskedFlags);
-            if (template == null) {
-                template = create(HotSpotXirGenerator.this.globalAsm.copy(), maskedFlags);
-                templates.put(maskedFlags, template);
-            }
-            return template;
-        }
-    }
-
-    private abstract class SimpleTemplates extends Templates {
-
-        public SimpleTemplates(TemplateFlag... flags) {
-            super(flags);
-        }
-
-        public XirTemplate get(XirSite site, TemplateFlag... flags) {
-            return getInternal(getBits(0, site, flags));
-        }
-    }
-
-    private abstract class IndexTemplates extends Templates {
-
-        public IndexTemplates(TemplateFlag... flags) {
-            super(flags);
-        }
-
-        @Override
-        protected final XirTemplate create(XirAssembler asm, long flags) {
-            return create(asm, flags & FLAGS_MASK, (int) (flags & INDEX_MASK));
-        }
-
-        protected abstract XirTemplate create(XirAssembler asm, long flags, int index);
-
-        public XirTemplate get(XirSite site, int size, TemplateFlag... flags) {
-            return getInternal(getBits(size, site, flags));
-        }
-    }
-
-    private abstract class KindTemplates extends Templates {
-
-        public KindTemplates(TemplateFlag... flags) {
-            super(flags);
-        }
-
-        @Override
-        protected final XirTemplate create(XirAssembler asm, long flags) {
-            return create(asm, flags & FLAGS_MASK, Kind.values()[(int) (flags & INDEX_MASK)]);
-        }
-
-        protected abstract XirTemplate create(XirAssembler asm, long flags, Kind kind);
-
-        public XirTemplate get(XirSite site, Kind kind, TemplateFlag... flags) {
-            return getInternal(getBits(kind.ordinal(), site, flags));
-        }
-    }
-
-    private static void printCounter(PrintStream out, CheckcastCounter name, long count, long total) {
-        double percent = total == 0D ? 0D : ((double) (count * 100)) / total;
-        out.println(String.format("%16s: %5.2f%%%10d  // %s", name, percent, count, name.desc));
-    }
-
-    public static  void printCheckcastCounters(PrintStream out) {
-        class Count implements Comparable<Count> {
-            long c;
-            CheckcastCounter name;
-            Count(long c, CheckcastCounter name) {
-                this.c = c;
-                this.name = name;
-            }
-            public int compareTo(Count o) {
-                return (int) (o.c - c);
-            }
-        }
-
-        long total = 0;
-        Count[] counters = new Count[checkcastCounters.length];
-        for (int i = 0; i < counters.length; i++) {
-            counters[i] = new Count(checkcastCounters[i], CheckcastCounter.VALUES[i]);
-            total += checkcastCounters[i];
-        }
-        Arrays.sort(counters);
-
-        out.println();
-        out.println("** XIR checkcast counters **");
-        for (Count c : counters) {
-            printCounter(out, c.name, c.c, total);
-        }
-    }
-
-    public static void printCounters(PrintStream out) {
-        if (GraalOptions.SnippetCounters) {
-            printCheckcastCounters(out);
-        }
-    }
-}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java	Sun Sep 30 13:21:20 2012 +0200
@@ -130,10 +130,6 @@
                 return;
             }
 
-            if (predInstructions.get(predInstructions.size() - 1) instanceof LIRXirInstruction) {
-                return;
-            }
-
             assert pred.suxAt(0) == block : "invalid control flow";
             assert predInstructions.get(predInstructions.size() - 1) instanceof StandardOp.JumpOp : "block must end with unconditional jump";
 
@@ -187,11 +183,6 @@
 
         assert numSux == 2 : "method should not be called otherwise";
 
-        if (instructions.get(instructions.size() - 1) instanceof LIRXirInstruction) {
-            // cannot optimize when last instruction is Xir.
-            return;
-        }
-
         assert instructions.get(instructions.size() - 1) instanceof StandardOp.JumpOp : "block must end with unconditional jump";
 
         if (instructions.get(instructions.size() - 1).hasState()) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java	Sun Sep 30 13:21:20 2012 +0200
@@ -131,7 +131,7 @@
 
             if (block.numberOfSux() > 0) {
                 LIRInstruction last = lir.lir(block).get(lir.lir(block).size() - 1);
-                assert last instanceof StandardOp.JumpOp || last instanceof LIRXirInstruction : "block with successor must end with unconditional jump";
+                assert last instanceof StandardOp.JumpOp : "block with successor must end with unconditional jump";
             }
 
             for (LIRInstruction op : lir.lir(block)) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRXirInstruction.java	Sun Sep 30 13:19:38 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +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.graal.lir;
-
-import static com.oracle.graal.api.code.ValueUtil.*;
-import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.xir.*;
-
-public abstract class LIRXirInstruction extends LIRInstruction {
-    @Opcode protected final String opcode;
-    @Def({REG, ILLEGAL}) protected Value outputOperand;
-    @Alive({REG, CONST, ILLEGAL}) protected Value[] inputs;
-    @Temp({REG, CONST, ILLEGAL}) protected Value[] temps;
-    @State protected LIRFrameState state;
-    @State protected LIRFrameState stateAfter;
-
-    // Defined as Object[] so that the magic processing of Value[] does not complain this field is not annotated.
-    public final Object[] originalOperands;
-
-    public final int outputOperandIndex;
-    public final int[] inputOperandIndices;
-    public final int[] tempOperandIndices;
-    public final XirSnippet snippet;
-    public final LabelRef trueSuccessor;
-    public final LabelRef falseSuccessor;
-
-    public LIRXirInstruction(XirSnippet snippet,
-                             Value[] originalOperands,
-                             Value outputOperand,
-                             Value[] inputs, Value[] temps,
-                             int[] inputOperandIndices, int[] tempOperandIndices,
-                             int outputOperandIndex,
-                             LIRFrameState state,
-                             LIRFrameState stateAfter,
-                             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.
-        this.opcode = "XIR: " + snippet.template;
-        this.outputOperand = outputOperand;
-        this.inputs = inputs;
-        this.temps = temps;
-        this.state = state;
-        this.stateAfter = stateAfter;
-        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;
-    }
-
-    public Value[] getOperands() {
-        for (int i = 0; i < inputOperandIndices.length; i++) {
-            originalOperands[inputOperandIndices[i]] = inputs[i];
-        }
-        for (int i = 0; i < tempOperandIndices.length; i++) {
-            originalOperands[tempOperandIndices[i]] = temps[i];
-        }
-        if (outputOperandIndex != -1) {
-            originalOperands[outputOperandIndex] = outputOperand;
-        }
-        return (Value[]) originalOperands;
-    }
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java	Sun Sep 30 13:21:20 2012 +0200
@@ -30,7 +30,7 @@
 /**
  * Extension of a {@linkplain LocationNode location} to include a scaled index or an additional offset.
  */
-public final class IndexedLocationNode extends LocationNode implements LIRLowerable, Canonicalizable {
+public final class IndexedLocationNode extends LocationNode implements Canonicalizable {
 
     /**
      * An offset or index depending on whether {@link #indexScalingEnabled} is true or false respectively.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Sun Sep 30 13:21:20 2012 +0200
@@ -31,7 +31,7 @@
 /**
  * Implements a type check that results in a {@link ClassCastException} if it fails.
  */
-public final class CheckCastNode extends FixedWithNextNode implements Canonicalizable, LIRLowerable, Lowerable, Node.IterableNodeType {
+public final class CheckCastNode extends FixedWithNextNode implements Canonicalizable, Lowerable, Node.IterableNodeType {
 
     @Input private ValueNode object;
     @Input private ValueNode targetClassInstruction;
@@ -62,11 +62,6 @@
     }
 
     @Override
-    public void generate(LIRGeneratorTool gen) {
-        gen.visitCheckCast(this);
-    }
-
-    @Override
     public boolean inferStamp() {
         if (object().stamp().nonNull() && !stamp().nonNull()) {
             setStamp(targetClass == null ? StampFactory.objectNonNull() : StampFactory.declaredNonNull(targetClass));
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java	Sun Sep 30 13:21:20 2012 +0200
@@ -29,7 +29,7 @@
 /**
  * The {@code MonitorEnterNode} represents the acquisition of a monitor.
  */
-public final class MonitorEnterNode extends AccessMonitorNode implements LIRLowerable, Lowerable, MonitorEnter {
+public final class MonitorEnterNode extends AccessMonitorNode implements Lowerable, MonitorEnter {
 
     /**
      * Creates a new MonitorEnterNode.
@@ -40,10 +40,6 @@
         super(object);
     }
 
-    public void generate(LIRGeneratorTool gen) {
-        gen.visitMonitorEnter(this);
-    }
-
     public void lower(LoweringTool tool) {
         tool.getRuntime().lower(this, tool);
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java	Sun Sep 30 13:21:20 2012 +0200
@@ -30,7 +30,7 @@
 /**
  * The {@code MonitorEnterNode} represents a monitor release.
  */
-public final class MonitorExitNode extends AccessMonitorNode implements Lowerable, LIRLowerable, Node.IterableNodeType, MonitorExit {
+public final class MonitorExitNode extends AccessMonitorNode implements Lowerable, Node.IterableNodeType, MonitorExit {
 
     /**
      * Creates a new MonitorExitNode.
@@ -41,11 +41,6 @@
         super(object);
     }
 
-    @Override
-    public void generate(LIRGeneratorTool gen) {
-        gen.visitMonitorExit(this);
-    }
-
     public void lower(LoweringTool tool) {
         tool.getRuntime().lower(this, tool);
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java	Sun Sep 30 13:21:20 2012 +0200
@@ -35,7 +35,7 @@
  * The {@code NewInstanceNode} represents the allocation of an instance class object.
  */
 @NodeInfo(nameTemplate = "New {p#instanceClass/s}")
-public final class NewInstanceNode extends FixedWithNextNode implements EscapeAnalyzable, Lowerable, LIRLowerable, Node.IterableNodeType {
+public final class NewInstanceNode extends FixedWithNextNode implements EscapeAnalyzable, Lowerable, Node.IterableNodeType {
 
     private final ResolvedJavaType instanceClass;
     private final boolean fillContents;
@@ -69,11 +69,6 @@
         tool.getRuntime().lower(this, tool);
     }
 
-    @Override
-    public void generate(LIRGeneratorTool gen) {
-        gen.visitNewInstance(this);
-    }
-
     private void fillEscapeFields(ResolvedJavaType type, List<ResolvedJavaField> escapeFields) {
         if (type != null) {
             fillEscapeFields(type.superType(), escapeFields);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java	Sun Sep 30 13:21:20 2012 +0200
@@ -32,7 +32,7 @@
  * The {@code NewMultiArrayNode} represents an allocation of a multi-dimensional object
  * array.
  */
-public final class NewMultiArrayNode extends FixedWithNextNode implements LIRLowerable, Lowerable {
+public final class NewMultiArrayNode extends FixedWithNextNode implements Lowerable {
 
     @Input private final NodeInputList<ValueNode> dimensions;
     private final ResolvedJavaType type;
@@ -62,11 +62,6 @@
         tool.getRuntime().lower(this, tool);
     }
 
-    @Override
-    public void generate(LIRGeneratorTool gen) {
-        gen.visitNewMultiArray(this);
-    }
-
     public ResolvedJavaType type() {
         return type;
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewObjectArrayNode.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewObjectArrayNode.java	Sun Sep 30 13:21:20 2012 +0200
@@ -25,13 +25,12 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.spi.*;
 
 /**
  * The {@code NewObjectArrayNode} represents an allocation of an object array.
  */
 @NodeInfo(nameTemplate = "NewArray {p#elementType}")
-public final class NewObjectArrayNode extends NewArrayNode implements LIRLowerable, Node.IterableNodeType {
+public final class NewObjectArrayNode extends NewArrayNode implements Node.IterableNodeType {
 
     /**
      * Constructs a new NewObjectArrayNode.
@@ -41,9 +40,4 @@
     public NewObjectArrayNode(ResolvedJavaType elementClass, ValueNode length, boolean fillContents) {
         super(elementClass, length, fillContents);
     }
-
-    @Override
-    public void generate(LIRGeneratorTool gen) {
-        gen.visitNewObjectArray(this);
-    }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewPrimitiveArrayNode.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewPrimitiveArrayNode.java	Sun Sep 30 13:21:20 2012 +0200
@@ -25,20 +25,14 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.spi.*;
 
 /**
  * The {@code NewPrimitiveArrayNode} class definition.
  */
 @NodeInfo(nameTemplate = "NewArray {p#elementType}")
-public final class NewPrimitiveArrayNode extends NewArrayNode implements LIRLowerable, Node.IterableNodeType {
+public final class NewPrimitiveArrayNode extends NewArrayNode implements Node.IterableNodeType {
 
     public NewPrimitiveArrayNode(ResolvedJavaType elementType, ValueNode length, boolean fillContents) {
         super(elementType, length, fillContents);
     }
-
-    @Override
-    public void generate(LIRGeneratorTool gen) {
-        gen.visitNewPrimitiveArray(this);
-    }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java	Sun Sep 30 13:19:38 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java	Sun Sep 30 13:21:20 2012 +0200
@@ -109,13 +109,6 @@
     // Functionality that is currently implemented in XIR.
     // Some of these methods will go away when lowering is done via snippets in the front end.
     // The remainder will define the contract a runtime specific backend must provide.
-    public abstract void visitCheckCast(CheckCastNode i);
-    public abstract void visitMonitorEnter(MonitorEnterNode i);
-    public abstract void visitMonitorExit(MonitorExitNode i);
-    public abstract void visitNewInstance(NewInstanceNode i);
-    public abstract void visitNewPrimitiveArray(NewPrimitiveArrayNode i);
-    public abstract void visitNewObjectArray(NewObjectArrayNode i);
-    public abstract void visitNewMultiArray(NewMultiArrayNode i);
     public abstract void visitExceptionObject(ExceptionObjectNode i);
     public abstract void visitReturn(ReturnNode i);
 }
--- a/graal/com.oracle.max.cri/overview.html	Sun Sep 30 13:19:38 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-
-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.  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.
--->
-
-</head>
-<body>
-
-Documentation for the <code>com.oracle.max.cri</code> project.
-
-</body>
-</html>
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirArgument.java	Sun Sep 30 13:19:38 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +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.xir;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents an argument to an {@link XirSnippet}.
- * Currently, this is a <i>union </i> type; it is either a {@link Constant} or an {@code Object}.
- */
-public final class XirArgument {
-
-    public final Constant constant;
-    public final Object object;
-
-    private XirArgument(Constant value) {
-        this.constant = value;
-        this.object = null;
-    }
-
-    private XirArgument(Object o) {
-        this.constant = null;
-        this.object = o;
-    }
-
-    public static XirArgument forInternalObject(Object o) {
-        return new XirArgument(o);
-    }
-
-    public static XirArgument forInt(int x) {
-        return new XirArgument(Constant.forInt(x));
-    }
-
-    public static XirArgument forLong(long x) {
-        return new XirArgument(Constant.forLong(x));
-    }
-
-    public static XirArgument forObject(Object o) {
-        return new XirArgument(Constant.forObject(o));
-    }
-
-    @Override
-    public String toString() {
-        if (constant != null) {
-            return constant.toString();
-        } else {
-            return "" + object;
-        }
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirAssembler.java	Sun Sep 30 13:19:38 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,939 +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.xir;
-
-import static com.oracle.max.cri.xir.XirAssembler.XirOp.*;
-
-import java.util.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.Address.*;
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents an assembler that allows a client such as the runtime system to
- * create {@link XirTemplate XIR templates}.
- */
-public abstract class XirAssembler {
-
-    protected XirOperand resultOperand;
-    protected boolean allocateResultOperand;
-
-    protected final List<XirInstruction> instructions = new ArrayList<>();
-    protected final List<XirLabel> labels = new ArrayList<>(5);
-    protected final List<XirParameter> parameters = new ArrayList<>(5);
-    protected final List<XirTemp> temps = new ArrayList<>(5);
-    protected final List<XirConstant> constants = new ArrayList<>(5);
-    protected final List<XirMark> marks = new ArrayList<>(5);
-
-    protected int outgoingStackSize = 0;
-
-    /**
-     * Increases by one for every {@link XirOperand operand} created.
-     */
-    protected int variableCount;
-
-    /**
-     * Marks the assembly complete.
-     */
-    protected boolean finished = true;
-
-    protected final TargetDescription target;
-
-    public XirAssembler(TargetDescription target) {
-        this.target = target;
-    }
-
-    public static class RuntimeCallInformation {
-        public final Object target;
-        public final boolean useInfoAfter;
-
-        public RuntimeCallInformation(Object target, boolean useInfoAfter) {
-            this.target = target;
-            this.useInfoAfter = useInfoAfter;
-        }
-    }
-
-    /**
-     * Represents additional address calculation information.
-     */
-    public static final class AddressAccessInformation {
-
-        /**
-         * The scaling factor for the scaled-index part of an address computation.
-         */
-        public final Scale scale;
-
-        /**
-         * The constant byte-sized displacement part of an address computation.
-         */
-        public final int disp;
-
-        /**
-         * Determines if the memory access through the address can trap.
-         */
-        public final boolean canTrap;
-
-        private AddressAccessInformation(boolean canTrap) {
-            this.canTrap = canTrap;
-            this.scale = Scale.Times1;
-            this.disp = 0;
-        }
-
-        private AddressAccessInformation(boolean canTrap, int disp) {
-            this.canTrap = canTrap;
-            this.scale = Scale.Times1;
-            this.disp = disp;
-        }
-
-        private AddressAccessInformation(boolean canTrap, int disp, Scale scale) {
-            this.canTrap = canTrap;
-            this.scale = scale;
-            this.disp = disp;
-        }
-    }
-
-    /**
-     * A label that is the target of a control flow instruction.
-     */
-    public static final class XirLabel {
-        public static final String TrueSuccessor = "TrueSuccessor";
-        public static final String FalseSuccessor = "FalseSuccessor";
-        public final String name;
-        public final int index;
-        /**
-         * If {@code true} the label is to an instruction in the fast path sequence, otherwise to the slow path.
-         */
-        public final boolean inline;
-
-        private XirLabel(String name, int index, boolean inline) {
-            this.name = name;
-            this.index = index;
-            this.inline = inline;
-        }
-
-        @Override
-        public String toString() {
-            return name;
-        }
-    }
-
-    /**
-     * Tagging interface that indicates that an {@link XirOperand} is a constant.
-     */
-    public interface XirConstantOperand {
-        int getIndex();
-    }
-
-    public static final XirOperand VOID = null;
-
-    /**
-     * Operands for {@link XirInstruction instructions}.
-     * There are three basic variants, {@link XirConstant constant}, {@link XirParameter parameter} and {@link XirTemp}.
-     */
-    public abstract static class XirOperand {
-
-        public final Kind kind;
-
-        /**
-         * Unique id in range {@code 0} to {@link #variableCount variableCount - 1}.
-         */
-        public final int index;
-
-        /**
-         * Value whose {@link #toString()} method provides a name for this operand.
-         */
-        public final Object name;
-
-        public XirOperand(XirAssembler asm, Object name, Kind kind) {
-            this.kind = kind;
-            this.name = name;
-            this.index = asm.variableCount++;
-        }
-
-        @Override
-        public String toString() {
-            return String.valueOf(name);
-        }
-
-        public String detailedToString() {
-
-            StringBuffer sb = new StringBuffer();
-
-            sb.append(name);
-            sb.append('$');
-            sb.append(kind.typeChar);
-            return sb.toString();
-        }
-    }
-
-    /**
-     * Parameters to {@link XirTemplate templates}.
-     */
-    public static class XirParameter extends XirOperand {
-        /**
-         * Unique id in range {@code 0} to {@code parameters.Size()  - 1}.
-         */
-        public final int parameterIndex;
-
-        public final boolean canBeConstant;
-
-        XirParameter(XirAssembler asm, String name, Kind kind, boolean canBeConstant) {
-            super(asm, name, kind);
-            this.parameterIndex = asm.parameters.size();
-            this.canBeConstant = canBeConstant;
-            asm.parameters.add(this);
-        }
-
-    }
-
-    public static class XirConstantParameter extends XirParameter implements XirConstantOperand {
-        XirConstantParameter(XirAssembler asm, String name, Kind kind) {
-            super(asm, name, kind, true);
-        }
-
-        public int getIndex() {
-            return index;
-        }
-    }
-
-    public static class XirVariableParameter extends XirParameter {
-        XirVariableParameter(XirAssembler asm, String name, Kind kind, boolean canBeConstant) {
-            super(asm, name, kind, canBeConstant);
-        }
-    }
-
-    public static class XirConstant extends XirOperand implements XirConstantOperand {
-        public final Constant value;
-
-        XirConstant(XirAssembler asm, Constant value) {
-            super(asm, value, value.getKind());
-            this.value = value;
-        }
-
-        public int getIndex() {
-            return index;
-        }
-    }
-
-    public static class XirTemp extends XirOperand {
-        public final boolean reserve;
-
-        XirTemp(XirAssembler asm, String name, Kind kind, boolean reserve) {
-            super(asm, name, kind);
-            this.reserve = reserve;
-        }
-    }
-
-    public static class XirRegister extends XirTemp {
-        public final Value register;
-
-        XirRegister(XirAssembler asm, String name, RegisterValue register, boolean reserve) {
-            super(asm, name, register.getKind(), reserve);
-            this.register = register;
-        }
-    }
-
-    /**
-     * Start a new assembly with no initial {@link #resultOperand result operand}.
-     */
-    public void restart() {
-        reset();
-        resultOperand = null;
-    }
-
-    /**
-     * Start a new assembly with a {@link #resultOperand result operand} of type {@code kind}.
-     * @param kind the result kind
-     * @return an {@code XirOperand} for the result operand
-     */
-    public XirOperand restart(Kind kind) {
-        reset();
-        resultOperand = new XirTemp(this, "result", kind, true);
-        allocateResultOperand = true;
-        return resultOperand;
-    }
-
-    /**
-     * Reset the state of the class to the initial conditions to facilitate a new assembly.
-     */
-    private void reset() {
-        assert finished : "must be finished before!";
-        variableCount = 0;
-        allocateResultOperand = false;
-        finished = false;
-        instructions.clear();
-        labels.clear();
-        parameters.clear();
-        temps.clear();
-        constants.clear();
-        marks.clear();
-        outgoingStackSize = 0;
-    }
-
-    /**
-     * Represents an XIR instruction, characterized by an {@link XirOp operation}, a {@link Kind kind}, an optional {@link XirOperand result}, a variable number of {@link XirOperand arguments},
-     * and some optional instruction-specific state. The {@link #x}, {@link #y} and {@link #z} methods are convenient ways to access the first, second and third
-     * arguments, respectively. Only {@link XirOp#CallRuntime} instructions can have more than three arguments.
-     *
-     */
-    public static final class XirInstruction {
-        /**
-         * The {@link Kind kind} of values the instruction operates on.
-         */
-        public final Kind kind;
-        /**
-         * The {@link XirOp operation}.
-         */
-        public final XirOp op;
-        /**
-         * The result, if any.
-         */
-        public final XirOperand result;
-        /**
-         * The arguments.
-         */
-        public final XirOperand[] arguments;
-        /**
-         * Arbitrary additional data associated with the instruction.
-         */
-        public final Object extra;
-
-        public XirInstruction(Kind kind, XirOp op, XirOperand result, XirOperand... arguments) {
-            this(kind, null, op, result, arguments);
-        }
-
-        public XirInstruction(Kind kind, Object extra, XirOp op, XirOperand result, XirOperand... arguments) {
-            this.extra = extra;
-            this.kind = kind;
-            this.op = op;
-            this.result = result;
-            this.arguments = arguments;
-        }
-
-        public XirOperand x() {
-            assert arguments.length > 0 : "no x operand for this instruction";
-            return arguments[0];
-        }
-
-        public XirOperand y() {
-            assert arguments.length > 1 : "no y operand for this instruction";
-            return arguments[1];
-        }
-
-        public XirOperand z() {
-            assert arguments.length > 2 : "no z operand for this instruction";
-            return arguments[2];
-        }
-
-        @Override
-        public String toString() {
-            StringBuffer sb = new StringBuffer();
-
-            if (result != null) {
-                sb.append(result.toString());
-                sb.append(" = ");
-            }
-
-            sb.append(op.name());
-
-            if (kind != Kind.Void) {
-                sb.append('$');
-                sb.append(kind.typeChar);
-            }
-
-            if (arguments != null && arguments.length > 0) {
-                sb.append("(");
-
-                for (int i = 0; i < arguments.length; i++) {
-                    if (i != 0) {
-                        sb.append(", ");
-                    }
-                    sb.append(arguments[i]);
-                }
-
-                sb.append(")");
-            }
-
-            if (extra != null) {
-                sb.append(" ");
-                sb.append(extra);
-            }
-
-            return sb.toString();
-        }
-    }
-
-    /**
-     * These marks let the {@link XirGenerator} mark positions in the generated native code and bring them in relationship with on another.
-     * This is necessary for code patching, etc.
-     */
-    public static class XirMark {
-        public final XirMark[] references;
-        public final Object id;
-
-        // special mark used to refer to the actual call site of an invoke
-        public static final XirMark CALLSITE = new XirMark(null);
-
-        public XirMark(Object id, XirMark... references) {
-            this.id = id;
-            this.references = references;
-        }
-    }
-
-    /**
-     * The set of opcodes for XIR instructions.
-     * {@link XirInstruction} defines {@code x}, {@code y} and {@code z} as the first, second and third arguments, respectively.
-     * We use these mnemonics, plus {@code args} for the complete set of arguments, {@code r} for the result, and {@code extra}
-     * for the instruction-specific extra data, in the opcode specifications. Note that the opcodes that operate on values do not directly
-     * specify the size (kind) of the data operated on;  this is is encoded in {@link XirInstruction#kind}.
-     * Note: If the instruction kind differs from the argument/result kinds, the behavior is undefined.
-     *
-     */
-    public enum XirOp {
-        /**
-         * Move {@code x} to {@code r}.
-         */
-        Mov,
-        /**
-         * Add {@code y} to {@code x} and put the result in {@code r}.
-         */
-        Add,
-        /**
-         * Subtract {@code y} from {@code x} and put the result in {@code r}.
-         */
-        Sub,
-        /**
-         * Divide {@code y} by {@code x} and put the result in {@code r}.
-         */
-        Div,
-        /**
-         * Multiply {@code y} by {@code x} and put the result in {@code r}.
-         */
-        Mul,
-        /**
-         * {@code y} modulus {@code x} and put the result in {@code r}.
-         */
-        Mod,
-        /**
-         * Shift  {@code y} left by {@code x} and put the result in {@code r}.
-         */
-        Shl,
-        /**
-         * Arithmetic shift  {@code y} right by {@code x} and put the result in {@code r}.
-         */
-        Sar,
-        /**
-         * Shift  {@code y} right by {@code x} and put the result in {@code r}.
-         */
-        Shr,
-        /**
-         * And {@code y} by {@code x} and put the result in {@code r}.
-         */
-        And,
-        /**
-         * Or {@code y} by {@code x} and put the result in {@code r}.
-         */
-        Or,
-        /**
-         * Exclusive Or {@code y} by {@code x} and put the result in {@code r}.
-         */
-        Xor,
-        /**
-         * Null check on {@code x}.
-         */
-        NullCheck,
-        /**
-         * Load value at address {@code x} and put the result in {@code r}.
-         */
-        PointerLoad,
-        /**
-         * Store {@code y} at address {@code x}.
-         */
-        PointerStore,
-        /**
-         * Load value at an effective address defined by base {@code x} and either a scaled index {@code y} plus displacement
-         * or an offset {@code y} and put the result in {@code r}.
-         */
-        PointerLoadDisp,
-        /**
-         * Load an effective address defined by base {@code x} and either a scaled index {@code y} plus displacement
-         * or an offset {@code y} and put the result in {@code r}.
-         */
-        LoadEffectiveAddress,
-        /**
-         * Store {@code z} at address defined by base {@code x} and index {@code y}.
-         */
-        PointerStoreDisp,
-        /**
-         * Repeat move from {@code x} to {@code y} using {@code z} words.
-         */
-        RepeatMoveWords,
-        /**
-         * Repeat move from {@code x} to {@code y} using {@code z} words.
-         */
-        RepeatMoveBytes,
-        /**
-         * Compare value at at address {@code x} with value in {@code y} and store value {@code z} at address {@code x}
-         * if it was equal to {@code y}.
-         */
-        PointerCAS,
-        /**
-         * Call the {@link JavaMethod} defined by {@code extra}  with {@code args} and put the result in {@code r}.
-         */
-        CallRuntime,
-        /**
-         * Transfer control to the instruction at the {@link XirLabel label} identified by {@code extra}.
-         */
-        Jmp,
-       /**
-         * If {@code x == y}, transfer control to the instruction at the {@link XirLabel label} identified by {@code extra}.
-         */
-        Jeq,
-        /**
-         * If {@code x != y}, transfer control to the instruction at the {@link XirLabel label} identified by {@code extra}.
-         */
-        Jneq,
-        /**
-         * If {@code x > y}, transfer control to the instruction at the {@link XirLabel label} identified by {@code extra}.
-         */
-        Jgt,
-        /**
-         * If {@code x >= y}, transfer control to the instruction at the {@link XirLabel label} identified by {@code extra}.
-         */
-        Jgteq,
-        /**
-         * If {@code x unsigned >= y}, transfer control to the instruction at the {@link XirLabel label} identified by {@code extra}.
-         */
-        Jugteq,
-        /**
-         * If {@code x < y}, transfer control to the instruction at the {@link XirLabel label} identified by {@code extra}.
-         */
-        Jlt,
-        /**
-         * If {@code x <= y}, transfer control to the instruction at the {@link XirLabel label} identified by {@code extra}.
-         */
-        Jlteq,
-        /**
-         * Decreases the input by one and jumps to the target if the input is not 0.
-         */
-        DecAndJumpNotZero,
-        /**
-         * If bit designated by {@code z} at effective address defined by base {@code x} and offset {@code y}
-         * is set transfer control to the instruction at the {@link XirLabel label} identified by {@code extra}.
-         */
-        Jbset,
-        /**
-         * Bind the {@link XirLabel label} identified by {@code extra} to the current instruction and update any references to it.
-         * A label may be bound more than once to the same location.
-         */
-        Bind,
-        /**
-         * Record a safepoint.
-         */
-        Safepoint,
-        /**
-         * Pushes a value onto the stack.
-         */
-        Push,
-        /**
-         * Pops a value from the stack.
-         */
-        Pop,
-        /**
-         * Marks a position in the generated native code.
-         */
-        Mark,
-        /**
-         * Load instruction pointer of the next instruction in a destination register.
-         */
-        Here,
-        /**
-         * Inserts nop instructions, with the given size in bytes.
-         */
-        Nop,
-        /**
-         * This instruction should never be reached, this is useful for debugging purposes.
-         */
-         ShouldNotReachHere
-    }
-
-    public/*private*/ void append(XirInstruction xirInstruction) {
-        assert !finished : "no instructions can be added to finished template";
-        instructions.add(xirInstruction);
-    }
-
-    public XirLabel createInlineLabel(String name) {
-        final XirLabel result = new XirLabel(name, this.labels.size(), true);
-        labels.add(result);
-        return result;
-    }
-
-    public XirLabel createOutOfLineLabel(String name) {
-        final XirLabel result = new XirLabel(name, this.labels.size(), false);
-        labels.add(result);
-        return result;
-    }
-
-    public void mov(XirOperand result, XirOperand a) {
-        append(new XirInstruction(result.kind, Mov, result, a));
-    }
-
-    public void add(XirOperand result, XirOperand a, XirOperand b) {
-        append(new XirInstruction(result.kind, Add, result, a, b));
-    }
-
-    public void sub(XirOperand result, XirOperand a, XirOperand b) {
-        append(new XirInstruction(result.kind, Sub, result, a, b));
-    }
-
-    public void div(XirOperand result, XirOperand a, XirOperand b) {
-        append(new XirInstruction(result.kind, Div, result, a, b));
-    }
-
-    public void mul(XirOperand result, XirOperand a, XirOperand b) {
-        append(new XirInstruction(result.kind, Mul, result, a, b));
-    }
-
-    public void mod(XirOperand result, XirOperand a, XirOperand b) {
-        append(new XirInstruction(result.kind, Mod, result, a, b));
-    }
-
-    public void shl(XirOperand result, XirOperand a, XirOperand b) {
-        append(new XirInstruction(result.kind, Shl, result, a, b));
-    }
-
-    public void shr(XirOperand result, XirOperand a, XirOperand b) {
-        append(new XirInstruction(result.kind, Shr, result, a, b));
-    }
-
-    public void and(XirOperand result, XirOperand a, XirOperand b) {
-        append(new XirInstruction(result.kind, And, result, a, b));
-    }
-
-    public void or(XirOperand result, XirOperand a, XirOperand b) {
-        append(new XirInstruction(result.kind, Or, result, a, b));
-    }
-
-    public void xor(XirOperand result, XirOperand a, XirOperand b) {
-        append(new XirInstruction(result.kind, Xor, result, a, b));
-    }
-
-    public void nullCheck(XirOperand pointer) {
-        append(new XirInstruction(Kind.Object, NullCheck, VOID, pointer));
-    }
-
-    public void pload(Kind kind, XirOperand result, XirOperand pointer, boolean canTrap) {
-        append(new XirInstruction(kind, canTrap, PointerLoad, result, pointer));
-    }
-
-    public void pstore(Kind kind, XirOperand pointer, XirOperand value, boolean canTrap) {
-        append(new XirInstruction(kind, canTrap, PointerStore, null, pointer, value));
-    }
-
-    public void pload(Kind kind, XirOperand result, XirOperand pointer, XirOperand offset, boolean canTrap) {
-        append(new XirInstruction(kind, new AddressAccessInformation(canTrap), PointerLoadDisp, result, pointer, offset));
-    }
-
-    public void pstore(Kind kind, XirOperand pointer, XirOperand offset, XirOperand value, boolean canTrap) {
-        append(new XirInstruction(kind, new AddressAccessInformation(canTrap), PointerStoreDisp, VOID, pointer, offset, value));
-    }
-
-    public void pload(Kind kind, XirOperand result, XirOperand pointer, XirOperand index, int disp, Scale scale,  boolean canTrap) {
-        append(new XirInstruction(kind, new AddressAccessInformation(canTrap, disp, scale), PointerLoadDisp, result, pointer, index));
-    }
-
-    public void lea(XirOperand result, XirOperand pointer, XirOperand index, int disp, Scale scale) {
-        append(new XirInstruction(target.wordKind, new AddressAccessInformation(false, disp, scale), LoadEffectiveAddress, result, pointer, index));
-    }
-
-    public void repmov(XirOperand src, XirOperand dest, XirOperand length) {
-        append(new XirInstruction(target.wordKind, null, RepeatMoveWords, null, src, dest, length));
-    }
-
-    public void here(XirOperand dst) {
-        append(new XirInstruction(target.wordKind, null, Here, dst));
-    }
-
-    public void repmovb(XirOperand src, XirOperand dest, XirOperand length) {
-        append(new XirInstruction(target.wordKind, null, RepeatMoveBytes, null, src, dest, length));
-    }
-
-    public void pstore(Kind kind, XirOperand pointer, XirOperand index, XirOperand value, int disp, Scale scale, boolean canTrap) {
-        append(new XirInstruction(kind, new AddressAccessInformation(canTrap, disp, scale), PointerStoreDisp, VOID, pointer, index, value));
-    }
-
-    public void pcas(Kind kind, XirOperand result, XirOperand pointer, XirOperand newValue, XirOperand oldValue) {
-        append(new XirInstruction(kind, null, PointerCAS, result, pointer, newValue, oldValue));
-    }
-
-    public void jmp(XirLabel l) {
-        append(new XirInstruction(Kind.Void, l, Jmp, null));
-    }
-
-    public void decAndJumpNotZero(XirLabel l, XirOperand val) {
-        append(new XirInstruction(Kind.Void, l, DecAndJumpNotZero, null, val));
-    }
-
-    public void jmpRuntime(Object rt) {
-        append(new XirInstruction(Kind.Void, rt, Jmp, null));
-    }
-
-    public void jeq(XirLabel l, XirOperand a, XirOperand b) {
-        jcc(Jeq, l, a, b);
-    }
-
-    private void jcc(XirOp op, XirLabel l, XirOperand a, XirOperand b) {
-        append(new XirInstruction(Kind.Void, l, op, null, a, b));
-    }
-
-    public void jneq(XirLabel l, XirOperand a, XirOperand b) {
-        jcc(Jneq, l, a, b);
-    }
-
-    public void jgt(XirLabel l, XirOperand a, XirOperand b) {
-        jcc(Jgt, l, a, b);
-    }
-
-    public void jgteq(XirLabel l, XirOperand a, XirOperand b) {
-        jcc(Jgteq, l, a, b);
-    }
-
-    public void jugteq(XirLabel l, XirOperand a, XirOperand b) {
-        jcc(Jugteq, l, a, b);
-    }
-
-    public void jlt(XirLabel l, XirOperand a, XirOperand b) {
-        jcc(Jlt, l, a, b);
-    }
-
-    public void jlteq(XirLabel l, XirOperand a, XirOperand b) {
-        jcc(Jlteq, l, a, b);
-    }
-
-    public void jbset(XirLabel l, XirOperand a, XirOperand b, XirOperand c) {
-        append(new XirInstruction(Kind.Void, l, Jbset, null, a, b, c));
-    }
-
-    public void bindInline(XirLabel l) {
-        assert l.inline;
-        append(new XirInstruction(Kind.Void, l, Bind, null));
-    }
-
-    public void bindOutOfLine(XirLabel l) {
-        assert !l.inline;
-        append(new XirInstruction(Kind.Void, l, Bind, null));
-    }
-
-    public void safepoint() {
-        append(new XirInstruction(Kind.Void, null, Safepoint, null));
-    }
-
-    public void push(XirOperand value) {
-        append(new XirInstruction(Kind.Void, Push, VOID, value));
-    }
-
-    public void pop(XirOperand result) {
-        append(new XirInstruction(result.kind, Pop, result));
-    }
-
-    public XirMark mark(Object id, XirMark... references) {
-        XirMark mark = new XirMark(id, references);
-        marks.add(mark);
-        append(new XirInstruction(Kind.Void, mark, Mark, null));
-        return mark;
-    }
-
-    public void nop(int size) {
-        append(new XirInstruction(Kind.Void, size, Nop, null));
-    }
-
-    public void shouldNotReachHere() {
-        append(new XirInstruction(Kind.Void, null, ShouldNotReachHere, null));
-    }
-
-    public void shouldNotReachHere(String message) {
-        append(new XirInstruction(Kind.Void, message, ShouldNotReachHere, null));
-    }
-
-    public void callRuntime(Object rt, XirOperand result, XirOperand... args) {
-        callRuntime(rt, result, false, args);
-    }
-
-    public void callRuntime(Object rt, XirOperand result, boolean useInfoAfter, XirOperand... args) {
-        Kind resultKind = result == null ? Kind.Void : result.kind;
-        append(new XirInstruction(resultKind, new RuntimeCallInformation(rt, useInfoAfter), CallRuntime, result, args));
-    }
-
-    /**
-     * Terminates the assembly, checking invariants, in particular that {@link #resultOperand} is set, and setting {@link #finished} to {@code true}.
-     */
-    private void end() {
-        assert !finished : "template may only be finished once!";
-        assert resultOperand != null : "result operand should be set";
-        finished = true;
-    }
-
-    /**
-     * Creates an {@link XirVariableParameter variable input parameter}  of given name and {@link Kind kind}.
-     * @param name a name for the parameter
-     * @param kind the parameter kind
-     * @return the  {@link XirVariableParameter}
-     */
-    public XirVariableParameter createInputParameter(String name, Kind kind, boolean canBeConstant) {
-        assert !finished;
-        return new XirVariableParameter(this, name, kind, canBeConstant);
-    }
-
-    public XirVariableParameter createInputParameter(String name, Kind kind) {
-        return createInputParameter(name, kind, false);
-    }
-
-    /**
-     * Creates an {@link XirConstantParameter constant input parameter}  of given name and {@link Kind kind}.
-     * @param name a name for the parameter
-     * @param kind the parameter kind
-     * @return the  {@link XirConstantParameter}
-     */
-    public XirConstantParameter createConstantInputParameter(String name, Kind kind) {
-        assert !finished;
-        return new XirConstantParameter(this, name, kind);
-    }
-
-    public XirConstant createConstant(Constant constant) {
-        assert !finished;
-        XirConstant temp = new XirConstant(this, constant);
-        constants.add(temp);
-        return temp;
-    }
-
-    public XirOperand createTemp(String name, Kind kind) {
-        assert !finished;
-        XirTemp temp = new XirTemp(this, name, kind, true);
-        temps.add(temp);
-        return temp;
-    }
-
-    public XirOperand createRegister(String name, Kind kind, Register register) {
-        return createRegister(name, kind, register, false);
-    }
-
-    public XirOperand createRegisterTemp(String name, Kind kind, Register register) {
-        return createRegister(name, kind, register, true);
-    }
-
-    private XirOperand createRegister(String name, Kind kind, Register register, boolean reserve) {
-        assert !finished;
-        XirRegister fixed = new XirRegister(this, name, register.asValue(kind), reserve);
-        temps.add(fixed);
-        return fixed;
-    }
-
-    public XirParameter getParameter(String name) {
-        for (XirParameter param : parameters) {
-            if (param.name.toString().equals(name)) {
-                return param;
-            }
-        }
-        throw new IllegalArgumentException("no parameter: " + name);
-    }
-
-    public XirTemp getTemp(String name) {
-        for (XirTemp temp : temps) {
-            if (temp.name.toString().equals(name)) {
-                return temp;
-            }
-        }
-        throw new IllegalArgumentException("no temp: " + name);
-    }
-
-    public XirConstant i(int v) {
-        return createConstant(Constant.forInt(v));
-    }
-
-    public XirConstant l(long v) {
-        return createConstant(Constant.forLong(v));
-    }
-
-    public XirConstant b(boolean v) {
-        return createConstant(Constant.forBoolean(v));
-    }
-
-    public XirConstant o(Object obj) {
-        return createConstant(Constant.forObject(obj));
-    }
-
-    public void reserveOutgoingStack(int size) {
-        outgoingStackSize = Math.max(outgoingStackSize, size);
-    }
-
-    /**
-     * Finishes the assembly of a non-stub template, providing the {@link #resultOperand} and constructs the {@link XirTemplate}.
-     * @param result the {@link XirOperand} to be set as the {@link #resultOperand}
-     * @param name the name of the template
-     * @return the generated template
-     */
-    public XirTemplate finishTemplate(XirOperand result, String name) {
-        assert this.resultOperand == null;
-        assert result != null;
-        this.resultOperand = result;
-        final XirTemplate template = buildTemplate(name, false);
-        end();
-        return template;
-    }
-
-    /**
-     * Finishes the assembly of a non-stub template and constructs the {@link XirTemplate}.
-     * @param name the name of the template
-     * @return the generated template
-     */
-    public XirTemplate finishTemplate(String name) {
-        final XirTemplate template = buildTemplate(name, false);
-        end();
-        return template;
-    }
-
-    /**
-     * Finishes the assembly of a {@link XirTemplate.GlobalFlags#GLOBAL_STUB stub} and constructs the {@link XirTemplate}.
-     * @param name the name of the template
-     * @return the generated template
-     */
-    public XirTemplate finishStub(String name) {
-        final XirTemplate template = buildTemplate(name, true);
-        end();
-        return template;
-    }
-
-    /**
-     * Builds the {@link XirTemplate} from the assembly state in this object.
-     * The actual assembly is dependent on the target architecture and implemented
-     * in a concrete subclass.
-     * @param name the name of the template
-     * @param isStub {@code true} if the template represents a {@link XirTemplate.GlobalFlags#GLOBAL_STUB stub}
-     * @return the generated template
-     */
-    protected abstract XirTemplate buildTemplate(String name, boolean isStub);
-
-    public abstract XirAssembler copy();
-
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirGenerator.java	Sun Sep 30 13:19:38 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +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.xir;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.JavaType.*;
-
-/**
- * Represents the interface through which the compiler requests the XIR for a given bytecode from the runtime system.
- */
-public interface XirGenerator {
-
-    XirSnippet genInvokeInterface(XirSite site, XirArgument receiver, JavaMethod method);
-
-    XirSnippet genInvokeVirtual(XirSite site, XirArgument receiver, JavaMethod method, boolean megamorph);
-
-    XirSnippet genInvokeSpecial(XirSite site, XirArgument receiver, JavaMethod method);
-
-    XirSnippet genInvokeStatic(XirSite site, JavaMethod method);
-
-    XirSnippet genMonitorEnter(XirSite site, XirArgument receiver, XirArgument lockAddress);
-
-    XirSnippet genMonitorExit(XirSite site, XirArgument receiver, XirArgument lockAddress);
-
-    XirSnippet genNewInstance(XirSite site, JavaType type);
-
-    XirSnippet genNewArray(XirSite site, XirArgument length, Kind elementKind, JavaType componentType, JavaType arrayType);
-
-    XirSnippet genNewMultiArray(XirSite site, XirArgument[] lengths, JavaType type);
-
-    XirSnippet genCheckCast(XirSite site, XirArgument receiver, XirArgument hub, ResolvedJavaType type, JavaTypeProfile profile);
-
-    XirSnippet genInstanceOf(XirSite site, XirArgument receiver, XirArgument hub, ResolvedJavaType type, JavaTypeProfile profile);
-
-    XirSnippet genMaterializeInstanceOf(XirSite site, XirArgument receiver, XirArgument hub, XirArgument trueValue, XirArgument falseValue, ResolvedJavaType type, JavaTypeProfile profile);
-
-    /**
-     * Generates code that checks that the {@linkplain Representation#ObjectHub hub} of
-     * an object is identical to a given hub constant. In pseudo code:
-     * <pre>
-     *     if (object.getHub() != hub) {
-     *       jump(falseSuccessor)
-     *     }
-     * </pre>
-     * This snippet should only be used when the object is guaranteed not to be null.
-     */
-    XirSnippet genTypeBranch(XirSite site, XirArgument thisHub, XirArgument otherHub, JavaType type);
-
-    /**
-     * Initializes the XIR generator for the given XIR assembler.
-     *
-     * @param asm the XIR assembler
-     */
-    void initialize(XirAssembler asm);
-
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirSite.java	Sun Sep 30 13:19:38 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +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.xir;
-
-import com.oracle.graal.api.code.*;
-
-/**
- * Encapsulates the notion of a site where XIR can be supplied. It is supplied to the {@link XirGenerator} by the
- * compiler for each place where XIR can be generated. This interface allows a number of queries, including the
- * bytecode-level location and optimization hints computed by the compiler.
- */
-public interface XirSite {
-
-    /**
-     * Checks whether the specified argument is guaranteed to be non-null at this site.
-     * @param argument the argument
-     * @return {@code true} if the argument is non null at this site
-     */
-    boolean isNonNull(XirArgument argument);
-
-    /**
-     * Checks whether this site requires a null check.
-     * @return {@code true} if a null check is required
-     */
-    boolean requiresNullCheck();
-
-    /**
-     * Checks whether this site requires a range check.
-     * @return {@code true} if a range check is required
-     */
-    boolean requiresBoundsCheck();
-
-    /**
-     * Checks whether this site requires a read barrier.
-     * @return {@code true} if a read barrier is required
-     */
-    boolean requiresReadBarrier();
-
-    /**
-     * Checks whether this site requires a write barrier.
-     * @return {@code true} if a write barrier is required
-     */
-    boolean requiresWriteBarrier();
-
-    /**
-     * Checks whether this site requires an array store check.
-     * @return {@code true} if an array store check is required
-     */
-    boolean requiresArrayStoreCheck();
-
-    /**
-     * The object for recording speculations made during compilation.
-     * May be null.
-     */
-    Assumptions assumptions();
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirSnippet.java	Sun Sep 30 13:19:38 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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.xir;
-
-import java.util.*;
-
-import com.oracle.graal.api.code.CompilationResult.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.xir.XirAssembler.*;
-
-/**
- * Represents a {@link XirTemplate template of XIR} along with the {@link XirArgument arguments} to be passed to the
- * template. The runtime generates such snippets for each bytecode being compiled at the request of the compiler, and
- * the compiler can generate machine code for the XIR snippet.
- */
-public class XirSnippet {
-
-    public final XirArgument[] arguments;
-    public final XirTemplate template;
-    public final Map<XirMark, Mark> marks;
-
-    public XirSnippet(XirTemplate template, XirArgument... inputs) {
-        assert template != null;
-        this.template = template;
-        this.arguments = inputs;
-        this.marks = (template.marks != null && template.marks.length > 0) ? new HashMap<XirMark, Mark>() : null;
-        assert assertArgumentsCorrect();
-    }
-
-    private boolean assertArgumentsCorrect() {
-        int argLength = arguments == null ? 0 : arguments.length;
-        int paramLength = template.parameters == null ? 0 : template.parameters.length;
-        assert argLength == paramLength : "expected param count: " + paramLength + ", actual: " + argLength;
-        for (int i = 0; i < arguments.length; i++) {
-            assert assertArgumentCorrect(template.parameters[i], arguments[i]) : "mismatch in parameter " + i + ": " + arguments[i] + " instead of " + template.parameters[i];
-        }
-        return true;
-    }
-
-    private static boolean assertArgumentCorrect(XirParameter param, XirArgument arg) {
-        if (param.kind == Kind.Illegal || param.kind == Kind.Void) {
-            if (arg != null) {
-                return false;
-            }
-        } else {
-            if (arg == null) {
-                return false;
-            }
-            if (arg.constant != null) {
-                if (arg.constant.getKind() != param.kind) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-
-        StringBuffer sb = new StringBuffer();
-
-        sb.append(template.toString());
-        sb.append("(");
-        for (XirArgument a : arguments) {
-            sb.append(" ");
-            sb.append(a);
-        }
-
-        sb.append(" )");
-
-        return sb.toString();
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirTemplate.java	Sun Sep 30 13:19:38 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +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.xir;
-
-import java.io.*;
-import java.util.*;
-
-import com.oracle.max.cri.xir.XirAssembler.*;
-
-/**
- * Represents a completed template of XIR code that has been first assembled by
- * the runtime, and then verified and preprocessed by the compiler. An {@code XirTemplate}
- * instance is immutable.
- */
-public class XirTemplate {
-
-    /**
-     * Flags that indicate key features of the template for quick checking.
-     */
-    public enum GlobalFlags {
-        /**
-         * Contains a call to a {@link GlobalFlags#GLOBAL_STUB} template.
-         */
-        HAS_STUB_CALL,
-
-        /**
-         * Contains a call to the runtime.
-         */
-        HAS_RUNTIME_CALL,
-
-        /**
-         * Not simply a linear sequence of instructions, contains control transfers.
-         */
-        HAS_CONTROL_FLOW,
-
-        /**
-         * Is a shared instruction sequence for use by other templates.
-         */
-        GLOBAL_STUB;
-
-        public final int mask = 1 << ordinal();
-    }
-
-    /**
-     * Name of the template.
-     */
-    public final String name;
-
-    public final XirOperand resultOperand;
-
-    /**
-     * The sequence of instructions for the fast (inline) path.
-     */
-    public final XirAssembler.XirInstruction[] fastPath;
-
-    /**
-     * The sequence of instructions for the slow (out of line) path.
-     */
-    public final XirAssembler.XirInstruction[] slowPath;
-
-    /**
-     * Labels used in control transfers.
-     */
-    public final XirLabel[] labels;
-
-    /**
-     * Parameters to the template.
-     */
-    public final XirParameter[] parameters;
-
-    /**
-     * An array of same length as {@link #parameters} where {@code parameterDestroyed[i]} is {@code true}
-     * iff {@code parameters[i]} is the {@link XirInstruction#result result} of any {@link XirInstruction} in either
-     * {@link #fastPath} or {@link #slowPath}.
-     */
-    public final boolean[] parameterDestroyed;
-
-    /**
-     * Temporary variables used by the template.
-     */
-    public final XirTemp[] temps;
-
-    /**
-     * Constants used in the template.
-     */
-    public final XirConstant[] constants;
-
-    /**
-     * The total number of variables. (relation to temps/parameters???)
-     */
-    public final int variableCount;
-
-    public final boolean allocateResultOperand;
-
-    public final XirMark[] marks;
-
-    public final int outgoingStackSize;
-
-    public final XirOperand[] inputOperands;
-    public final XirOperand[] inputTempOperands;
-    public final XirOperand[] tempOperands;
-
-
-    /**
-     * The {@link GlobalFlags} associated with the template.
-     */
-    public final int flags;
-
-    public XirTemplate(String name,
-                       int variableCount,
-                       boolean allocateResultOperand,
-                       XirOperand resultOperand,
-                       XirAssembler.XirInstruction[] fastPath,
-                       XirAssembler.XirInstruction[] slowPath,
-                       XirLabel[] labels,
-                       XirParameter[] parameters,
-                       XirTemp[] temps,
-                       XirConstant[] constantValues,
-                       int flags,
-                       XirMark[] marks,
-                       int outgoingStackSize) {
-        this.name = name;
-        this.variableCount = variableCount;
-        this.resultOperand = resultOperand;
-        this.fastPath = fastPath;
-        this.slowPath = slowPath;
-        this.labels = labels;
-        this.parameters = parameters;
-        this.flags = flags;
-        this.temps = temps;
-        this.allocateResultOperand = allocateResultOperand;
-        this.constants = constantValues;
-        this.marks = marks;
-        this.outgoingStackSize = outgoingStackSize;
-
-        assert fastPath != null;
-        assert labels != null;
-        assert parameters != null;
-
-        List<XirOperand> inputOperandList = new ArrayList<>(4);
-        List<XirOperand> inputTempOperandList = new ArrayList<>(4);
-        List<XirOperand> tempOperandList = new ArrayList<>(4);
-
-        parameterDestroyed = new boolean[parameters.length];
-        for (int i = 0; i < parameters.length; i++) {
-            for (XirInstruction ins : fastPath) {
-                if (ins.result == parameters[i]) {
-                    parameterDestroyed[i] = true;
-                    break;
-                }
-            }
-
-            if (slowPath != null && !parameterDestroyed[i]) {
-                for (XirInstruction ins : slowPath) {
-                    if (ins.result == parameters[i]) {
-                        parameterDestroyed[i] = true;
-                    }
-                }
-            }
-
-            if (parameterDestroyed[i]) {
-                inputTempOperandList.add(parameters[i]);
-            } else {
-                inputOperandList.add(parameters[i]);
-            }
-        }
-
-        for (XirTemp temp : temps) {
-            if (temp.reserve) {
-                tempOperandList.add(temp);
-            }
-        }
-
-        this.inputOperands = inputOperandList.toArray(new XirOperand[inputOperandList.size()]);
-        this.inputTempOperands = inputTempOperandList.toArray(new XirOperand[inputTempOperandList.size()]);
-        this.tempOperands = tempOperandList.toArray(new XirOperand[tempOperandList.size()]);
-    }
-
-    /**
-     * Convenience getter that returns the value at a given index in the {@link #parameterDestroyed} array.
-     * @param index
-     * @return the value at {@code parameterDestroyed[index]}
-     */
-    public boolean isParameterDestroyed(int index) {
-        return parameterDestroyed[index];
-    }
-
-    @Override
-    public String toString() {
-        return name;
-    }
-
-    public void print(PrintStream p) {
-        final String indent = "   ";
-
-        p.println();
-        p.println("Template " + name);
-
-        p.print("Param:");
-        for (XirParameter param : parameters) {
-            p.print(" " + param.detailedToString());
-        }
-        p.println();
-
-        if (temps.length > 0) {
-            p.print("Temps:");
-            for (XirTemp temp : temps) {
-                p.print(" " + temp.detailedToString());
-            }
-            p.println();
-        }
-
-        if (constants.length > 0) {
-            p.print("Constants:");
-            for (XirConstant c : constants) {
-                p.print(" " + c.detailedToString());
-            }
-            p.println();
-        }
-
-        if (flags != 0) {
-            p.print("Flags:");
-            for (XirTemplate.GlobalFlags flag : XirTemplate.GlobalFlags.values()) {
-                if ((this.flags & flag.mask) != 0) {
-                    p.print(" " + flag.name());
-                }
-            }
-            p.println();
-        }
-
-        p.println("Fast path:");
-        for (XirInstruction i : fastPath) {
-            p.println(indent + i.toString());
-        }
-
-        if (slowPath != null) {
-            p.println("Slow path:");
-            for (XirInstruction i : slowPath) {
-                p.println(indent + i.toString());
-            }
-        }
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/package-info.java	Sun Sep 30 13:19:38 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- */
-/**
- * XIR defines a domain specific instruction set for expressing the lowering of bytecode operations. The details of the
- * lowering operations are entirely encapsulated in the runtime and are provided to the compiler on request using
- * {@link com.oracle.max.cri.xir.XirSnippet XIR snippets}. A snippet is a combination of a {@link com.oracle.max.cri.xir.XirTemplate
- * template}, which is a sequence of {@link com.oracle.max.cri.xir.XirAssembler.XirInstruction XIR instructions} that has
- * unbound {@link com.oracle.max.cri.xir.XirAssembler.XirParameter parameters}, and site-specific
- * {@link com.oracle.max.cri.xir.XirArgument arguments} that are bound to the parameters.
- * <p>
- * The runtime is responsible for creating the {@link com.oracle.max.cri.xir.XirTemplate templates} and provides these to the
- * compiler as part of the initialization process.
- * <p>
- * The XIR instruction set has no textual representation, and therefore no parser. An assembly is represented by an
- * instance of {@link com.oracle.max.cri.xir.XirAssembler}, which provides methods to create instructions and operands.
- */
-package com.oracle.max.cri.xir;
--- a/mx/projects	Sun Sep 30 13:19:38 2012 +0200
+++ b/mx/projects	Sun Sep 30 13:21:20 2012 +0200
@@ -220,16 +220,9 @@
 project@com.oracle.max.asm@checkstyle=com.oracle.graal.graph
 project@com.oracle.max.asm@javaCompliance=1.7
 
-# max.cri
-project@com.oracle.max.cri@subDir=graal
-project@com.oracle.max.cri@sourceDirs=src
-project@com.oracle.max.cri@dependencies=com.oracle.graal.api.code
-project@com.oracle.max.cri@checkstyle=com.oracle.graal.graph
-project@com.oracle.max.cri@javaCompliance=1.7
-
 # max.criutils
 project@com.oracle.max.criutils@subDir=graal
 project@com.oracle.max.criutils@sourceDirs=src
-project@com.oracle.max.criutils@dependencies=com.oracle.max.cri
+project@com.oracle.max.criutils@dependencies=com.oracle.graal.api.code
 project@com.oracle.max.criutils@checkstyle=com.oracle.graal.graph
 project@com.oracle.max.criutils@javaCompliance=1.7
--- a/src/share/vm/runtime/arguments.cpp	Sun Sep 30 13:19:38 2012 +0200
+++ b/src/share/vm/runtime/arguments.cpp	Sun Sep 30 13:21:20 2012 +0200
@@ -2162,7 +2162,6 @@
         "com.oracle.graal.compiler.virtual",
         "com.oracle.graal.nodes",
         "com.oracle.graal.printer",
-        "com.oracle.max.cri",
         "com.oracle.graal.debug",
         "com.oracle.graal.graph",
         "com.oracle.graal.lir",