changeset 8182:e0db99483b35

Merge.
author Doug Simon <doug.simon@oracle.com>
date Fri, 08 Mar 2013 15:58:08 +0100
parents 989e0582a30f (current diff) 67d654d9ee9a (diff)
children 4b11a0983557
files graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64Address.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Address.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java graal/com.oracle.graal.ptx/src/com/oracle/graal/ptx/PTXAddress.java mx/commands.py mxtool/mx.py src/share/vm/utilities/machineCodePrinter.cpp src/share/vm/utilities/machineCodePrinter.hpp
diffstat 132 files changed, 1320 insertions(+), 1727 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java	Fri Mar 08 15:58:08 2013 +0100
@@ -55,13 +55,6 @@
     private static final int INITIAL_WORKLIST_CAPACITY = 10;
 
     /**
-     * Divisor used for degrading the probability of the current path versus unscheduled paths at a
-     * merge node when calculating the linear scan order. A high value means that predecessors of
-     * merge nodes are more likely to be scheduled before the merge node.
-     */
-    private static final int PENALTY_VERSUS_UNSCHEDULED = 10;
-
-    /**
      * Computes the block order used for the linear scan register allocator.
      * 
      * @return sorted list of blocks
@@ -125,27 +118,7 @@
     private static void addPathToLinearScanOrder(Block block, List<Block> order, PriorityQueue<Block> worklist, BitSet visitedBlocks) {
         block.setLinearScanNumber(order.size());
         order.add(block);
-        Block mostLikelySuccessor = findAndMarkMostLikelySuccessor(block, visitedBlocks);
         enqueueSuccessors(block, worklist, visitedBlocks);
-        if (mostLikelySuccessor != null) {
-            if (!mostLikelySuccessor.isLoopHeader() && mostLikelySuccessor.getPredecessorCount() > 1) {
-                // We are at a merge. Check probabilities of predecessors that are not yet
-                // scheduled.
-                double unscheduledSum = 0.0;
-                for (Block pred : mostLikelySuccessor.getPredecessors()) {
-                    if (!visitedBlocks.get(pred.getId())) {
-                        unscheduledSum += pred.getBeginNode().probability();
-                    }
-                }
-
-                if (unscheduledSum > block.getProbability() / PENALTY_VERSUS_UNSCHEDULED) {
-                    // Add this merge only after at least one additional predecessor gets scheduled.
-                    visitedBlocks.clear(mostLikelySuccessor.getId());
-                    return;
-                }
-            }
-            addPathToLinearScanOrder(mostLikelySuccessor, order, worklist, visitedBlocks);
-        }
     }
 
     /**
--- a/graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64.java	Fri Mar 08 15:58:08 2013 +0100
@@ -24,12 +24,11 @@
 
 import static com.oracle.graal.api.code.MemoryBarriers.*;
 import static com.oracle.graal.api.code.Register.RegisterFlag.*;
-import static com.oracle.graal.api.meta.Kind.*;
 
 import java.nio.*;
 
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.Register.*;
+import com.oracle.graal.api.code.Register.RegisterFlag;
 
 /**
  * Represents the AMD64 architecture.
@@ -106,8 +105,6 @@
         rip
     };
 
-    public static final RegisterValue RSP = rsp.asValue(Long);
-
     public AMD64() {
         super("AMD64",
               8,
--- a/graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64Address.java	Fri Mar 08 15:57:41 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, 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.amd64;
-
-import static com.oracle.graal.api.code.ValueUtil.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents an address in target machine memory, specified via some combination of a base
- * register, an index register, a displacement and a scale. Note that the base and index registers
- * may be a variable that will get a register assigned later by the register allocator.
- */
-public final class AMD64Address extends Address {
-
-    private static final long serialVersionUID = -4101548147426595051L;
-
-    private final Value[] baseIndex;
-    private final Scale scale;
-    private final int displacement;
-
-    /**
-     * Creates an {@link AMD64Address} with given base register, no scaling and no displacement.
-     * 
-     * @param kind the kind of the value being addressed
-     * @param base the base register
-     */
-    public AMD64Address(Kind kind, Value base) {
-        this(kind, base, ILLEGAL, Scale.Times1, 0);
-    }
-
-    /**
-     * Creates an {@link AMD64Address} with given base register, no scaling and a given
-     * displacement.
-     * 
-     * @param kind the kind of the value being addressed
-     * @param base the base register
-     * @param displacement the displacement
-     */
-    public AMD64Address(Kind kind, Value base, int displacement) {
-        this(kind, base, ILLEGAL, Scale.Times1, displacement);
-    }
-
-    /**
-     * Creates an {@link AMD64Address} with given base and index registers, scaling and
-     * displacement. This is the most general constructor.
-     * 
-     * @param kind the kind of the value being addressed
-     * @param base the base register
-     * @param index the index register
-     * @param scale the scaling factor
-     * @param displacement the displacement
-     */
-    public AMD64Address(Kind kind, Value base, Value index, Scale scale, int displacement) {
-        super(kind);
-        this.baseIndex = new Value[2];
-        this.setBase(base);
-        this.setIndex(index);
-        this.scale = scale;
-        this.displacement = displacement;
-
-        assert !isConstant(base) && !isStackSlot(base);
-        assert !isConstant(index) && !isStackSlot(index);
-    }
-
-    /**
-     * A scaling factor used in the SIB addressing mode.
-     */
-    public enum Scale {
-        Times1(1, 0), Times2(2, 1), Times4(4, 2), Times8(8, 3);
-
-        private Scale(int value, int log2) {
-            this.value = value;
-            this.log2 = log2;
-        }
-
-        /**
-         * The value (or multiplier) of this scale.
-         */
-        public final int value;
-
-        /**
-         * The {@linkplain #value value} of this scale log 2.
-         */
-        public final int log2;
-
-        public static Scale fromInt(int scale) {
-            switch (scale) {
-                case 1:
-                    return Times1;
-                case 2:
-                    return Times2;
-                case 4:
-                    return Times4;
-                case 8:
-                    return Times8;
-                default:
-                    throw new IllegalArgumentException(String.valueOf(scale));
-            }
-        }
-    }
-
-    @Override
-    public Value[] components() {
-        return baseIndex;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder s = new StringBuilder();
-        s.append(getKind().getJavaName()).append("[");
-        String sep = "";
-        if (isLegal(getBase())) {
-            s.append(getBase());
-            sep = " + ";
-        }
-        if (isLegal(getIndex())) {
-            s.append(sep).append(getIndex()).append(" * ").append(getScale().value);
-            sep = " + ";
-        }
-        if (getDisplacement() < 0) {
-            s.append(" - ").append(-getDisplacement());
-        } else if (getDisplacement() > 0) {
-            s.append(sep).append(getDisplacement());
-        }
-        s.append("]");
-        return s.toString();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof AMD64Address) {
-            AMD64Address addr = (AMD64Address) obj;
-            return getKind() == addr.getKind() && getDisplacement() == addr.getDisplacement() && getBase().equals(addr.getBase()) && getScale() == addr.getScale() &&
-                            getIndex().equals(addr.getIndex());
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return getBase().hashCode() ^ getIndex().hashCode() ^ (getDisplacement() << 4) ^ (getScale().value << 8) ^ (getKind().ordinal() << 12);
-    }
-
-    /**
-     * @return Base register that defines the start of the address computation. If not present, is
-     *         denoted by {@link Value#ILLEGAL}.
-     */
-    public Value getBase() {
-        return baseIndex[0];
-    }
-
-    public void setBase(Value base) {
-        this.baseIndex[0] = base;
-    }
-
-    /**
-     * @return Index register, the value of which (possibly scaled by {@link #scale}) is added to
-     *         {@link #getBase}. If not present, is denoted by {@link Value#ILLEGAL}.
-     */
-    public Value getIndex() {
-        return baseIndex[1];
-    }
-
-    public void setIndex(Value index) {
-        this.baseIndex[1] = index;
-    }
-
-    /**
-     * @return Scaling factor for indexing, dependent on target operand size.
-     */
-    public Scale getScale() {
-        return scale;
-    }
-
-    /**
-     * @return Optional additive displacement.
-     */
-    public int getDisplacement() {
-        return displacement;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/AbstractAddress.java	Fri Mar 08 15:58:08 2013 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2013, 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.api.code;
+
+/**
+ * Abstract base class that represents a platform specific address.
+ */
+public abstract class AbstractAddress {
+}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Address.java	Fri Mar 08 15:57:41 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, 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.api.code;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Base class to represent an address in target machine memory. The concrete representation of the
- * address is platform dependent.
- */
-public abstract class Address extends Value {
-
-    private static final long serialVersionUID = -1003772042519945089L;
-
-    public Address(Kind kind) {
-        super(kind);
-    }
-
-    /**
-     * The values that this address is composed of. Used by the register allocator to manipulate
-     * addresses in a platform independent way.
-     */
-    public abstract Value[] components();
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java	Fri Mar 08 15:58:08 2013 +0100
@@ -78,16 +78,6 @@
         return (StackSlot) value;
     }
 
-    public static boolean isAddress(Value value) {
-        assert value != null;
-        return value instanceof Address;
-    }
-
-    public static Address asAddress(Value value) {
-        assert value != null;
-        return (Address) value;
-    }
-
     public static boolean isRegister(Value value) {
         assert value != null;
         return value instanceof RegisterValue;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Address.java	Fri Mar 08 15:58:08 2013 +0100
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2010, 2013, 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.asm.amd64;
+
+import com.oracle.graal.api.code.*;
+
+/**
+ * Represents an address in target machine memory, specified via some combination of a base
+ * register, an index register, a displacement and a scale. Note that the base and index registers
+ * may be a variable that will get a register assigned later by the register allocator.
+ */
+public final class AMD64Address extends AbstractAddress {
+
+    private final Register base;
+    private final Register index;
+    private final Scale scale;
+    private final int displacement;
+
+    /**
+     * Creates an {@link AMD64Address} with given base register, no scaling and no displacement.
+     * 
+     * @param base the base register
+     */
+    public AMD64Address(Register base) {
+        this(base, Register.None, Scale.Times1, 0);
+    }
+
+    /**
+     * Creates an {@link AMD64Address} with given base register, no scaling and a given
+     * displacement.
+     * 
+     * @param base the base register
+     * @param displacement the displacement
+     */
+    public AMD64Address(Register base, int displacement) {
+        this(base, Register.None, Scale.Times1, displacement);
+    }
+
+    /**
+     * Creates an {@link AMD64Address} with given base and index registers, scaling and
+     * displacement. This is the most general constructor.
+     * 
+     * @param base the base register
+     * @param index the index register
+     * @param scale the scaling factor
+     * @param displacement the displacement
+     */
+    public AMD64Address(Register base, Register index, Scale scale, int displacement) {
+        this.base = base;
+        this.index = index;
+        this.scale = scale;
+        this.displacement = displacement;
+    }
+
+    /**
+     * A scaling factor used in the SIB addressing mode.
+     */
+    public enum Scale {
+        Times1(1, 0), Times2(2, 1), Times4(4, 2), Times8(8, 3);
+
+        private Scale(int value, int log2) {
+            this.value = value;
+            this.log2 = log2;
+        }
+
+        /**
+         * The value (or multiplier) of this scale.
+         */
+        public final int value;
+
+        /**
+         * The {@linkplain #value value} of this scale log 2.
+         */
+        public final int log2;
+
+        public static Scale fromInt(int scale) {
+            switch (scale) {
+                case 1:
+                    return Times1;
+                case 2:
+                    return Times2;
+                case 4:
+                    return Times4;
+                case 8:
+                    return Times8;
+                default:
+                    throw new IllegalArgumentException(String.valueOf(scale));
+            }
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder s = new StringBuilder();
+        s.append("[");
+        String sep = "";
+        if (getBase() != Register.None) {
+            s.append(getBase());
+            sep = " + ";
+        }
+        if (getIndex() != Register.None) {
+            s.append(sep).append(getIndex()).append(" * ").append(getScale().value);
+            sep = " + ";
+        }
+        if (getDisplacement() < 0) {
+            s.append(" - ").append(-getDisplacement());
+        } else if (getDisplacement() > 0) {
+            s.append(sep).append(getDisplacement());
+        }
+        s.append("]");
+        return s.toString();
+    }
+
+    /**
+     * @return Base register that defines the start of the address computation. If not present, is
+     *         denoted by {@link Register#None}.
+     */
+    public Register getBase() {
+        return base;
+    }
+
+    /**
+     * @return Index register, the value of which (possibly scaled by {@link #getScale}) is added to
+     *         {@link #getBase}. If not present, is denoted by {@link Register#None}.
+     */
+    public Register getIndex() {
+        return index;
+    }
+
+    /**
+     * @return Scaling factor for indexing, dependent on target operand size.
+     */
+    public Scale getScale() {
+        return scale;
+    }
+
+    /**
+     * @return Optional additive displacement.
+     */
+    public int getDisplacement() {
+        return displacement;
+    }
+}
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Assembler.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Assembler.java	Fri Mar 08 15:58:08 2013 +0100
@@ -24,13 +24,11 @@
 
 import static com.oracle.graal.amd64.AMD64.*;
 import static com.oracle.graal.api.code.MemoryBarriers.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.asm.NumUtil.*;
 import static com.oracle.graal.asm.amd64.AMD64AsmOptions.*;
 
 import com.oracle.graal.amd64.*;
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 
 /**
@@ -38,19 +36,13 @@
  */
 public class AMD64Assembler extends AbstractAssembler {
 
-    /**
-     * The kind for pointers and raw registers. Since we know we are 64 bit here, we can hardcode
-     * it.
-     */
-    private static final Kind Word = Kind.Long;
-
     private static final int MinEncodingNeedsRex = 8;
 
     /**
      * A sentinel value used as a place holder in an instruction stream for an address that will be
      * patched.
      */
-    private static final AMD64Address Placeholder = new AMD64Address(Kind.Illegal, rip.asValue());
+    private static final AMD64Address Placeholder = new AMD64Address(rip);
 
     /**
      * The x86 condition codes used for conditional jumps/moves.
@@ -232,8 +224,8 @@
         assert (reg & 0x07) == reg;
         int regenc = reg << 3;
 
-        Register base = isLegal(addr.getBase()) ? asRegister(addr.getBase()) : Register.None;
-        Register index = isLegal(addr.getIndex()) ? asRegister(addr.getIndex()) : Register.None;
+        Register base = addr.getBase();
+        Register index = addr.getIndex();
 
         AMD64Address.Scale scale = addr.getScale();
         int disp = addr.getDisplacement();
@@ -1781,8 +1773,8 @@
         }
     }
 
-    private static boolean needsRex(Value value) {
-        return isRegister(value) && asRegister(value).encoding >= MinEncodingNeedsRex;
+    private static boolean needsRex(Register reg) {
+        return reg.encoding >= MinEncodingNeedsRex;
     }
 
     private void prefix(AMD64Address adr) {
@@ -2249,7 +2241,7 @@
                 // the code where this idiom is used, in particular the
                 // orderAccess code.
                 lock();
-                addl(new AMD64Address(Word, RSP, 0), 0); // Assert the lock# signal here
+                addl(new AMD64Address(rsp, 0), 0); // Assert the lock# signal here
             }
         }
     }
@@ -2290,7 +2282,7 @@
     }
 
     public void nullCheck(Register r) {
-        testl(AMD64.rax, new AMD64Address(Word, r.asValue(Word), 0));
+        testl(AMD64.rax, new AMD64Address(r, 0));
     }
 
     @Override
@@ -2371,8 +2363,8 @@
     }
 
     @Override
-    public AMD64Address makeAddress(Kind kind, Value base, int displacement) {
-        return new AMD64Address(kind, base, displacement);
+    public AMD64Address makeAddress(Register base, int displacement) {
+        return new AMD64Address(base, displacement);
     }
 
     @Override
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64MacroAssembler.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64MacroAssembler.java	Fri Mar 08 15:58:08 2013 +0100
@@ -26,7 +26,6 @@
 
 import com.oracle.graal.amd64.*;
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 
 /**
  * This class implements commonly used X86 code patterns.
@@ -222,7 +221,7 @@
      * volatile field!
      */
     public final void movlong(AMD64Address dst, long src) {
-        AMD64Address high = new AMD64Address(dst.getKind(), dst.getBase(), dst.getIndex(), dst.getScale(), dst.getDisplacement() + 4);
+        AMD64Address high = new AMD64Address(dst.getBase(), dst.getIndex(), dst.getScale(), dst.getDisplacement() + 4);
         movl(dst, (int) (src & 0xFFFFFFFF));
         movl(high, (int) (src >> 32));
     }
@@ -230,7 +229,7 @@
     public final void flog(Register dest, Register value, boolean base10) {
         assert dest.isFpu() && value.isFpu();
 
-        AMD64Address tmp = new AMD64Address(Kind.Double, AMD64.RSP);
+        AMD64Address tmp = new AMD64Address(AMD64.rsp);
         if (base10) {
             fldlg2();
         } else {
@@ -264,7 +263,7 @@
 
     private AMD64Address trigPrologue(Register value) {
         assert value.isFpu();
-        AMD64Address tmp = new AMD64Address(Kind.Double, AMD64.RSP);
+        AMD64Address tmp = new AMD64Address(AMD64.rsp);
         subq(AMD64.rsp, 8);
         movsd(tmp, value);
         fld(tmp);
@@ -286,18 +285,16 @@
      * @param frameToCSA offset from the frame pointer to the CSA
      */
     public final void save(CalleeSaveLayout csl, int frameToCSA) {
-        RegisterValue frame = frameRegister.asValue();
         for (Register r : csl.registers) {
             int offset = csl.offsetOf(r);
-            movq(new AMD64Address(target.wordKind, frame, frameToCSA + offset), r);
+            movq(new AMD64Address(frameRegister, frameToCSA + offset), r);
         }
     }
 
     public final void restore(CalleeSaveLayout csl, int frameToCSA) {
-        RegisterValue frame = frameRegister.asValue();
         for (Register r : csl.registers) {
             int offset = csl.offsetOf(r);
-            movq(r, new AMD64Address(target.wordKind, frame, frameToCSA + offset));
+            movq(r, new AMD64Address(frameRegister, frameToCSA + offset));
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.asm.ptx/src/com/oracle/graal/asm/ptx/PTXAddress.java	Fri Mar 08 15:58:08 2013 +0100
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2013, 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.asm.ptx;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
+
+/**
+ * Represents an address in target machine memory, specified via some combination of a base register
+ * and a displacement.
+ */
+public final class PTXAddress extends AbstractAddress {
+
+    private final Register base;
+    private final long displacement;
+
+    /**
+     * Creates an {@link PTXAddress} with given base register and no displacement.
+     * 
+     * @param base the base register
+     */
+    public PTXAddress(Register base) {
+        this(base, 0);
+    }
+
+    /**
+     * Creates an {@link PTXAddress} with given base register and a displacement. This is the most
+     * general constructor.
+     * 
+     * @param base the base register
+     * @param displacement the displacement
+     */
+    public PTXAddress(Register base, long displacement) {
+        this.base = base;
+        this.displacement = displacement;
+    }
+
+    /**
+     * @return Base register that defines the start of the address computation. If not present, is
+     *         denoted by {@link Value#ILLEGAL}.
+     */
+    public Register getBase() {
+        return base;
+    }
+
+    /**
+     * @return Optional additive displacement.
+     */
+    public long getDisplacement() {
+        return displacement;
+    }
+}
--- a/graal/com.oracle.graal.asm.ptx/src/com/oracle/graal/asm/ptx/PTXAssembler.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.asm.ptx/src/com/oracle/graal/asm/ptx/PTXAssembler.java	Fri Mar 08 15:58:08 2013 +0100
@@ -23,8 +23,6 @@
 package com.oracle.graal.asm.ptx;
 
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.ptx.*;
 
 public class PTXAssembler extends AbstractPTXAssembler {
 
@@ -177,7 +175,7 @@
         emitString("exit;" + " " + "");
     }
 
-    public final void ld_global_b8(Register d, Register a, int immOff) {
+    public final void ld_global_b8(Register d, Register a, long immOff) {
         emitString("ld.global.b8" + " " + "%r" + d.encoding() + ", [%r" + a.encoding() + " + " + immOff + "]" + ";" + "");
     }
 
@@ -742,8 +740,8 @@
     }
 
     @Override
-    public PTXAddress makeAddress(Kind kind, Value base, int displacement) {
-        return new PTXAddress(kind, base, displacement);
+    public PTXAddress makeAddress(Register base, int displacement) {
+        return new PTXAddress(base, displacement);
     }
 
     @Override
--- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java	Fri Mar 08 15:58:08 2013 +0100
@@ -23,7 +23,6 @@
 package com.oracle.graal.asm.sparc;
 
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.sparc.*;
 
@@ -55,13 +54,13 @@
     }
 
     @Override
-    public Address makeAddress(Kind kind, Value base, int displacement) {
+    public AbstractAddress makeAddress(Register base, int displacement) {
         // SPARC: Implement address calculation.
         return null;
     }
 
     @Override
-    public Address getPlaceholder() {
+    public AbstractAddress getPlaceholder() {
         // SPARC: Implement address patching.
         return null;
     }
--- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AbstractAssembler.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AbstractAssembler.java	Fri Mar 08 15:58:08 2013 +0100
@@ -25,7 +25,6 @@
 import java.nio.*;
 
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 
 /**
  * The platform-independent base class for the assembler.
@@ -87,12 +86,12 @@
 
     /**
      * This is used by the TargetMethodAssembler to convert a {@link StackSlot} to an
-     * {@link Address}.
+     * {@link AbstractAddress}.
      */
-    public abstract Address makeAddress(Kind kind, Value base, int displacement);
+    public abstract AbstractAddress makeAddress(Register base, int displacement);
 
     /**
      * Returns a target specific placeholder address that can be used for code patching.
      */
-    public abstract Address getPlaceholder();
+    public abstract AbstractAddress getPlaceholder();
 }
--- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Fri Mar 08 15:58:08 2013 +0100
@@ -34,6 +34,7 @@
 import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
+import com.oracle.graal.asm.amd64.AMD64Address.Scale;
 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.compiler.target.*;
@@ -158,56 +159,64 @@
         append(createMove(dst, src));
     }
 
-    private AMD64Address prepareAddress(Kind kind, Value base, int displacement, Value index, int scale) {
-        Value baseRegister = base;
+    private AMD64AddressValue prepareAddress(Kind kind, Value base, int displacement, Value index, int scale) {
+        AllocatableValue baseRegister;
         int finalDisp = displacement;
         if (isConstant(base)) {
             if (asConstant(base).isNull()) {
-                baseRegister = Value.ILLEGAL;
+                baseRegister = AllocatableValue.UNUSED;
             } else if (asConstant(base).getKind() != Kind.Object) {
                 long newDisplacement = displacement + asConstant(base).asLong();
                 if (NumUtil.isInt(newDisplacement)) {
                     assert !runtime.needsDataPatch(asConstant(base));
                     finalDisp = (int) newDisplacement;
-                    baseRegister = Value.ILLEGAL;
+                    baseRegister = AllocatableValue.UNUSED;
                 } else {
-                    Value newBase = newVariable(Kind.Long);
+                    Variable newBase = newVariable(Kind.Long);
                     emitMove(newBase, base);
                     baseRegister = newBase;
                 }
+            } else {
+                baseRegister = load(base);
             }
+        } else if (base == Value.ILLEGAL) {
+            baseRegister = AllocatableValue.UNUSED;
+        } else {
+            baseRegister = asAllocatable(base);
         }
 
-        Value indexRegister = index;
-        AMD64Address.Scale scaleEnum;
-        if (index != Value.ILLEGAL && scale > 0) {
-            scaleEnum = AMD64Address.Scale.fromInt(scale);
+        AllocatableValue indexRegister;
+        Scale scaleEnum;
+        if (index != Value.ILLEGAL && scale != 0) {
+            scaleEnum = Scale.fromInt(scale);
             if (isConstant(index)) {
                 long newDisplacement = finalDisp + asConstant(index).asLong() * scale;
                 // only use the constant index if the resulting displacement fits into a 32 bit
                 // offset
                 if (NumUtil.isInt(newDisplacement)) {
                     finalDisp = (int) newDisplacement;
-                    indexRegister = Value.ILLEGAL;
+                    indexRegister = AllocatableValue.UNUSED;
                 } else {
                     // create a temporary variable for the index, the pointer load cannot handle a
                     // constant index
-                    Value newIndex = newVariable(Kind.Long);
+                    Variable newIndex = newVariable(Kind.Long);
                     emitMove(newIndex, index);
                     indexRegister = newIndex;
                 }
+            } else {
+                indexRegister = asAllocatable(index);
             }
         } else {
-            indexRegister = Value.ILLEGAL;
-            scaleEnum = AMD64Address.Scale.Times1;
+            indexRegister = AllocatableValue.UNUSED;
+            scaleEnum = Scale.Times1;
         }
 
-        return new AMD64Address(kind, baseRegister, indexRegister, scaleEnum, finalDisp);
+        return new AMD64AddressValue(kind, baseRegister, indexRegister, scaleEnum, finalDisp);
     }
 
     @Override
     public Variable emitLoad(Kind kind, Value base, int displacement, Value index, int scale, boolean canTrap) {
-        AMD64Address loadAddress = prepareAddress(kind, base, displacement, index, scale);
+        AMD64AddressValue loadAddress = prepareAddress(kind, base, displacement, index, scale);
         Variable result = newVariable(loadAddress.getKind());
         append(new LoadOp(result, loadAddress, canTrap ? state() : null));
         return result;
@@ -215,7 +224,7 @@
 
     @Override
     public void emitStore(Kind kind, Value base, int displacement, Value index, int scale, Value inputVal, boolean canTrap) {
-        AMD64Address storeAddress = prepareAddress(kind, base, displacement, index, scale);
+        AMD64AddressValue storeAddress = prepareAddress(kind, base, displacement, index, scale);
         LIRFrameState state = canTrap ? state() : null;
 
         if (isConstant(inputVal)) {
@@ -233,7 +242,7 @@
     @Override
     public Variable emitLea(Value base, int displacement, Value index, int scale) {
         Variable result = newVariable(target().wordKind);
-        AMD64Address address = prepareAddress(result.getKind(), base, displacement, index, scale);
+        AMD64AddressValue address = prepareAddress(result.getKind(), base, displacement, index, scale);
         append(new LeaOp(result, address));
         return result;
     }
@@ -922,15 +931,15 @@
         Value expected = loadNonConst(operand(node.expected()));
         Variable newValue = load(operand(node.newValue()));
 
-        AMD64Address address;
+        AMD64AddressValue address;
         int displacement = node.displacement();
         Value index = operand(node.offset());
         if (isConstant(index) && NumUtil.isInt(asConstant(index).asLong() + displacement)) {
             assert !runtime.needsDataPatch(asConstant(index));
             displacement += (int) asConstant(index).asLong();
-            address = new AMD64Address(kind, load(operand(node.object())), displacement);
+            address = new AMD64AddressValue(kind, load(operand(node.object())), displacement);
         } else {
-            address = new AMD64Address(kind, load(operand(node.object())), load(index), AMD64Address.Scale.Times1, displacement);
+            address = new AMD64AddressValue(kind, load(operand(node.object())), load(index), Scale.Times1, displacement);
         }
 
         RegisterValue rax = AMD64.rax.asValue(kind);
--- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java	Fri Mar 08 15:58:08 2013 +0100
@@ -36,11 +36,11 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.JumpOp;
+import com.oracle.graal.lir.ptx.*;
 import com.oracle.graal.lir.ptx.PTXArithmetic.Op1Stack;
 import com.oracle.graal.lir.ptx.PTXArithmetic.Op2Reg;
 import com.oracle.graal.lir.ptx.PTXArithmetic.Op2Stack;
 import com.oracle.graal.lir.ptx.PTXArithmetic.ShiftOp;
-import com.oracle.graal.lir.ptx.*;
 import com.oracle.graal.lir.ptx.PTXCompare.CompareOp;
 import com.oracle.graal.lir.ptx.PTXControlFlow.BranchOp;
 import com.oracle.graal.lir.ptx.PTXControlFlow.ReturnOp;
@@ -51,7 +51,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.java.*;
-import com.oracle.graal.ptx.*;
 
 /**
  * This class implements the PTX specific portion of the LIR generator.
@@ -114,40 +113,49 @@
         }
     }
 
-    private PTXAddress prepareAddress(Kind kind, Value base, int displacement, Value index, int scale) {
-        Value baseRegister = base;
+    private PTXAddressValue prepareAddress(Kind kind, Value base, int displacement, Value index, int scale) {
+        AllocatableValue baseRegister;
         long finalDisp = displacement;
         if (isConstant(base)) {
             if (asConstant(base).isNull()) {
-                baseRegister = Value.ILLEGAL;
+                baseRegister = AllocatableValue.UNUSED;
             } else if (asConstant(base).getKind() != Kind.Object) {
                 finalDisp += asConstant(base).asLong();
-                baseRegister = Value.ILLEGAL;
+                baseRegister = AllocatableValue.UNUSED;
+            } else {
+                baseRegister = load(base);
             }
+        } else if (base == Value.ILLEGAL) {
+            baseRegister = AllocatableValue.UNUSED;
+        } else {
+            baseRegister = asAllocatable(base);
         }
 
         if (index != Value.ILLEGAL) {
             if (isConstant(index)) {
                 finalDisp += asConstant(index).asLong() * scale;
             } else {
-                Value indexRegister = index;
+                Value indexRegister;
                 if (scale != 1) {
                     indexRegister = emitMul(index, Constant.forInt(scale));
+                } else {
+                    indexRegister = index;
                 }
-                if (baseRegister == Value.ILLEGAL) {
-                    baseRegister = indexRegister;
+
+                if (baseRegister == AllocatableValue.UNUSED) {
+                    baseRegister = asAllocatable(indexRegister);
                 } else {
                     baseRegister = emitAdd(baseRegister, indexRegister);
                 }
             }
         }
 
-        return new PTXAddress(kind, baseRegister, finalDisp);
+        return new PTXAddressValue(kind, baseRegister, finalDisp);
     }
 
     @Override
     public Variable emitLoad(Kind kind, Value base, int displacement, Value index, int scale, boolean canTrap) {
-        PTXAddress loadAddress = prepareAddress(kind, base, displacement, index, scale);
+        PTXAddressValue loadAddress = prepareAddress(kind, base, displacement, index, scale);
         Variable result = newVariable(loadAddress.getKind());
         append(new LoadOp(result, loadAddress, canTrap ? state() : null));
         return result;
@@ -155,7 +163,7 @@
 
     @Override
     public void emitStore(Kind kind, Value base, int displacement, Value index, int scale, Value inputVal, boolean canTrap) {
-        PTXAddress storeAddress = prepareAddress(kind, base, displacement, index, scale);
+        PTXAddressValue storeAddress = prepareAddress(kind, base, displacement, index, scale);
         Variable input = load(inputVal);
         append(new StoreOp(storeAddress, input, canTrap ? state() : null));
     }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Fri Mar 08 15:58:08 2013 +0100
@@ -68,13 +68,11 @@
 public abstract class GraalCompilerTest extends GraalTest {
 
     protected final GraalCodeCacheProvider runtime;
-    protected final GraalCompiler graalCompiler;
     protected final Backend backend;
 
     public GraalCompilerTest() {
         DebugEnvironment.initialize(System.out);
         this.runtime = Graal.getRequiredCapability(GraalCodeCacheProvider.class);
-        this.graalCompiler = Graal.getRequiredCapability(GraalCompiler.class);
         this.backend = Graal.getRequiredCapability(Backend.class);
     }
 
@@ -377,8 +375,7 @@
     }
 
     protected InstalledCode addMethod(final ResolvedJavaMethod method, final CompilationResult compResult) {
-        assert graalCompiler != null;
-        return Debug.scope("CodeInstall", new Object[]{graalCompiler, method}, new Callable<InstalledCode>() {
+        return Debug.scope("CodeInstall", new Object[]{runtime, method}, new Callable<InstalledCode>() {
 
             @Override
             public InstalledCode call() throws Exception {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Fri Mar 08 15:58:08 2013 +0100
@@ -51,7 +51,7 @@
                     final StructuredGraph graph, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts) {
         assert (method.getModifiers() & Modifier.NATIVE) == 0 : "compiling native methods is not supported";
 
-        return Debug.scope("GraalCompiler", new Object[]{graph, method}, new Callable<CompilationResult>() {
+        return Debug.scope("GraalCompiler", new Object[]{graph, method, runtime}, new Callable<CompilationResult>() {
 
             public CompilationResult call() {
                 final Assumptions assumptions = new Assumptions(GraalOptions.OptAssumptions);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java	Fri Mar 08 15:58:08 2013 +0100
@@ -417,8 +417,8 @@
     public final int operandNumber;
 
     /**
-     * The {@linkplain RegisterValue register}, {@linkplain StackSlot spill slot} or
-     * {@linkplain Address address} assigned to this interval.
+     * The {@linkplain RegisterValue register} or {@linkplain StackSlot spill slot} assigned to this
+     * interval.
      */
     private Value location;
 
@@ -515,8 +515,8 @@
     }
 
     /**
-     * Gets the {@linkplain RegisterValue register}, {@linkplain StackSlot spill slot} or
-     * {@linkplain Address address} assigned to this interval.
+     * Gets the {@linkplain RegisterValue register} or {@linkplain StackSlot spill slot} assigned to
+     * this interval.
      */
     public Value location() {
         return location;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java	Fri Mar 08 15:58:08 2013 +0100
@@ -192,10 +192,10 @@
 
     // Traverse assignment graph in depth first order and generate moves in post order
     // ie. two assignments: b := c, a := b start with node c:
-    // Call graph: move(NULL, c) -> move(c, b) -> move(b, a)
+    // Call graph: move(c, NULL) -> move(b, c) -> move(a, b)
     // Generates moves in this order: move b to a and move c to b
     // ie. cycle a := b, b := a start with node a
-    // Call graph: move(NULL, a) -> move(a, b) -> move(b, a)
+    // Call graph: move(a, NULL) -> move(b, a) -> move(a, b)
     // Generates moves in this order: move b to temp, move a to b, move temp to a
     private void move(PhiResolverNode dest, PhiResolverNode src) {
         if (!dest.visited) {
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Fri Mar 08 15:58:08 2013 +0100
@@ -32,11 +32,12 @@
 
 import com.oracle.graal.amd64.*;
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.RuntimeCallTarget.*;
+import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
+import com.oracle.graal.asm.amd64.*;
+import com.oracle.graal.asm.amd64.AMD64Address.Scale;
 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
-import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.compiler.amd64.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.hotspot.*;
@@ -128,14 +129,14 @@
             Variable newVal = load(operand(x.newValue()));
 
             int disp = 0;
-            AMD64Address address;
+            AMD64AddressValue address;
             Value index = operand(x.offset());
             if (ValueUtil.isConstant(index) && NumUtil.isInt(ValueUtil.asConstant(index).asLong() + disp)) {
                 assert !runtime.needsDataPatch(asConstant(index));
                 disp += (int) ValueUtil.asConstant(index).asLong();
-                address = new AMD64Address(kind, load(operand(x.object())), disp);
+                address = new AMD64AddressValue(kind, load(operand(x.object())), disp);
             } else {
-                address = new AMD64Address(kind, load(operand(x.object())), load(index), AMD64Address.Scale.Times1, disp);
+                address = new AMD64AddressValue(kind, load(operand(x.object())), load(index), Scale.Times1, disp);
             }
 
             RegisterValue rax = AMD64.rax.asValue(kind);
@@ -203,7 +204,7 @@
                         disp -= frameSize;
                     }
                     tasm.blockComment("[stack overflow check]");
-                    asm.movq(new AMD64Address(asm.target.wordKind, AMD64.RSP, -disp), AMD64.rax);
+                    asm.movq(new AMD64Address(rsp, -disp), AMD64.rax);
                 }
             }
         }
@@ -223,7 +224,7 @@
             if (GraalOptions.ZapStackOnMethodEntry) {
                 final int intSize = 4;
                 for (int i = 0; i < frameSize / intSize; ++i) {
-                    asm.movl(new AMD64Address(Kind.Int, rsp.asValue(), i * intSize), 0xC1C1C1C1);
+                    asm.movl(new AMD64Address(rsp, i * intSize), 0xC1C1C1C1);
                 }
             }
             CalleeSaveLayout csl = frameMap.registerConfig.getCalleeSaveLayout();
@@ -287,7 +288,7 @@
             Register inlineCacheKlass = rax; // see definition of IC_Klass in
                                              // c1_LIRAssembler_x86.cpp
             Register receiver = asRegister(cc.getArgument(0));
-            AMD64Address src = new AMD64Address(target.wordKind, receiver.asValue(), config.hubOffset);
+            AMD64Address src = new AMD64Address(receiver, config.hubOffset);
 
             asm.cmpq(inlineCacheKlass, src);
             asm.jcc(ConditionFlag.NotEqual, unverifiedStub);
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64SafepointOp.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64SafepointOp.java	Fri Mar 08 15:58:08 2013 +0100
@@ -26,7 +26,6 @@
 import static com.oracle.graal.phases.GraalOptions.*;
 import sun.misc.*;
 
-import com.oracle.graal.amd64.*;
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.hotspot.*;
@@ -65,13 +64,13 @@
             asm.movq(scratch.getRegister(), config.safepointPollingAddress + offset);
             tasm.recordMark(Marks.MARK_POLL_FAR);
             tasm.recordSafepoint(pos, state);
-            asm.movq(scratch.getRegister(), new AMD64Address(tasm.target.wordKind, scratch));
+            asm.movq(scratch.getRegister(), new AMD64Address(scratch.getRegister()));
         } else {
             tasm.recordMark(Marks.MARK_POLL_NEAR);
             tasm.recordSafepoint(pos, state);
             // The C++ code transforms the polling page offset into an RIP displacement
             // to the real address at that offset in the polling page.
-            asm.movq(scratch.getRegister(), new AMD64Address(tasm.target.wordKind, rip.asValue(), offset));
+            asm.movq(scratch.getRegister(), new AMD64Address(rip, offset));
         }
     }
 }
--- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java	Fri Mar 08 15:58:08 2013 +0100
@@ -93,7 +93,6 @@
 
                 // return the initialized compiler to the client
                 HotSpotGraalRuntime compiler = initializeServer(toVM);
-                compiler.getCompiler();
                 streams.getInvocation().sendResult(compiler);
 
                 for (ConnectionObserver observer : observers) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Fri Mar 08 15:58:08 2013 +0100
@@ -177,7 +177,7 @@
     }
 
     private void installMethod(final CompilationResult tm) {
-        Debug.scope("CodeInstall", new Object[]{new DebugDumpScope(String.valueOf(id), true), graalRuntime.getCompiler(), method}, new Runnable() {
+        Debug.scope("CodeInstall", new Object[]{new DebugDumpScope(String.valueOf(id), true), graalRuntime.getRuntime(), method}, new Runnable() {
 
             @Override
             public void run() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Fri Mar 08 15:58:08 2013 +0100
@@ -30,7 +30,6 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.target.*;
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.logging.*;
@@ -110,7 +109,6 @@
     protected/* final */VMToCompiler vmToCompiler;
 
     protected final HotSpotRuntime runtime;
-    protected final GraalCompiler compiler;
     protected final TargetDescription target;
 
     private HotSpotRuntimeInterpreterInterface runtimeInterpreterInterface;
@@ -143,7 +141,6 @@
 
         backend = createBackend();
         GraalOptions.StackShadowPages = config.stackShadowPages;
-        compiler = new GraalCompiler();
         if (GraalOptions.CacheGraphs) {
             cache = new HotSpotGraphCache();
         }
@@ -178,10 +175,6 @@
         return target;
     }
 
-    public GraalCompiler getCompiler() {
-        return compiler;
-    }
-
     public HotSpotGraphCache getCache() {
         return cache;
     }
@@ -267,9 +260,6 @@
         if (clazz == HotSpotRuntime.class) {
             return (T) runtime;
         }
-        if (clazz == GraalCompiler.class) {
-            return (T) getCompiler();
-        }
         if (clazz == Backend.class) {
             return (T) getBackend();
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Mar 08 15:58:08 2013 +0100
@@ -361,8 +361,8 @@
 
         newInstanceStub = new NewInstanceStub(this, assumptions, graalRuntime.getTarget());
         newArrayStub = new NewArrayStub(this, assumptions, graalRuntime.getTarget());
-        newInstanceStub.install(backend, graalRuntime.getCompiler());
-        newArrayStub.install(backend, graalRuntime.getCompiler());
+        newInstanceStub.install(backend);
+        newArrayStub.install(backend);
     }
 
     public HotSpotGraalRuntime getGraalRuntime() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Fri Mar 08 15:58:08 2013 +0100
@@ -70,8 +70,8 @@
     protected InstalledCode stubCode;
 
     /**
-     * Creates a new stub container. The new stub still needs to be
-     * {@linkplain #install(Backend, GraalCompiler) installed}.
+     * Creates a new stub container. The new stub still needs to be {@linkplain #install(Backend)
+     * installed}.
      * 
      * @param descriptor linkage details for a call to the stub
      */
@@ -107,7 +107,7 @@
      * Compiles the code for this stub, installs it and initializes the address used for calls to
      * it.
      */
-    public void install(Backend backend, GraalCompiler compiler) {
+    public void install(Backend backend) {
         StructuredGraph graph = (StructuredGraph) stubMethod.getCompilerStorage().get(Graph.class);
 
         Key key = new Key(stubMethod);
@@ -121,7 +121,7 @@
         final CompilationResult compResult = GraalCompiler.compileMethod(runtime(), backend, runtime().getTarget(), stubMethod, graph, null, phasePlan, OptimisticOptimizations.ALL);
 
         final CodeInfo[] info = new CodeInfo[1];
-        stubCode = Debug.scope("CodeInstall", new Object[]{compiler, stubMethod}, new Callable<InstalledCode>() {
+        stubCode = Debug.scope("CodeInstall", new Object[]{runtime(), stubMethod}, new Callable<InstalledCode>() {
 
             @Override
             public InstalledCode call() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64AddressValue.java	Fri Mar 08 15:58:08 2013 +0100
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2013, 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.amd64;
+
+import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.asm.amd64.*;
+import com.oracle.graal.asm.amd64.AMD64Address.Scale;
+import com.oracle.graal.lir.*;
+
+public class AMD64AddressValue extends CompositeValue {
+
+    private static final long serialVersionUID = -4444600052487578694L;
+
+    @Component({REG, UNUSED}) protected AllocatableValue base;
+    @Component({REG, UNUSED}) protected AllocatableValue index;
+    protected final Scale scale;
+    protected final int displacement;
+
+    public AMD64AddressValue(Kind kind, AllocatableValue base, int displacement) {
+        this(kind, base, AllocatableValue.UNUSED, Scale.Times1, displacement);
+    }
+
+    public AMD64AddressValue(Kind kind, AllocatableValue base, AllocatableValue index, Scale scale, int displacement) {
+        super(kind);
+        this.base = base;
+        this.index = index;
+        this.scale = scale;
+        this.displacement = displacement;
+    }
+
+    private static Register toRegister(AllocatableValue value) {
+        if (value == AllocatableValue.UNUSED) {
+            return Register.None;
+        } else {
+            RegisterValue reg = (RegisterValue) value;
+            return reg.getRegister();
+        }
+    }
+
+    public AMD64Address toAddress() {
+        return new AMD64Address(toRegister(base), toRegister(index), scale, displacement);
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder s = new StringBuilder();
+        s.append(getKind().getJavaName()).append("[");
+        String sep = "";
+        if (isLegal(base)) {
+            s.append(base);
+            sep = " + ";
+        }
+        if (isLegal(index)) {
+            s.append(sep).append(index).append(" * ").append(scale.value);
+            sep = " + ";
+        }
+        if (displacement < 0) {
+            s.append(" - ").append(-displacement);
+        } else if (displacement > 0) {
+            s.append(sep).append(displacement);
+        }
+        s.append("]");
+        return s.toString();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof AMD64AddressValue) {
+            AMD64AddressValue addr = (AMD64AddressValue) obj;
+            return getKind() == addr.getKind() && displacement == addr.displacement && base.equals(addr.base) && scale == addr.scale && index.equals(addr.index);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return base.hashCode() ^ index.hashCode() ^ (displacement << 4) ^ (scale.value << 8) ^ (getKind().ordinal() << 12);
+    }
+}
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BitManipulationOp.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BitManipulationOp.java	Fri Mar 08 15:58:08 2013 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import com.oracle.graal.amd64.*;
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java	Fri Mar 08 15:58:08 2013 +0100
@@ -25,7 +25,6 @@
 import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.amd64.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.graph.*;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java	Fri Mar 08 15:58:08 2013 +0100
@@ -26,13 +26,13 @@
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.amd64.AMD64Address.Scale;
+import com.oracle.graal.api.code.CompilationResult.JumpTable;
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CompilationResult.JumpTable;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
+import com.oracle.graal.asm.amd64.*;
+import com.oracle.graal.asm.amd64.AMD64Address.Scale;
 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
-import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.Opcode;
@@ -338,11 +338,11 @@
 
         // Set scratch to address of jump table
         int leaPos = buf.position();
-        masm.leaq(scratch, new AMD64Address(tasm.target.wordKind, AMD64.rip.asValue(), 0));
+        masm.leaq(scratch, new AMD64Address(AMD64.rip, 0));
         int afterLea = buf.position();
 
         // Load jump table entry into scratch and jump to it
-        masm.movslq(value, new AMD64Address(Kind.Int, scratch.asValue(), value.asValue(), Scale.Times4, 0));
+        masm.movslq(value, new AMD64Address(scratch, value, Scale.Times4, 0));
         masm.addq(scratch, value);
         masm.jmp(scratch);
 
@@ -354,7 +354,7 @@
         // Patch LEA instruction above now that we know the position of the jump table
         int jumpTablePos = buf.position();
         buf.setPosition(leaPos);
-        masm.leaq(scratch, new AMD64Address(tasm.target.wordKind, AMD64.rip.asValue(), jumpTablePos - afterLea));
+        masm.leaq(scratch, new AMD64Address(AMD64.rip, jumpTablePos - afterLea));
         buf.setPosition(jumpTablePos);
 
         // Emit jump table entries
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Fri Mar 08 15:58:08 2013 +0100
@@ -97,10 +97,10 @@
 
     public abstract static class MemOp extends AMD64LIRInstruction {
 
-        @Use({ADDR}) protected AMD64Address address;
+        @Use({COMPOSITE}) protected AMD64AddressValue address;
         @State protected LIRFrameState state;
 
-        public MemOp(AMD64Address address, LIRFrameState state) {
+        public MemOp(AMD64AddressValue address, LIRFrameState state) {
             this.address = address;
             this.state = state;
         }
@@ -120,7 +120,7 @@
 
         @Def({REG}) protected AllocatableValue result;
 
-        public LoadOp(AllocatableValue result, AMD64Address address, LIRFrameState state) {
+        public LoadOp(AllocatableValue result, AMD64AddressValue address, LIRFrameState state) {
             super(address, state);
             this.result = result;
         }
@@ -130,28 +130,28 @@
             switch (address.getKind()) {
                 case Boolean:
                 case Byte:
-                    masm.movsxb(asRegister(result), address);
+                    masm.movsxb(asRegister(result), address.toAddress());
                     break;
                 case Char:
-                    masm.movzxl(asRegister(result), address);
+                    masm.movzxl(asRegister(result), address.toAddress());
                     break;
                 case Short:
-                    masm.movswl(asRegister(result), address);
+                    masm.movswl(asRegister(result), address.toAddress());
                     break;
                 case Int:
-                    masm.movslq(asRegister(result), address);
+                    masm.movslq(asRegister(result), address.toAddress());
                     break;
                 case Long:
-                    masm.movq(asRegister(result), address);
+                    masm.movq(asRegister(result), address.toAddress());
                     break;
                 case Float:
-                    masm.movflt(asFloatReg(result), address);
+                    masm.movflt(asFloatReg(result), address.toAddress());
                     break;
                 case Double:
-                    masm.movdbl(asDoubleReg(result), address);
+                    masm.movdbl(asDoubleReg(result), address.toAddress());
                     break;
                 case Object:
-                    masm.movq(asRegister(result), address);
+                    masm.movq(asRegister(result), address.toAddress());
                     break;
                 default:
                     throw GraalInternalError.shouldNotReachHere();
@@ -163,7 +163,7 @@
 
         @Use({REG}) protected AllocatableValue input;
 
-        public StoreOp(AMD64Address address, AllocatableValue input, LIRFrameState state) {
+        public StoreOp(AMD64AddressValue address, AllocatableValue input, LIRFrameState state) {
             super(address, state);
             this.input = input;
         }
@@ -174,26 +174,26 @@
             switch (address.getKind()) {
                 case Boolean:
                 case Byte:
-                    masm.movb(address, asRegister(input));
+                    masm.movb(address.toAddress(), asRegister(input));
                     break;
                 case Char:
                 case Short:
-                    masm.movw(address, asRegister(input));
+                    masm.movw(address.toAddress(), asRegister(input));
                     break;
                 case Int:
-                    masm.movl(address, asRegister(input));
+                    masm.movl(address.toAddress(), asRegister(input));
                     break;
                 case Long:
-                    masm.movq(address, asRegister(input));
+                    masm.movq(address.toAddress(), asRegister(input));
                     break;
                 case Float:
-                    masm.movflt(address, asFloatReg(input));
+                    masm.movflt(address.toAddress(), asFloatReg(input));
                     break;
                 case Double:
-                    masm.movsd(address, asDoubleReg(input));
+                    masm.movsd(address.toAddress(), asDoubleReg(input));
                     break;
                 case Object:
-                    masm.movq(address, asRegister(input));
+                    masm.movq(address.toAddress(), asRegister(input));
                     break;
                 default:
                     throw GraalInternalError.shouldNotReachHere();
@@ -205,7 +205,7 @@
 
         protected final Constant input;
 
-        public StoreConstantOp(AMD64Address address, Constant input, LIRFrameState state) {
+        public StoreConstantOp(AMD64AddressValue address, Constant input, LIRFrameState state) {
             super(address, state);
             this.input = input;
         }
@@ -215,30 +215,30 @@
             switch (address.getKind()) {
                 case Boolean:
                 case Byte:
-                    masm.movb(address, input.asInt() & 0xFF);
+                    masm.movb(address.toAddress(), input.asInt() & 0xFF);
                     break;
                 case Char:
                 case Short:
-                    masm.movw(address, input.asInt() & 0xFFFF);
+                    masm.movw(address.toAddress(), input.asInt() & 0xFFFF);
                     break;
                 case Int:
-                    masm.movl(address, input.asInt());
+                    masm.movl(address.toAddress(), input.asInt());
                     break;
                 case Long:
                     if (NumUtil.isInt(input.asLong())) {
-                        masm.movslq(address, (int) input.asLong());
+                        masm.movslq(address.toAddress(), (int) input.asLong());
                     } else {
                         throw GraalInternalError.shouldNotReachHere("Cannot store 64-bit constants to memory");
                     }
                     break;
                 case Float:
-                    masm.movl(address, floatToRawIntBits(input.asFloat()));
+                    masm.movl(address.toAddress(), floatToRawIntBits(input.asFloat()));
                     break;
                 case Double:
                     throw GraalInternalError.shouldNotReachHere("Cannot store 64-bit constants to memory");
                 case Object:
                     if (input.isNull()) {
-                        masm.movptr(address, 0);
+                        masm.movptr(address.toAddress(), 0);
                     } else {
                         throw GraalInternalError.shouldNotReachHere("Cannot store 64-bit constants to memory");
                     }
@@ -252,16 +252,16 @@
     public static class LeaOp extends AMD64LIRInstruction {
 
         @Def({REG}) protected AllocatableValue result;
-        @Use({ADDR, UNINITIALIZED}) protected AMD64Address address;
+        @Use({COMPOSITE, UNINITIALIZED}) protected AMD64AddressValue address;
 
-        public LeaOp(AllocatableValue result, AMD64Address address) {
+        public LeaOp(AllocatableValue result, AMD64AddressValue address) {
             this.result = result;
             this.address = address;
         }
 
         @Override
         public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-            masm.leaq(asLongReg(result), address);
+            masm.leaq(asLongReg(result), address.toAddress());
         }
     }
 
@@ -316,11 +316,11 @@
     public static class CompareAndSwapOp extends AMD64LIRInstruction {
 
         @Def protected AllocatableValue result;
-        @Use({ADDR}) protected AMD64Address address;
+        @Use({COMPOSITE}) protected AMD64AddressValue address;
         @Use protected AllocatableValue cmpValue;
         @Use protected AllocatableValue newValue;
 
-        public CompareAndSwapOp(AllocatableValue result, AMD64Address address, AllocatableValue cmpValue, AllocatableValue newValue) {
+        public CompareAndSwapOp(AllocatableValue result, AMD64AddressValue address, AllocatableValue cmpValue, AllocatableValue newValue) {
             this.result = result;
             this.address = address;
             this.cmpValue = cmpValue;
@@ -523,7 +523,7 @@
         }
     }
 
-    protected static void compareAndSwap(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AllocatableValue result, AMD64Address address, AllocatableValue cmpValue, AllocatableValue newValue) {
+    protected static void compareAndSwap(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AllocatableValue result, AMD64AddressValue address, AllocatableValue cmpValue, AllocatableValue newValue) {
         assert asRegister(cmpValue) == AMD64.rax && asRegister(result) == AMD64.rax;
 
         if (tasm.target.isMP) {
@@ -531,11 +531,11 @@
         }
         switch (cmpValue.getKind()) {
             case Int:
-                masm.cmpxchgl(asRegister(newValue), address);
+                masm.cmpxchgl(asRegister(newValue), address.toAddress());
                 break;
             case Long:
             case Object:
-                masm.cmpxchgq(asRegister(newValue), address);
+                masm.cmpxchgq(asRegister(newValue), address.toAddress());
                 break;
             default:
                 throw GraalInternalError.shouldNotReachHere();
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64TestOp.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64TestOp.java	Fri Mar 08 15:58:08 2013 +0100
@@ -25,7 +25,6 @@
 import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.amd64.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.graph.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXAddressValue.java	Fri Mar 08 15:58:08 2013 +0100
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2013, 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.ptx;
+
+import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.asm.ptx.*;
+import com.oracle.graal.lir.*;
+
+/**
+ * Represents an address in target machine memory, specified via some combination of a base register
+ * and a displacement.
+ */
+public final class PTXAddressValue extends CompositeValue {
+
+    private static final long serialVersionUID = 1802222435353022623L;
+
+    @Component({REG, UNUSED}) private AllocatableValue base;
+    private final long displacement;
+
+    /**
+     * Creates an {@link PTXAddressValue} with given base register and no displacement.
+     * 
+     * @param kind the kind of the value being addressed
+     * @param base the base register
+     */
+    public PTXAddressValue(Kind kind, AllocatableValue base) {
+        this(kind, base, 0);
+    }
+
+    /**
+     * Creates an {@link PTXAddressValue} with given base register and a displacement. This is the
+     * most general constructor.
+     * 
+     * @param kind the kind of the value being addressed
+     * @param base the base register
+     * @param displacement the displacement
+     */
+    public PTXAddressValue(Kind kind, AllocatableValue base, long displacement) {
+        super(kind);
+        this.base = base;
+        this.displacement = displacement;
+
+        assert !isStackSlot(base);
+    }
+
+    public PTXAddress toAddress() {
+        Register baseReg = base == AllocatableValue.UNUSED ? Register.None : asRegister(base);
+        return new PTXAddress(baseReg, displacement);
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder s = new StringBuilder();
+        s.append(getKind().getJavaName()).append("[");
+        String sep = "";
+        if (isLegal(base)) {
+            s.append(base);
+            sep = " + ";
+        }
+        if (displacement < 0) {
+            s.append(" - ").append(-displacement);
+        } else if (displacement > 0) {
+            s.append(sep).append(displacement);
+        }
+        s.append("]");
+        return s.toString();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof PTXAddressValue) {
+            PTXAddressValue addr = (PTXAddressValue) obj;
+            return getKind() == addr.getKind() && displacement == addr.displacement && base.equals(addr.base);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return base.hashCode() ^ ((int) displacement << 4) ^ (getKind().ordinal() << 12);
+    }
+}
--- a/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXBitManipulationOp.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXBitManipulationOp.java	Fri Mar 08 15:58:08 2013 +0100
@@ -36,7 +36,7 @@
 
     @Opcode private final IntrinsicOpcode opcode;
     @Def protected Value result;
-    @Use({OperandFlag.REG, OperandFlag.ADDR}) protected Value input;
+    @Use({OperandFlag.REG}) protected Value input;
 
     public PTXBitManipulationOp(IntrinsicOpcode opcode, Value result, Value input) {
         this.opcode = opcode;
--- a/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXMove.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXMove.java	Fri Mar 08 15:58:08 2013 +0100
@@ -33,7 +33,6 @@
 import com.oracle.graal.lir.LIRInstruction.Opcode;
 import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.lir.asm.*;
-import com.oracle.graal.ptx.*;
 
 public class PTXMove {
 
@@ -121,10 +120,10 @@
     public static class LoadOp extends PTXLIRInstruction {
 
         @Def({REG}) protected AllocatableValue result;
-        @Use({ADDR}) protected PTXAddress address;
+        @Use({COMPOSITE}) protected PTXAddressValue address;
         @State protected LIRFrameState state;
 
-        public LoadOp(AllocatableValue result, PTXAddress address, LIRFrameState state) {
+        public LoadOp(AllocatableValue result, PTXAddressValue address, LIRFrameState state) {
             this.result = result;
             this.address = address;
             this.state = state;
@@ -132,14 +131,13 @@
 
         @Override
         public void emitCode(TargetMethodAssembler tasm, PTXAssembler masm) {
-            Register a = asRegister(address.getBase());
-            long immOff = address.getDisplacement();
+            PTXAddress addr = address.toAddress();
             switch (address.getKind()) {
                 case Int:
-                    masm.ld_global_s32(asRegister(result), a, immOff);
+                    masm.ld_global_s32(asRegister(result), addr.getBase(), addr.getDisplacement());
                     break;
                 case Object:
-                    masm.ld_global_u32(asRegister(result), a, immOff);
+                    masm.ld_global_u32(asRegister(result), addr.getBase(), addr.getDisplacement());
                     break;
                 default:
                     throw GraalInternalError.shouldNotReachHere();
@@ -149,11 +147,11 @@
 
     public static class StoreOp extends PTXLIRInstruction {
 
-        @Use({ADDR}) protected PTXAddress address;
+        @Use({COMPOSITE}) protected PTXAddressValue address;
         @Use({REG}) protected AllocatableValue input;
         @State protected LIRFrameState state;
 
-        public StoreOp(PTXAddress address, AllocatableValue input, LIRFrameState state) {
+        public StoreOp(PTXAddressValue address, AllocatableValue input, LIRFrameState state) {
             this.address = address;
             this.input = input;
             this.state = state;
@@ -161,13 +159,11 @@
 
         @Override
         public void emitCode(TargetMethodAssembler tasm, PTXAssembler masm) {
-            Register a = asRegister(address.getBase());
-            long immOff = address.getDisplacement();
-
             assert isRegister(input);
+            PTXAddress addr = address.toAddress();
             switch (address.getKind()) {
                 case Int:
-                    masm.st_global_s32(a, immOff, asRegister(input));
+                    masm.st_global_s32(addr.getBase(), addr.getDisplacement(), asRegister(input));
                     break;
                 default:
                     throw GraalInternalError.shouldNotReachHere();
@@ -178,9 +174,9 @@
     public static class LeaOp extends PTXLIRInstruction {
 
         @Def({REG}) protected AllocatableValue result;
-        @Use({ADDR, UNINITIALIZED}) protected PTXAddress address;
+        @Use({COMPOSITE, UNINITIALIZED}) protected PTXAddressValue address;
 
-        public LeaOp(AllocatableValue result, PTXAddress address) {
+        public LeaOp(AllocatableValue result, PTXAddressValue address) {
             this.result = result;
             this.address = address;
         }
@@ -211,11 +207,11 @@
     public static class CompareAndSwapOp extends PTXLIRInstruction {
 
         @Def protected AllocatableValue result;
-        @Use({ADDR}) protected PTXAddress address;
+        @Use({COMPOSITE}) protected PTXAddressValue address;
         @Use protected AllocatableValue cmpValue;
         @Use protected AllocatableValue newValue;
 
-        public CompareAndSwapOp(AllocatableValue result, PTXAddress address, AllocatableValue cmpValue, AllocatableValue newValue) {
+        public CompareAndSwapOp(AllocatableValue result, PTXAddressValue address, AllocatableValue cmpValue, AllocatableValue newValue) {
             this.result = result;
             this.address = address;
             this.cmpValue = cmpValue;
@@ -276,7 +272,7 @@
     }
 
     @SuppressWarnings("unused")
-    protected static void compareAndSwap(TargetMethodAssembler tasm, PTXAssembler masm, AllocatableValue result, PTXAddress address, AllocatableValue cmpValue, AllocatableValue newValue) {
+    protected static void compareAndSwap(TargetMethodAssembler tasm, PTXAssembler masm, AllocatableValue result, PTXAddressValue address, AllocatableValue cmpValue, AllocatableValue newValue) {
         throw new InternalError("NYI");
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValue.java	Fri Mar 08 15:58:08 2013 +0100
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013, 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 java.lang.annotation.*;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.lir.LIRInstruction.OperandFlag;
+import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.graal.lir.LIRInstruction.ValueProcedure;
+
+/**
+ * Base class to represent values that need to be stored in more than one register.
+ */
+public abstract class CompositeValue extends Value {
+
+    private static final long serialVersionUID = -169180052684126180L;
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.FIELD)
+    public static @interface Component {
+
+        OperandFlag[] value() default OperandFlag.REG;
+    }
+
+    private final CompositeValueClass valueClass;
+
+    public CompositeValue(Kind kind) {
+        super(kind);
+        valueClass = CompositeValueClass.get(getClass());
+    }
+
+    public final void forEachComponent(OperandMode mode, ValueProcedure proc) {
+        valueClass.forEachComponent(this, mode, proc);
+    }
+
+    @Override
+    public String toString() {
+        return valueClass.toString(this);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java	Fri Mar 08 15:58:08 2013 +0100
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2013, 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 java.lang.reflect.*;
+import java.util.*;
+
+import com.oracle.graal.graph.*;
+import com.oracle.graal.lir.LIRInstruction.OperandFlag;
+import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.graal.lir.LIRInstruction.ValueProcedure;
+
+public class CompositeValueClass extends LIRIntrospection {
+
+    public static final CompositeValueClass get(Class<? extends CompositeValue> c) {
+        CompositeValueClass clazz = (CompositeValueClass) allClasses.get(c);
+        if (clazz != null) {
+            return clazz;
+        }
+
+        // We can have a race of multiple threads creating the LIRInstructionClass at the same time.
+        // However, only one will be put into the map, and this is the one returned by all threads.
+        clazz = new CompositeValueClass(c);
+        CompositeValueClass oldClazz = (CompositeValueClass) allClasses.putIfAbsent(c, clazz);
+        if (oldClazz != null) {
+            return oldClazz;
+        } else {
+            return clazz;
+        }
+    }
+
+    private final int directComponentCount;
+    private final long[] componentOffsets;
+    private final EnumSet<OperandFlag>[] componentFlags;
+
+    @SuppressWarnings("unchecked")
+    public CompositeValueClass(Class<? extends CompositeValue> clazz) {
+        super(clazz);
+
+        ValueFieldScanner scanner = new ValueFieldScanner(new DefaultCalcOffset());
+        scanner.scan(clazz);
+
+        OperandModeAnnotation mode = scanner.valueAnnotations.get(CompositeValue.Component.class);
+        directComponentCount = mode.scalarOffsets.size();
+        componentOffsets = sortedLongCopy(mode.scalarOffsets, mode.arrayOffsets);
+        componentFlags = arrayUsingSortedOffsets(mode.flags, componentOffsets, new EnumSet[componentOffsets.length]);
+
+        dataOffsets = sortedLongCopy(scanner.dataOffsets);
+
+        fieldNames = scanner.fieldNames;
+        fieldTypes = scanner.fieldTypes;
+    }
+
+    @Override
+    protected void rescanFieldOffsets(CalcOffset calc) {
+        ValueFieldScanner scanner = new ValueFieldScanner(calc);
+        scanner.scan(clazz);
+
+        OperandModeAnnotation mode = scanner.valueAnnotations.get(CompositeValue.Component.class);
+        copyInto(componentOffsets, sortedLongCopy(mode.scalarOffsets, mode.arrayOffsets));
+
+        copyInto(dataOffsets, sortedLongCopy(scanner.dataOffsets));
+
+        fieldNames.clear();
+        fieldNames.putAll(scanner.fieldNames);
+        fieldTypes.clear();
+        fieldTypes.putAll(scanner.fieldTypes);
+    }
+
+    private static class ValueFieldScanner extends FieldScanner {
+
+        public ValueFieldScanner(CalcOffset calc) {
+            super(calc);
+
+            valueAnnotations.put(CompositeValue.Component.class, new OperandModeAnnotation());
+        }
+
+        @Override
+        protected void scan(Class<?> clazz) {
+            super.scan(clazz);
+        }
+
+        @Override
+        protected EnumSet<OperandFlag> getFlags(Field field) {
+            EnumSet<OperandFlag> result = EnumSet.noneOf(OperandFlag.class);
+            if (field.isAnnotationPresent(CompositeValue.Component.class)) {
+                result.addAll(Arrays.asList(field.getAnnotation(CompositeValue.Component.class).value()));
+            } else {
+                GraalInternalError.shouldNotReachHere();
+            }
+            return result;
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder str = new StringBuilder();
+        str.append(getClass().getSimpleName()).append(" ").append(clazz.getSimpleName()).append(" component[");
+        for (int i = 0; i < componentOffsets.length; i++) {
+            str.append(i == 0 ? "" : ", ").append(componentOffsets[i]);
+        }
+        str.append("] data[");
+        for (int i = 0; i < dataOffsets.length; i++) {
+            str.append(i == 0 ? "" : ", ").append(dataOffsets[i]);
+        }
+        str.append("]");
+        return str.toString();
+    }
+
+    public final void forEachComponent(CompositeValue obj, OperandMode mode, ValueProcedure proc) {
+        forEach(obj, directComponentCount, componentOffsets, mode, componentFlags, proc);
+    }
+
+    public String toString(CompositeValue obj) {
+        StringBuilder result = new StringBuilder();
+
+        appendValues(result, obj, "", "", "{", "}", new String[]{""}, componentOffsets);
+
+        for (int i = 0; i < dataOffsets.length; i++) {
+            result.append(" ").append(fieldNames.get(dataOffsets[i])).append(": ").append(getFieldString(obj, dataOffsets[i]));
+        }
+
+        return result.toString();
+    }
+}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java	Fri Mar 08 15:58:08 2013 +0100
@@ -166,9 +166,9 @@
         STACK,
 
         /**
-         * The value can be a {@link Address}.
+         * The value can be a {@link CompositeValue}.
          */
-        ADDR,
+        COMPOSITE,
 
         /**
          * The value can be a {@link Constant}.
@@ -205,10 +205,10 @@
 
     static {
         ALLOWED_FLAGS = new EnumMap<>(OperandMode.class);
-        ALLOWED_FLAGS.put(USE, EnumSet.of(REG, STACK, ADDR, CONST, ILLEGAL, HINT, UNINITIALIZED));
-        ALLOWED_FLAGS.put(ALIVE, EnumSet.of(REG, STACK, ADDR, CONST, ILLEGAL, HINT, UNINITIALIZED));
-        ALLOWED_FLAGS.put(TEMP, EnumSet.of(REG, CONST, ILLEGAL, HINT));
-        ALLOWED_FLAGS.put(DEF, EnumSet.of(REG, STACK, ILLEGAL, HINT));
+        ALLOWED_FLAGS.put(USE, EnumSet.of(REG, STACK, COMPOSITE, CONST, ILLEGAL, HINT, UNUSED, UNINITIALIZED));
+        ALLOWED_FLAGS.put(ALIVE, EnumSet.of(REG, STACK, COMPOSITE, CONST, ILLEGAL, HINT, UNUSED, UNINITIALIZED));
+        ALLOWED_FLAGS.put(TEMP, EnumSet.of(REG, COMPOSITE, CONST, ILLEGAL, UNUSED, HINT));
+        ALLOWED_FLAGS.put(DEF, EnumSet.of(REG, STACK, COMPOSITE, ILLEGAL, UNUSED, HINT));
     }
 
     /**
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java	Fri Mar 08 15:58:08 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -22,12 +22,8 @@
  */
 package com.oracle.graal.lir;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
-
-import java.lang.annotation.*;
 import java.lang.reflect.*;
 import java.util.*;
-import java.util.Map.Entry;
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
@@ -37,7 +33,7 @@
 import com.oracle.graal.lir.LIRInstruction.StateProcedure;
 import com.oracle.graal.lir.LIRInstruction.ValueProcedure;
 
-public class LIRInstructionClass extends FieldIntrospection {
+public class LIRInstructionClass extends LIRIntrospection {
 
     public static final LIRInstructionClass get(Class<? extends LIRInstruction> c) {
         LIRInstructionClass clazz = (LIRInstructionClass) allClasses.get(c);
@@ -56,11 +52,8 @@
         }
     }
 
-    private static final Class<?> INSTRUCTION_CLASS = LIRInstruction.class;
-    private static final Class<?> VALUE_CLASS = Value.class;
-    private static final Class<?> CONSTANT_CLASS = Constant.class;
-    private static final Class<?> VALUE_ARRAY_CLASS = Value[].class;
-    private static final Class<?> STATE_CLASS = LIRFrameState.class;
+    private static final Class<LIRInstruction> INSTRUCTION_CLASS = LIRInstruction.class;
+    private static final Class<LIRFrameState> STATE_CLASS = LIRFrameState.class;
 
     private final int directUseCount;
     private final long[] useOffsets;
@@ -81,11 +74,11 @@
     private long opcodeOffset;
 
     @SuppressWarnings("unchecked")
-    public LIRInstructionClass(Class<?> clazz) {
+    public LIRInstructionClass(Class<? extends LIRInstruction> clazz) {
         super(clazz);
         assert INSTRUCTION_CLASS.isAssignableFrom(clazz);
 
-        FieldScanner scanner = new FieldScanner(new DefaultCalcOffset());
+        InstructionFieldScanner scanner = new InstructionFieldScanner(new DefaultCalcOffset());
         scanner.scan(clazz);
 
         OperandModeAnnotation mode = scanner.valueAnnotations.get(LIRInstruction.Use.class);
@@ -120,7 +113,7 @@
 
     @Override
     protected void rescanFieldOffsets(CalcOffset calc) {
-        FieldScanner scanner = new FieldScanner(calc);
+        InstructionFieldScanner scanner = new InstructionFieldScanner(calc);
         scanner.scan(clazz);
 
         OperandModeAnnotation mode = scanner.valueAnnotations.get(LIRInstruction.Use.class);
@@ -144,44 +137,22 @@
         opcodeOffset = scanner.opcodeOffset;
     }
 
-    private static class OperandModeAnnotation {
-
-        public final ArrayList<Long> scalarOffsets = new ArrayList<>();
-        public final ArrayList<Long> arrayOffsets = new ArrayList<>();
-        public final Map<Long, EnumSet<OperandFlag>> flags = new HashMap<>();
-    }
-
-    protected static class FieldScanner extends BaseFieldScanner {
-
-        public final Map<Class<? extends Annotation>, OperandModeAnnotation> valueAnnotations;
-        public final ArrayList<Long> stateOffsets = new ArrayList<>();
+    private static class InstructionFieldScanner extends FieldScanner {
 
         private String opcodeConstant;
         private long opcodeOffset;
 
-        public FieldScanner(CalcOffset calc) {
+        public InstructionFieldScanner(CalcOffset calc) {
             super(calc);
 
-            valueAnnotations = new HashMap<>();
-            valueAnnotations.put(LIRInstruction.Use.class, new OperandModeAnnotation()); // LIRInstruction.Use.class));
-            valueAnnotations.put(LIRInstruction.Alive.class, new OperandModeAnnotation()); // LIRInstruction.Alive.class));
-            valueAnnotations.put(LIRInstruction.Temp.class, new OperandModeAnnotation()); // LIRInstruction.Temp.class));
-            valueAnnotations.put(LIRInstruction.Def.class, new OperandModeAnnotation()); // LIRInstruction.Def.class));
+            valueAnnotations.put(LIRInstruction.Use.class, new OperandModeAnnotation());
+            valueAnnotations.put(LIRInstruction.Alive.class, new OperandModeAnnotation());
+            valueAnnotations.put(LIRInstruction.Temp.class, new OperandModeAnnotation());
+            valueAnnotations.put(LIRInstruction.Def.class, new OperandModeAnnotation());
         }
 
-        private OperandModeAnnotation getOperandModeAnnotation(Field field) {
-            OperandModeAnnotation result = null;
-            for (Entry<Class<? extends Annotation>, OperandModeAnnotation> entry : valueAnnotations.entrySet()) {
-                Annotation annotation = field.getAnnotation(entry.getKey());
-                if (annotation != null) {
-                    assert result == null : "Field has two operand mode annotations: " + field;
-                    result = entry.getValue();
-                }
-            }
-            return result;
-        }
-
-        private static EnumSet<OperandFlag> getFlags(Field field) {
+        @Override
+        protected EnumSet<OperandFlag> getFlags(Field field) {
             EnumSet<OperandFlag> result = EnumSet.noneOf(OperandFlag.class);
             // Unfortunately, annotations cannot have class hierarchies or implement interfaces, so
             // we have to duplicate the code for every operand mode.
@@ -220,25 +191,12 @@
 
         @Override
         protected void scanField(Field field, Class<?> type, long offset) {
-            if (VALUE_CLASS.isAssignableFrom(type) && type != CONSTANT_CLASS) {
-                assert !Modifier.isFinal(field.getModifiers()) : "Value field must not be declared final because it is modified by register allocator: " + field;
-                OperandModeAnnotation annotation = getOperandModeAnnotation(field);
-                assert annotation != null : "Field must have operand mode annotation: " + field;
-                annotation.scalarOffsets.add(offset);
-                annotation.flags.put(offset, getFlags(field));
-            } else if (VALUE_ARRAY_CLASS.isAssignableFrom(type)) {
-                OperandModeAnnotation annotation = getOperandModeAnnotation(field);
-                assert annotation != null : "Field must have operand mode annotation: " + field;
-                annotation.arrayOffsets.add(offset);
-                annotation.flags.put(offset, getFlags(field));
-            } else if (STATE_CLASS.isAssignableFrom(type)) {
+            if (STATE_CLASS.isAssignableFrom(type)) {
                 assert getOperandModeAnnotation(field) == null : "Field must not have operand mode annotation: " + field;
                 assert field.getAnnotation(LIRInstruction.State.class) != null : "Field must have state annotation: " + field;
                 stateOffsets.add(offset);
             } else {
-                assert getOperandModeAnnotation(field) == null : "Field must not have operand mode annotation: " + field;
-                assert field.getAnnotation(LIRInstruction.State.class) == null : "Field must not have state annotation: " + field;
-                dataOffsets.add(offset);
+                super.scanField(field, type, offset);
             }
 
             if (field.getAnnotation(LIRInstruction.Opcode.class) != null) {
@@ -334,39 +292,6 @@
         }
     }
 
-    private static void forEach(LIRInstruction obj, int directCount, long[] offsets, OperandMode mode, EnumSet<OperandFlag>[] flags, ValueProcedure proc) {
-        for (int i = 0; i < offsets.length; i++) {
-            assert LIRInstruction.ALLOWED_FLAGS.get(mode).containsAll(flags[i]);
-
-            if (i < directCount) {
-                Value value = getValue(obj, offsets[i]);
-                if (isAddress(value)) {
-                    doAddress(asAddress(value), mode, flags[i], proc);
-                } else {
-                    setValue(obj, offsets[i], proc.doValue(value, mode, flags[i]));
-                }
-            } else {
-                Value[] values = getValueArray(obj, offsets[i]);
-                for (int j = 0; j < values.length; j++) {
-                    Value value = values[j];
-                    if (isAddress(value)) {
-                        doAddress(asAddress(value), mode, flags[i], proc);
-                    } else {
-                        values[j] = proc.doValue(value, mode, flags[i]);
-                    }
-                }
-            }
-        }
-    }
-
-    private static void doAddress(Address address, OperandMode mode, EnumSet<OperandFlag> flags, ValueProcedure proc) {
-        assert flags.contains(OperandFlag.ADDR);
-        Value[] components = address.components();
-        for (int i = 0; i < components.length; i++) {
-            components[i] = proc.doValue(components[i], mode, LIRInstruction.ADDRESS_FLAGS);
-        }
-    }
-
     public final Value forEachRegisterHint(LIRInstruction obj, OperandMode mode, ValueProcedure proc) {
         int hintDirectCount = 0;
         long[] hintOffsets = null;
@@ -401,18 +326,6 @@
         return null;
     }
 
-    private static Value getValue(LIRInstruction obj, long offset) {
-        return (Value) unsafe.getObject(obj, offset);
-    }
-
-    private static void setValue(LIRInstruction obj, long offset, Value value) {
-        unsafe.putObject(obj, offset, value);
-    }
-
-    private static Value[] getValueArray(LIRInstruction obj, long offset) {
-        return (Value[]) unsafe.getObject(obj, offset);
-    }
-
     private static LIRFrameState getState(LIRInstruction obj, long offset) {
         return (LIRFrameState) unsafe.getObject(obj, offset);
     }
@@ -447,65 +360,4 @@
 
         return result.toString();
     }
-
-    private void appendValues(StringBuilder result, LIRInstruction obj, String start, String end, String startMultiple, String endMultiple, String[] prefix, long[]... moffsets) {
-        int total = 0;
-        for (long[] offsets : moffsets) {
-            total += offsets.length;
-        }
-        if (total == 0) {
-            return;
-        }
-
-        result.append(start);
-        if (total > 1) {
-            result.append(startMultiple);
-        }
-        String sep = "";
-        for (int i = 0; i < moffsets.length; i++) {
-            long[] offsets = moffsets[i];
-
-            for (int j = 0; j < offsets.length; j++) {
-                result.append(sep).append(prefix[i]);
-                long offset = offsets[j];
-                if (total > 1) {
-                    result.append(fieldNames.get(offset)).append(": ");
-                }
-                result.append(getFieldString(obj, offset));
-                sep = ", ";
-            }
-        }
-        if (total > 1) {
-            result.append(endMultiple);
-        }
-        result.append(end);
-    }
-
-    private String getFieldString(Object obj, long offset) {
-        Class<?> type = fieldTypes.get(offset);
-        if (type == int.class) {
-            return String.valueOf(unsafe.getInt(obj, offset));
-        } else if (type == long.class) {
-            return String.valueOf(unsafe.getLong(obj, offset));
-        } else if (type == boolean.class) {
-            return String.valueOf(unsafe.getBoolean(obj, offset));
-        } else if (type == float.class) {
-            return String.valueOf(unsafe.getFloat(obj, offset));
-        } else if (type == double.class) {
-            return String.valueOf(unsafe.getDouble(obj, offset));
-        } else if (!type.isPrimitive()) {
-            Object value = unsafe.getObject(obj, offset);
-            if (!type.isArray()) {
-                return String.valueOf(value);
-            } else if (type == int[].class) {
-                return Arrays.toString((int[]) value);
-            } else if (type == double[].class) {
-                return Arrays.toString((double[]) value);
-            } else if (!type.getComponentType().isPrimitive()) {
-                return Arrays.toString((Object[]) value);
-            }
-        }
-        assert false : "unhandled field type: " + type;
-        return "";
-    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java	Fri Mar 08 15:58:08 2013 +0100
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2012, 2013, 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 java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.Map.Entry;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.lir.LIRInstruction.OperandFlag;
+import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.graal.lir.LIRInstruction.ValueProcedure;
+
+abstract class LIRIntrospection extends FieldIntrospection {
+
+    private static final Class<Value> VALUE_CLASS = Value.class;
+    private static final Class<Constant> CONSTANT_CLASS = Constant.class;
+    private static final Class<Value[]> VALUE_ARRAY_CLASS = Value[].class;
+
+    public LIRIntrospection(Class<?> clazz) {
+        super(clazz);
+    }
+
+    protected static class OperandModeAnnotation {
+
+        public final ArrayList<Long> scalarOffsets = new ArrayList<>();
+        public final ArrayList<Long> arrayOffsets = new ArrayList<>();
+        public final Map<Long, EnumSet<OperandFlag>> flags = new HashMap<>();
+    }
+
+    protected abstract static class FieldScanner extends BaseFieldScanner {
+
+        public final Map<Class<? extends Annotation>, OperandModeAnnotation> valueAnnotations;
+        public final ArrayList<Long> stateOffsets = new ArrayList<>();
+
+        public FieldScanner(CalcOffset calc) {
+            super(calc);
+
+            valueAnnotations = new HashMap<>();
+        }
+
+        protected OperandModeAnnotation getOperandModeAnnotation(Field field) {
+            OperandModeAnnotation result = null;
+            for (Entry<Class<? extends Annotation>, OperandModeAnnotation> entry : valueAnnotations.entrySet()) {
+                Annotation annotation = field.getAnnotation(entry.getKey());
+                if (annotation != null) {
+                    assert result == null : "Field has two operand mode annotations: " + field;
+                    result = entry.getValue();
+                }
+            }
+            return result;
+        }
+
+        protected abstract EnumSet<OperandFlag> getFlags(Field field);
+
+        @Override
+        protected void scanField(Field field, Class<?> type, long offset) {
+            if (VALUE_CLASS.isAssignableFrom(type) && type != CONSTANT_CLASS) {
+                assert !Modifier.isFinal(field.getModifiers()) : "Value field must not be declared final because it is modified by register allocator: " + field;
+                OperandModeAnnotation annotation = getOperandModeAnnotation(field);
+                assert annotation != null : "Field must have operand mode annotation: " + field;
+                annotation.scalarOffsets.add(offset);
+                annotation.flags.put(offset, getFlags(field));
+            } else if (VALUE_ARRAY_CLASS.isAssignableFrom(type)) {
+                OperandModeAnnotation annotation = getOperandModeAnnotation(field);
+                assert annotation != null : "Field must have operand mode annotation: " + field;
+                annotation.arrayOffsets.add(offset);
+                annotation.flags.put(offset, getFlags(field));
+            } else {
+                assert getOperandModeAnnotation(field) == null : "Field must not have operand mode annotation: " + field;
+                assert field.getAnnotation(LIRInstruction.State.class) == null : "Field must not have state annotation: " + field;
+                dataOffsets.add(offset);
+            }
+        }
+    }
+
+    protected static void forEach(Object obj, int directCount, long[] offsets, OperandMode mode, EnumSet<OperandFlag>[] flags, ValueProcedure proc) {
+        for (int i = 0; i < offsets.length; i++) {
+            assert LIRInstruction.ALLOWED_FLAGS.get(mode).containsAll(flags[i]);
+
+            if (i < directCount) {
+                Value value = getValue(obj, offsets[i]);
+                if (value instanceof CompositeValue) {
+                    CompositeValue composite = (CompositeValue) value;
+                    composite.forEachComponent(mode, proc);
+                } else {
+                    setValue(obj, offsets[i], proc.doValue(value, mode, flags[i]));
+                }
+            } else {
+                Value[] values = getValueArray(obj, offsets[i]);
+                for (int j = 0; j < values.length; j++) {
+                    Value value = values[j];
+                    if (value instanceof CompositeValue) {
+                        CompositeValue composite = (CompositeValue) value;
+                        composite.forEachComponent(mode, proc);
+                    } else {
+                        values[j] = proc.doValue(value, mode, flags[i]);
+                    }
+                }
+            }
+        }
+    }
+
+    protected static Value getValue(Object obj, long offset) {
+        return (Value) unsafe.getObject(obj, offset);
+    }
+
+    protected static void setValue(Object obj, long offset, Value value) {
+        unsafe.putObject(obj, offset, value);
+    }
+
+    protected static Value[] getValueArray(Object obj, long offset) {
+        return (Value[]) unsafe.getObject(obj, offset);
+    }
+
+    protected void appendValues(StringBuilder result, Object obj, String start, String end, String startMultiple, String endMultiple, String[] prefix, long[]... moffsets) {
+        int total = 0;
+        for (long[] offsets : moffsets) {
+            total += offsets.length;
+        }
+        if (total == 0) {
+            return;
+        }
+
+        result.append(start);
+        if (total > 1) {
+            result.append(startMultiple);
+        }
+        String sep = "";
+        for (int i = 0; i < moffsets.length; i++) {
+            long[] offsets = moffsets[i];
+
+            for (int j = 0; j < offsets.length; j++) {
+                result.append(sep).append(prefix[i]);
+                long offset = offsets[j];
+                if (total > 1) {
+                    result.append(fieldNames.get(offset)).append(": ");
+                }
+                result.append(getFieldString(obj, offset));
+                sep = ", ";
+            }
+        }
+        if (total > 1) {
+            result.append(endMultiple);
+        }
+        result.append(end);
+    }
+
+    protected String getFieldString(Object obj, long offset) {
+        Class<?> type = fieldTypes.get(offset);
+        if (type == int.class) {
+            return String.valueOf(unsafe.getInt(obj, offset));
+        } else if (type == long.class) {
+            return String.valueOf(unsafe.getLong(obj, offset));
+        } else if (type == boolean.class) {
+            return String.valueOf(unsafe.getBoolean(obj, offset));
+        } else if (type == float.class) {
+            return String.valueOf(unsafe.getFloat(obj, offset));
+        } else if (type == double.class) {
+            return String.valueOf(unsafe.getDouble(obj, offset));
+        } else if (!type.isPrimitive()) {
+            Object value = unsafe.getObject(obj, offset);
+            if (!type.isArray()) {
+                return String.valueOf(value);
+            } else if (type == int[].class) {
+                return Arrays.toString((int[]) value);
+            } else if (type == double[].class) {
+                return Arrays.toString((double[]) value);
+            } else if (!type.getComponentType().isPrimitive()) {
+                return Arrays.toString((Object[]) value);
+            }
+        }
+        assert false : "unhandled field type: " + type;
+        return "";
+    }
+}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java	Fri Mar 08 15:58:08 2013 +0100
@@ -150,7 +150,7 @@
         compilationResult.recordSafepoint(pos, debugInfo);
     }
 
-    public Address recordDataReferenceInCode(Constant data, int alignment, boolean inlined) {
+    public AbstractAddress recordDataReferenceInCode(Constant data, int alignment, boolean inlined) {
         assert data != null;
         int pos = asm.codeBuffer.position();
         Debug.log("Data reference in code: pos = %d, data = %s", pos, data.toString());
@@ -176,11 +176,11 @@
     /**
      * Returns the address of a float constant that is embedded as a data references into the code.
      */
-    public Address asFloatConstRef(Value value) {
+    public AbstractAddress asFloatConstRef(Value value) {
         return asFloatConstRef(value, 4);
     }
 
-    public Address asFloatConstRef(Value value, int alignment) {
+    public AbstractAddress asFloatConstRef(Value value, int alignment) {
         assert value.getKind() == Kind.Float && isConstant(value);
         return recordDataReferenceInCode((Constant) value, alignment, false);
     }
@@ -188,11 +188,11 @@
     /**
      * Returns the address of a double constant that is embedded as a data references into the code.
      */
-    public Address asDoubleConstRef(Value value) {
+    public AbstractAddress asDoubleConstRef(Value value) {
         return asDoubleConstRef(value, 8);
     }
 
-    public Address asDoubleConstRef(Value value, int alignment) {
+    public AbstractAddress asDoubleConstRef(Value value, int alignment) {
         assert value.getKind() == Kind.Double && isConstant(value);
         return recordDataReferenceInCode((Constant) value, alignment, false);
     }
@@ -200,41 +200,39 @@
     /**
      * Returns the address of a long constant that is embedded as a data references into the code.
      */
-    public Address asLongConstRef(Value value) {
+    public AbstractAddress asLongConstRef(Value value) {
         assert value.getKind() == Kind.Long && isConstant(value);
         return recordDataReferenceInCode((Constant) value, 8, false);
     }
 
-    public Address asIntAddr(Value value) {
+    public AbstractAddress asIntAddr(Value value) {
         assert value.getKind() == Kind.Int;
         return asAddress(value);
     }
 
-    public Address asLongAddr(Value value) {
+    public AbstractAddress asLongAddr(Value value) {
         assert value.getKind() == Kind.Long;
         return asAddress(value);
     }
 
-    public Address asObjectAddr(Value value) {
+    public AbstractAddress asObjectAddr(Value value) {
         assert value.getKind() == Kind.Object;
         return asAddress(value);
     }
 
-    public Address asFloatAddr(Value value) {
+    public AbstractAddress asFloatAddr(Value value) {
         assert value.getKind() == Kind.Float;
         return asAddress(value);
     }
 
-    public Address asDoubleAddr(Value value) {
+    public AbstractAddress asDoubleAddr(Value value) {
         assert value.getKind() == Kind.Double;
         return asAddress(value);
     }
 
-    public Address asAddress(Value value) {
-        if (isStackSlot(value)) {
-            StackSlot slot = (StackSlot) value;
-            return asm.makeAddress(slot.getKind(), frameMap.registerConfig.getFrameRegister().asValue(), frameMap.offsetForStackSlot(slot));
-        }
-        return (Address) value;
+    public AbstractAddress asAddress(Value value) {
+        assert isStackSlot(value);
+        StackSlot slot = asStackSlot(value);
+        return asm.makeAddress(frameMap.registerConfig.getFrameRegister(), frameMap.offsetForStackSlot(slot));
     }
 }
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Fri Mar 08 15:57:41 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Fri Mar 08 15:58:08 2013 +0100
@@ -54,6 +54,7 @@
             dumpSandboxed(object, message);
         } catch (Throwable ex) {
             TTY.println("CFGPrinter: Exception during output of " + message + ": " + ex);
+            ex.printStackTrace();
         }
     }
 
@@ -115,18 +116,23 @@
             return;
         }
 
-        cfgPrinter.target = Debug.contextLookup(TargetDescription.class);
         if (object instanceof LIR) {
             cfgPrinter.lir = (LIR) object;
         } else {
             cfgPrinter.lir = Debug.contextLookup(LIR.class);
         }
         cfgPrinter.lirGenerator = Debug.contextLookup(LIRGenerator.class);
+        if (cfgPrinter.lirGenerator != null) {
+            cfgPrinter.target = cfgPrinter.lirGenerator.target();
+        }
         if (cfgPrinter.lir != null) {
             cfgPrinter.cfg = cfgPrinter.lir.cfg;
         }
 
         CodeCacheProvider runtime = Debug.contextLookup(CodeCacheProvider.class);
+        if (runtime != null) {
+            cfgPrinter.target = runtime.getTarget();
+        }
 
         if (object instanceof BciBlockMapping) {
             BciBlockMapping blockMap = (BciBlockMapping) object;
--- a/graal/com.oracle.graal.ptx/src/com/oracle/graal/ptx/PTXAddress.java	Fri Mar 08 15:57:41 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2013, 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.ptx;
-
-import static com.oracle.graal.api.code.ValueUtil.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents an address in target machine memory, specified via some combination of a base register
- * and a displacement.
- */
-public final class PTXAddress extends Address {
-
-    private static final long serialVersionUID = 8343625682010474837L;
-
-    private final Value[] base;
-    private final long displacement;
-
-    /**
-     * Creates an {@link PTXAddress} with given base register and no displacement.
-     * 
-     * @param kind the kind of the value being addressed
-     * @param base the base register
-     */
-    public PTXAddress(Kind kind, Value base) {
-        this(kind, base, 0);
-    }
-
-    /**
-     * Creates an {@link PTXAddress} with given base register and a displacement. This is the most
-     * general constructor.
-     * 
-     * @param kind the kind of the value being addressed
-     * @param base the base register
-     * @param displacement the displacement
-     */
-    public PTXAddress(Kind kind, Value base, long displacement) {
-        super(kind);
-        this.base = new Value[1];
-        this.setBase(base);
-        this.displacement = displacement;
-
-        assert !isConstant(base) && !isStackSlot(base);
-    }
-
-    @Override
-    public Value[] components() {
-        return base;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder s = new StringBuilder();
-        s.append(getKind().getJavaName()).append("[");
-        String sep = "";
-        if (isLegal(getBase())) {
-            s.append(getBase());
-            sep = " + ";
-        }
-        if (getDisplacement() < 0) {
-            s.append(" - ").append(-getDisplacement());
-        } else if (getDisplacement() > 0) {
-            s.append(sep).append(getDisplacement());
-        }
-        s.append("]");
-        return s.toString();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof PTXAddress) {
-            PTXAddress addr = (PTXAddress) obj;
-            return getKind() == addr.getKind() && getDisplacement() == addr.getDisplacement() && getBase().equals(addr.getBase());
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return getBase().hashCode() ^ ((int) getDisplacement() << 4) ^ (getKind().ordinal() << 12);
-    }
-
-    /**
-     * @return Base register that defines the start of the address computation. If not present, is
-     *         denoted by {@link Value#ILLEGAL}.
-     */
-    public Value getBase() {
-        return base[0];
-    }
-
-    public void setBase(Value base) {
-        this.base[0] = base;
-    }
-
-    /**
-     * @return Optional additive displacement.
-     */
-    public long getDisplacement() {
-        return displacement;
-    }
-}
--- a/mx/commands.py	Fri Mar 08 15:57:41 2013 +0100
+++ b/mx/commands.py	Fri Mar 08 15:58:08 2013 +0100
@@ -1015,6 +1015,15 @@
         benchArgs.remove(args[itIdx+1])
     vm = _vm;
     sanitycheck.getSPECjvm2008(benchArgs, skipCheck, skipValid, wt, it).bench(vm, opts=vmArgs)
+    
+def specjbb2013(args):
+    """runs the composite SPECjbb2013 benchmark
+
+    All options begining with - will be passed to the vm"""
+    benchArgs = [a for a in args if a[0] != '-']
+    vmArgs = [a for a in args if a[0] == '-']
+    vm = _vm;
+    sanitycheck.getSPECjbb2013(benchArgs).bench(vm, opts=vmArgs)
 
 def hsdis(args, copyToDir=None):
     """download the hsdis library
@@ -1118,7 +1127,8 @@
         'jdkhome': [jdkhome, ''],
         'dacapo': [dacapo, '[[n] benchmark] [VM options|@DaCapo options]'],
         'scaladacapo': [scaladacapo, '[[n] benchmark] [VM options|@Scala DaCapo options]'],
-        'specjvm2008': [specjvm2008, '[VM options|@specjvm2008 options]'],
+        'specjvm2008': [specjvm2008, '[VM options|specjvm2008 options (-v, -ikv, -ict, -wt, -it)]'],
+        'specjbb2013': [specjbb2013, '[VM options]'],
         #'example': [example, '[-v] example names...'],
         'gate' : [gate, '[-options]'],
         'gv' : [gv, ''],
--- a/mx/projects	Fri Mar 08 15:57:41 2013 +0100
+++ b/mx/projects	Fri Mar 08 15:58:08 2013 +0100
@@ -248,7 +248,7 @@
 # graal.compiler.ptx.test
 project@com.oracle.graal.compiler.ptx.test@subDir=graal
 project@com.oracle.graal.compiler.ptx.test@sourceDirs=src
-project@com.oracle.graal.compiler.ptx.test@dependencies=com.oracle.graal.compiler.ptx,com.oracle.graal.compiler.test
+project@com.oracle.graal.compiler.ptx.test@dependencies=com.oracle.graal.compiler.ptx,com.oracle.graal.compiler.test,com.oracle.graal.ptx
 project@com.oracle.graal.compiler.ptx.test@checkstyle=com.oracle.graal.graph
 project@com.oracle.graal.compiler.ptx.test@javaCompliance=1.7
 
@@ -331,7 +331,7 @@
 # graal.asm.ptx
 project@com.oracle.graal.asm.ptx@subDir=graal
 project@com.oracle.graal.asm.ptx@sourceDirs=src
-project@com.oracle.graal.asm.ptx@dependencies=com.oracle.graal.asm,com.oracle.graal.ptx
+project@com.oracle.graal.asm.ptx@dependencies=com.oracle.graal.asm
 project@com.oracle.graal.asm.ptx@checkstyle=com.oracle.graal.graph
 project@com.oracle.graal.asm.ptx@javaCompliance=1.7
 
--- a/mx/sanitycheck.py	Fri Mar 08 15:57:41 2013 +0100
+++ b/mx/sanitycheck.py	Fri Mar 08 15:58:08 2013 +0100
@@ -119,7 +119,7 @@
     success = re.compile(r"org.spec.jbb.controller: Run finished", re.MULTILINE)
     matcherMax = ValuesMatcher(jops, {'group' : 'SPECjbb2013', 'name' : 'max', 'score' : '<max>'})
     matcherCritical = ValuesMatcher(jops, {'group' : 'SPECjbb2013', 'name' : 'critical', 'score' : '<critical>'})
-    return Test("SPECjbb2013", ['-jar', 'specjbb2013.jar', '-m', 'composite'] + benchArgs, [success], [], [matcherCritical, matcherMax], vmOpts=['-Xms7g', '-XX:+UseSerialGC', '-XX:-UseCompressedOops'], defaultCwd=specjbb2013)
+    return Test("SPECjbb2013", ['-jar', 'specjbb2013.jar', '-m', 'composite'] + benchArgs, [success], [], [matcherCritical, matcherMax], vmOpts=['-Xmx6g', '-Xms6g', '-Xmn3g', '-XX:+UseParallelOldGC', '-XX:-UseAdaptiveSizePolicy', '-XX:-UseBiasedLocking', '-XX:-UseCompressedOops'], defaultCwd=specjbb2013)
     
 def getSPECjvm2008(benchArgs = [], skipCheck=False, skipKitValidation=False, warmupTime=None, iterationTime=None):
     
--- a/mxtool/mx.py	Fri Mar 08 15:57:41 2013 +0100
+++ b/mxtool/mx.py	Fri Mar 08 15:58:08 2013 +0100
@@ -2265,6 +2265,10 @@
     launchOut = XMLDoc();
     consoleOn = 'true' if logToConsole else 'false'
     launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'})
+    launchOut.open('mapAttribute', {'key' : 'org.eclipse.debug.core.environmentVariables'})
+    launchOut.element('mapEntry', {'key' : 'JAVA_HOME',	'value' : java().jdk})
+    launchOut.close('mapAttribute')
+    
     if refresh:
         launchOut.element('stringAttribute',  {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE',            'value': '${project}'})
     launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON',          'value': consoleOn})
--- a/src/cpu/sparc/vm/frame_sparc.inline.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/cpu/sparc/vm/frame_sparc.inline.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -74,8 +74,7 @@
 
 // return address:
 
-inline address* frame::sender_pc_addr()   const { return (address*) (I7_addr() + pc_return_offset); }
-inline address  frame::sender_pc()        const { return *sender_pc_addr(); }
+inline address  frame::sender_pc()        const    { return *I7_addr() + pc_return_offset; }
 
 inline address* frame::I7_addr() const  { return (address*) &sp()[ I7->sp_offset_in_saved_window()]; }
 inline address* frame::I0_addr() const  { return (address*) &sp()[ I0->sp_offset_in_saved_window()]; }
--- a/src/cpu/sparc/vm/jniTypes_sparc.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/cpu/sparc/vm/jniTypes_sparc.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -112,25 +112,6 @@
                                                           return *(jdouble *)&jl; }
 #endif
 
-  static inline jint    get_int   (intptr_t *from, int& pos) {
-    return get_int(from + pos++);
-  }
-  static inline jlong   get_long  (intptr_t *from, int& pos) {
-    jlong result = get_long(from + pos);
-    pos += 2;
-    return result;
-  }
-  static inline oop     get_obj   (intptr_t *from, int& pos) {
-    return get_obj(from + pos++);
-  }
-  static inline jfloat  get_float (intptr_t *from, int& pos) {
-    return get_float(from + pos++);
-  }
-  static inline jdouble get_double(intptr_t *from, int& pos) {
-    jdouble result = get_double(from + pos);
-    pos += 2;
-    return result;
-  }
 };
 
 #endif // CPU_SPARC_VM_JNITYPES_SPARC_HPP
--- a/src/cpu/x86/vm/frame_x86.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/cpu/x86/vm/frame_x86.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -308,11 +308,6 @@
   ptr_at_put(interpreter_frame_sender_sp_offset, (intptr_t) sender_sp);
 }
 
-intptr_t** frame::interpreter_frame_sender_sp_addr() const {
-  assert(is_interpreted_frame(), "interpreted frame expected");
-  return (intptr_t**) addr_at(interpreter_frame_sender_sp_offset);
-}
-
 
 // monitor elements
 
--- a/src/cpu/x86/vm/frame_x86.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/cpu/x86/vm/frame_x86.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -191,12 +191,13 @@
   // Note: not necessarily the real 'frame pointer' (see real_fp)
   intptr_t*   fp() const { return _fp; }
 
+  inline address* sender_pc_addr() const;
+
   // return address of param, zero origin index.
   inline address* native_param_addr(int idx) const;
 
   // expression stack tos if we are nested in a java call
   intptr_t* interpreter_frame_last_sp() const;
-  intptr_t** interpreter_frame_last_sp_addr() const;
 
   // helper to update a map with callee-saved RBP
   static void update_map_with_saved_link(RegisterMap* map, intptr_t** link_addr);
--- a/src/cpu/x86/vm/frame_x86.inline.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/cpu/x86/vm/frame_x86.inline.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -133,9 +133,8 @@
 
 
 
-inline intptr_t*  frame::link() const              { return (intptr_t*) *(intptr_t **)addr_at(link_offset); }
-inline intptr_t** frame::link_addr() const         { return (intptr_t **)addr_at(link_offset); }
-inline void       frame::set_link(intptr_t* addr)  { *(intptr_t **)addr_at(link_offset) = addr; }
+inline intptr_t* frame::link() const              { return (intptr_t*) *(intptr_t **)addr_at(link_offset); }
+inline void      frame::set_link(intptr_t* addr)  { *(intptr_t **)addr_at(link_offset) = addr; }
 
 
 inline intptr_t* frame::unextended_sp() const     { return _unextended_sp; }
@@ -211,10 +210,6 @@
   return *(intptr_t**)addr_at(interpreter_frame_last_sp_offset);
 }
 
-inline intptr_t** frame::interpreter_frame_last_sp_addr() const {
-  return (intptr_t**)addr_at(interpreter_frame_last_sp_offset);
-}
-
 inline intptr_t* frame::interpreter_frame_bcx_addr() const {
   return (intptr_t*)addr_at(interpreter_frame_bcx_offset);
 }
--- a/src/cpu/x86/vm/jniTypes_x86.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/cpu/x86/vm/jniTypes_x86.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -127,26 +127,6 @@
   static inline oop     get_obj   (intptr_t *from) { return *(oop *)    from; }
   static inline jfloat  get_float (intptr_t *from) { return *(jfloat *) from; }
   static inline jdouble get_double(intptr_t *from) { return *(jdouble *)(from + _JNI_SLOT_OFFSET); }
-
-  static inline jint    get_int   (intptr_t *from, int& pos) {
-    return get_int(from + pos++);
-  }
-  static inline jlong   get_long  (intptr_t *from, int& pos) {
-    jlong result = get_long(from + pos);
-    pos += 2;
-    return result;
-  }
-  static inline oop     get_obj   (intptr_t *from, int& pos) {
-    return get_obj(from + pos++);
-  }
-  static inline jfloat  get_float (intptr_t *from, int& pos) {
-    return get_float(from + pos++);
-  }
-  static inline jdouble get_double(intptr_t *from, int& pos) {
-    jdouble result = get_double(from + pos);
-    pos += 2;
-    return result;
-  }
 #undef _JNI_SLOT_OFFSET
 };
 
--- a/src/cpu/x86/vm/nativeInst_x86.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/cpu/x86/vm/nativeInst_x86.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -578,10 +578,8 @@
     // Graal may allocate an arbitrary register for storing the polling address.
     return true;
 #else
-    if (ubyte_at(0) == Assembler::REX_WR && ubyte_at(1) == NativeMovRegMem::instruction_code_mem2reg && ubyte_at(2) == 0x15) { // mov r10, rip[...]
-      address fault = addr_at(7) + int_at(3);
-      return os::is_poll_address(fault);
-    } else if (ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl && ubyte_at(1) == 0x05) { // 00 rax 101
+    if (ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl &&
+        ubyte_at(1) == 0x05) { // 00 rax 101
       address fault = addr_at(6) + int_at(2);
       return os::is_poll_address(fault);
     } else {
--- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -1763,8 +1763,7 @@
 
   int vep_offset = ((intptr_t)__ pc()) - start;
 
-#if defined(COMPILER1) || defined(GRAAL)
-
+#ifdef COMPILER1
   if (InlineObjectHash && method->intrinsic_id() == vmIntrinsics::_hashCode) {
     // Object.hashCode can pull the hashCode from the header word
     // instead of doing a full VM transition once it's been computed.
@@ -1793,7 +1792,7 @@
     __ ret(0);
     __ bind (slowCase);
   }
-#endif // COMPILER1 || GRAAL
+#endif // COMPILER1
 
   // The instruction at the verified entry point must be 5 bytes or longer
   // because it can be patched on the fly by make_non_entrant. The stack bang
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -1996,50 +1996,6 @@
 
   int vep_offset = ((intptr_t)__ pc()) - start;
 
-#ifdef GRAALVM
-  if (InlineObjectHash && (method->intrinsic_id() == vmIntrinsics::_hashCode || method->intrinsic_id() == vmIntrinsics::_identityHashCode)) {
-    // Object.hashCode can pull the hashCode from the header word
-    // instead of doing a full VM transition once it's been computed.
-    // Since hashCode is usually polymorphic at call sites we can't do
-    // this optimization at the call site without a lot of work.
-    Label slowCase;
-    Label nullCase;
-    Register result = rax;
-
-    if (method->intrinsic_id() == vmIntrinsics::_identityHashCode) {
-      __ cmpptr(receiver, 0);
-      __ jcc(Assembler::equal, nullCase);
-    }
-
-    __ movptr(result, Address(receiver, oopDesc::mark_offset_in_bytes()));
-
-    // check if locked
-    __ testptr(result, markOopDesc::unlocked_value);
-    __ jcc (Assembler::zero, slowCase);
-
-    if (UseBiasedLocking) {
-      // Check if biased and fall through to runtime if so
-      __ testptr(result, markOopDesc::biased_lock_bit_in_place);
-      __ jcc (Assembler::notZero, slowCase);
-    }
-
-    // get hash
-    __ shrptr(result, markOopDesc::hash_shift);
-    __ andptr(result, markOopDesc::hash_mask);
-    // test if hashCode exists
-    __ jcc  (Assembler::zero, slowCase);
-    __ ret(0);
-
-    if (method->intrinsic_id() == vmIntrinsics::_identityHashCode) {
-      __ bind(nullCase);
-      __ movl(result, 0);
-      __ ret(0);
-    }
-
-    __ bind (slowCase);
-  }
-#endif // GRAALVM
-
   // The instruction at the verified entry point must be 5 bytes or longer
   // because it can be patched on the fly by make_non_entrant. The stack bang
   // instruction fits that requirement.
--- a/src/os/bsd/vm/os_bsd.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/os/bsd/vm/os_bsd.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -3635,9 +3635,9 @@
 // able to use structured exception handling (thread-local exception filters)
 // on, e.g., Win32.
 void
-os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, nmethod* nm,
+os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method,
                          JavaCallArguments* args, Thread* thread) {
-  f(value, method, nm, args, thread);
+  f(value, method, args, thread);
 }
 
 void os::print_statistics() {
--- a/src/os/linux/vm/os_linux.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/os/linux/vm/os_linux.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -4434,9 +4434,9 @@
 // able to use structured exception handling (thread-local exception filters)
 // on, e.g., Win32.
 void
-os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, nmethod* nm,
+os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method,
                          JavaCallArguments* args, Thread* thread) {
-  f(value, method, nm, args, thread);
+  f(value, method, args, thread);
 }
 
 void os::print_statistics() {
--- a/src/os/solaris/vm/os_solaris.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/os/solaris/vm/os_solaris.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -4280,8 +4280,8 @@
 
 // This does not do anything on Solaris. This is basically a hook for being
 // able to use structured exception handling (thread-local exception filters) on, e.g., Win32.
-void os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, nmethod* nm, JavaCallArguments* args, Thread* thread) {
-  f(value, method, nm, args, thread);
+void os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread) {
+  f(value, method, args, thread);
 }
 
 // This routine may be used by user applications as a "hook" to catch signals.
--- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -282,17 +282,6 @@
     }
 #endif // AMD64
 
-    if (TraceSignals) {
-    CodeBlob* cb = CodeCache::find_blob(pc);
-      if (cb != NULL && cb->is_nmethod()) {
-        nmethod* nm = (nmethod*)cb;
-        int rel = pc - nm->code_begin();
-        tty->print_cr(err_msg("Implicit exception at %d of method %s", rel, nm->method()->name()->as_C_string()));
-      } else {
-        tty->print_cr("No code blob found for %x", pc);
-      }
-    }
-
     // Handle ALL stack overflow variations here
     if (sig == SIGSEGV) {
       address addr = (address) info->si_addr;
@@ -306,7 +295,6 @@
           if (thread->thread_state() == _thread_in_Java) {
             // Throw a stack overflow exception.  Guard pages will be reenabled
             // while unwinding the stack.
-            if (WizardMode) tty->print("implicit: %08x%08x\n", ((long long)pc) >> 32, pc);
             stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW);
           } else {
             // Thread was in the vm or native code.  Return and try to finish.
@@ -392,15 +380,8 @@
 #endif // AMD64
       } else if (sig == SIGSEGV &&
                !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
-          if (TraceSignals) {
-            tty->print_cr("Implicit exception continuation");
-          }
           // Determination of interpreter/vtable stub/compiled code null exception
           stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
-      } else if (sig == SIGSEGV) {
-        if (TraceSignals) {
-          tty->print_cr("would have needed explicit null check %d", (intptr_t)info->si_addr);
-        }
       }
     } else if (thread->thread_state() == _thread_in_vm &&
                sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
--- a/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -70,7 +70,7 @@
 extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* );
 
 // Install a win32 structured exception handler around thread.
-void os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, nmethod* nm, JavaCallArguments* args, Thread* thread) {
+void os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread) {
   __try {
 
 #ifndef AMD64
@@ -110,7 +110,7 @@
 #endif // ASSERT
 #endif // !AMD64
 
-    f(value, method, nm, args, thread);
+    f(value, method, args, thread);
   } __except(topLevelExceptionFilter((_EXCEPTION_POINTERS*)_exception_info())) {
       // Nothing to do.
   }
--- a/src/os_cpu/windows_x86/vm/threadLS_windows_x86.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/os_cpu/windows_x86/vm/threadLS_windows_x86.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -39,7 +39,7 @@
 // up the offset from FS of the thread pointer.
 void ThreadLocalStorage::generate_code_for_get_thread() {
       os::os_exception_wrapper( (java_call_t)call_wrapper_dummy,
-                                NULL, NULL, NULL, NULL, NULL);
+                                NULL, NULL, NULL, NULL);
 }
 
 void ThreadLocalStorage::pd_init() { }
--- a/src/share/vm/c1/c1_IR.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/c1/c1_IR.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -240,8 +240,8 @@
     // reexecute allowed only for the topmost frame
     bool reexecute = topmost ? should_reexecute() : false;
     bool return_oop = false; // This flag will be ignored since it used only for C2 with escape analysis.
-    methodHandle null_mh;
-    recorder->describe_scope(pc_offset, null_mh, scope()->method(), bci(), reexecute, false, is_method_handle_invoke, return_oop, locvals, expvals, monvals);
+    bool rethrow_exception = false;
+    recorder->describe_scope(pc_offset, methodHandle(), scope()->method(), bci(), reexecute, rethrow_exception, is_method_handle_invoke, return_oop, locvals, expvals, monvals);
   }
 };
 
--- a/src/share/vm/ci/ciCallProfile.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/ci/ciCallProfile.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -61,7 +61,6 @@
   // Note:  The following predicates return false for invalid profiles:
   bool      has_receiver(int i) const { return _limit > i; }
   int       morphism() const          { return _morphism; }
-  int       limit() const             { return _limit; }
 
   int       count() const             { return _count; }
   int       receiver_count(int i)  {
--- a/src/share/vm/ci/ciField.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/ci/ciField.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -166,8 +166,6 @@
   // at each point of access.
   bool will_link(ciInstanceKlass* accessing_klass,
                  Bytecodes::Code bc);
-  bool will_link_from_vm(ciInstanceKlass* accessing_klass,
-                 Bytecodes::Code bc);
 
   // Java access flags
   bool is_public      () { return flags().is_public(); }
--- a/src/share/vm/ci/ciObject.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/ci/ciObject.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -65,14 +65,12 @@
   ciObject(Handle h);
   ciObject(ciKlass* klass);
 
-public:
   jobject      handle()  const { return _handle; }
   // Get the VM oop that this object holds.
   oop get_oop() const {
     assert(_handle != NULL, "null oop");
     return JNIHandles::resolve_non_null(_handle);
   }
-protected:
 
   void init_flags_from(oop x);
 
--- a/src/share/vm/ci/ciSymbol.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/ci/ciSymbol.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -48,7 +48,7 @@
 
 private:
   const vmSymbols::SID _sid;
-  DEBUG_ONLY( bool sid_ok() { return true;/*vmSymbols::find_sid(get_symbol()) == _sid;*/ } )
+  DEBUG_ONLY( bool sid_ok() { return vmSymbols::find_sid(get_symbol()) == _sid; } )
 
   ciSymbol(Symbol* s);  // normal case, for symbols not mentioned in vmSymbols
   ciSymbol(Symbol* s, vmSymbols::SID sid);   // for use with vmSymbols
--- a/src/share/vm/classfile/classLoader.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/classfile/classLoader.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -446,10 +446,6 @@
     tty->print_cr("[Bootstrap loader class path=%s]", sys_class_path);
   }
 
-  setup_bootstrap_search_path(sys_class_path);
-}
-
-void ClassLoader::setup_bootstrap_search_path(char* sys_class_path) {
   int len = (int)strlen(sys_class_path);
   int end = 0;
 
@@ -899,23 +895,7 @@
     PerfClassTraceTime vmtimer(perf_sys_class_lookup_time(),
                                ((JavaThread*) THREAD)->get_thread_stat()->perf_timers_addr(),
                                PerfClassTraceTime::CLASS_LOAD);
-    ClassPathEntry* e = _first_entry; 
-    while (e != NULL) {
-      stream = e->open_stream(name);
-      if (stream != NULL) {
-        break;
-      }
-      e = e->next();
-      ++classpath_index;
-    }
-  }
-
-  if (stream == NULL && !(THREAD->is_Compiler_thread())) {  
-	  classpath_index = 0;
-    PerfClassTraceTime vmtimer(perf_sys_class_lookup_time(),
-                               ((JavaThread*) THREAD)->get_thread_stat()->perf_timers_addr(),
-                               PerfClassTraceTime::CLASS_LOAD);
-    ClassPathEntry* e = _first_entry; 
+    ClassPathEntry* e = _first_entry;
     while (e != NULL) {
       stream = e->open_stream(name);
       if (stream != NULL) {
--- a/src/share/vm/classfile/classLoader.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/classfile/classLoader.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -206,7 +206,6 @@
   // Initialization
   static void setup_meta_index();
   static void setup_bootstrap_search_path();
-  static void setup_bootstrap_search_path(char* sys_class_path);
   static void load_zip_library();
   static void create_class_path_entry(char *path, struct stat st, ClassPathEntry **new_entry, bool lazy);
 
--- a/src/share/vm/code/codeBlob.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/codeBlob.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -39,7 +39,6 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/vframe.hpp"
 #include "services/memoryService.hpp"
-#include "utilities/machineCodePrinter.hpp"
 #ifdef TARGET_ARCH_x86
 # include "nativeInst_x86.hpp"
 #endif
@@ -134,11 +133,10 @@
   cb->copy_code_and_locs_to(this);
   set_oop_maps(oop_maps);
   _frame_size = frame_size;
-#if defined(COMPILER1) || defined(GRAAL)
-
+#ifdef COMPILER1
   // probably wrong for tiered
   assert(_frame_size >= -1, "must use frame size or -1 for runtime stubs");
-#endif // COMPILER1 || GRAAL
+#endif // COMPILER1
 }
 
 
@@ -345,10 +343,6 @@
 
   trace_new_stub(stub, "RuntimeStub - ", stub_name);
 
-  if (PrintMachineCodeToFile) {
-    MachineCodePrinter::print(stub);
-  }
-
   return stub;
 }
 
@@ -384,7 +378,9 @@
   _unpack_offset           = unpack_offset;
   _unpack_with_exception   = unpack_with_exception_offset;
   _unpack_with_reexecution = unpack_with_reexecution_offset;
+#ifdef COMPILER1
   _unpack_with_exception_in_tls   = -1;
+#endif
 }
 
 
--- a/src/share/vm/code/compiledIC.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/compiledIC.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -95,7 +95,7 @@
   // Don't use ic_destination for this test since that forwards
   // through ICBuffer instead of returning the actual current state of
   // the CompiledIC.
-  if (is_icholder_entry(_ic_call->destination()) && !_is_optimized) {
+  if (is_icholder_entry(_ic_call->destination()) GRAAL_ONLY(&& _value != NULL)) {
     // When patching for the ICStub case the cached value isn't
     // overwritten until the ICStub copied into the CompiledIC during
     // the next safepoint.  Make sure that the CompiledICHolder* is
@@ -560,10 +560,10 @@
 
 
 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) {
-  set_destination_mt_safe(entry);
   address stub=find_stub();
 #ifdef GRAAL
   if (stub == NULL) {
+    set_destination_mt_safe(entry);
     return;
   }
 #endif
@@ -661,11 +661,7 @@
         case relocInfo::poll_type:
         case relocInfo::poll_return_type: // A safepoint can't overlap a call.
         default:
-#ifdef GRAAL
-          return NULL;
-#else
           ShouldNotReachHere();
-#endif
       }
     }
   }
--- a/src/share/vm/code/debugInfo.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/debugInfo.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -77,11 +77,7 @@
 
 enum { LOCATION_CODE = 0, CONSTANT_INT_CODE = 1,  CONSTANT_OOP_CODE = 2,
                           CONSTANT_LONG_CODE = 3, CONSTANT_DOUBLE_CODE = 4,
-                          OBJECT_CODE = 5,        OBJECT_ID_CODE = 6,
-#ifdef GRAAL
-                          DEFERRED_READ_CODE = 7, DEFERRED_WRITE_CODE = 8
-#endif // GRAAL
-};
+                          OBJECT_CODE = 5,        OBJECT_ID_CODE = 6 };
 
 ScopeValue* ScopeValue::read_from(DebugInfoReadStream* stream) {
   ScopeValue* result = NULL;
@@ -93,10 +89,6 @@
    case CONSTANT_DOUBLE_CODE: result = new ConstantDoubleValue(stream);  break;
    case OBJECT_CODE:          result = stream->read_object_value();      break;
    case OBJECT_ID_CODE:       result = stream->get_cached_object();      break;
-#ifdef GRAAL
-   case DEFERRED_READ_CODE:   result = new DeferredReadValue(stream);    break;
-   case DEFERRED_WRITE_CODE:  result = new DeferredWriteValue(stream);   break;
-#endif // GRAAL
    default: ShouldNotReachHere();
   }
   return result;
@@ -117,63 +109,6 @@
   location().print_on(st);
 }
 
-#ifdef GRAAL
-
-// DeferredLocationValue
-
-DeferredLocationValue::DeferredLocationValue(DebugInfoReadStream* stream) {
-  _base = read_from(stream);
-  _index = read_from(stream);
-  _scale = stream->read_int();
-  _disp = stream->read_long();
-}
-
-void DeferredLocationValue::write_on(DebugInfoWriteStream* stream) {
-  _base->write_on(stream);
-  _index->write_on(stream);
-  stream->write_int(_scale);
-  stream->write_long(_disp);
-}
-
-void DeferredLocationValue::print_on(outputStream* st) const {
-  _base->print_on(st);
-  _index->print_on(st);
-  st->print("%i %i", _scale, _disp);
-}
-
-// DeferredReadValue
-
-DeferredReadValue::DeferredReadValue(DebugInfoReadStream* stream)
-: DeferredLocationValue(stream) {
-}
-
-void DeferredReadValue::write_on(DebugInfoWriteStream* st) {
-  DeferredLocationValue::write_on(st);
-}
-
-void DeferredReadValue::print_on(outputStream* st) const {
-  DeferredLocationValue::print_on(st);
-}
-
-// DeferredWriteValue
-
-DeferredWriteValue::DeferredWriteValue(DebugInfoReadStream* stream)
-: DeferredLocationValue(stream) {
-  _value = read_from(stream);
-}
-
-void DeferredWriteValue::write_on(DebugInfoWriteStream* st) {
-  DeferredLocationValue::write_on(st);
-  _value->write_on(st);
-}
-
-void DeferredWriteValue::print_on(outputStream* st) const {
-  DeferredLocationValue::print_on(st);
-  _value->print_on(st);
-}
-
-#endif // GRAAL
-
 // ObjectValue
 
 void ObjectValue::read_object(DebugInfoReadStream* stream) {
--- a/src/share/vm/code/debugInfo.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/debugInfo.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -61,11 +61,6 @@
   // Serialization of debugging information
   virtual void write_on(DebugInfoWriteStream* stream) = 0;
   static ScopeValue* read_from(DebugInfoReadStream* stream);
-
-#ifdef GRAAL
-  // Printing
-  virtual void print_on(outputStream* st) const = 0;
-#endif // GRAAL
 };
 
 
@@ -88,64 +83,6 @@
   void print_on(outputStream* st) const;
 };
 
-#ifdef GRAAL
-
-class DeferredLocationValue: public ScopeValue {
-private:
-  ScopeValue* _base;
-  ScopeValue* _index;
-  jint _scale;
-  jlong _disp;
-public:
-  DeferredLocationValue(ScopeValue* base, ScopeValue* index, jint scale, jlong disp)
-  : _base(base), _index(index), _scale(scale), _disp(disp) { }
-
-  ScopeValue* base() { return _base; }
-  ScopeValue* index() { return _index; }
-  jint scale() { return _scale; }
-  jlong disp() { return _disp; }
-
-  // Serialization of debugging information
-  DeferredLocationValue(DebugInfoReadStream* stream);
-  void write_on(DebugInfoWriteStream* stream);
-
-  // Printing
-  void print_on(outputStream* st) const;
-};
-
-
-class DeferredReadValue: public DeferredLocationValue {
-public:
-  DeferredReadValue(ScopeValue* base, ScopeValue* index, jint scale, jint disp)
-  : DeferredLocationValue(base, index, scale, disp) { }
-
-  // Serialization of debugging information
-  DeferredReadValue(DebugInfoReadStream* stream);
-  void write_on(DebugInfoWriteStream* stream);
-
-  // Printing
-  void print_on(outputStream* st) const;
-};
-
-class DeferredWriteValue: public DeferredLocationValue {
-private:
-  ScopeValue* _value;
-public:
-  DeferredWriteValue(ScopeValue* base, ScopeValue* index, jint scale, jint disp, ScopeValue* value)
-  : DeferredLocationValue(base, index, scale, disp), _value(value) { }
-
-  ScopeValue* value() { return _value; }
-
-  // Serialization of debugging information
-  DeferredWriteValue(DebugInfoReadStream* stream);
-  void write_on(DebugInfoWriteStream* stream);
-
-  // Printing
-  void print_on(outputStream* st) const;
-};
-
-#endif // GRAAL
-
 
 // An ObjectValue describes an object eliminated by escape analysis.
 
--- a/src/share/vm/code/debugInfoRec.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/debugInfoRec.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -289,8 +289,7 @@
                                               bool        return_oop,
                                               DebugToken* locals,
                                               DebugToken* expressions,
-                                              DebugToken* monitors
-                                              ) {
+                                              DebugToken* monitors) {
   assert(_recording_state != rs_null, "nesting of recording calls");
   PcDesc* last_pd = last_pc();
   assert(last_pd->pc_offset() == pc_offset, "must be last pc");
--- a/src/share/vm/code/debugInfoRec.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/debugInfoRec.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -107,8 +107,7 @@
                       bool        return_oop = false,
                       DebugToken* locals      = NULL,
                       DebugToken* expressions = NULL,
-                      DebugToken* monitors    = NULL
-                      );
+                      DebugToken* monitors    = NULL);
 
 
   void dump_object_pool(GrowableArray<ScopeValue*>* objects);
--- a/src/share/vm/code/dependencies.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/dependencies.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -563,6 +563,7 @@
   _size_in_bytes = bytes.position();
 }
 
+
 const char* Dependencies::_dep_name[TYPE_LIMIT] = {
   "end_marker",
   "evol_method",
--- a/src/share/vm/code/icBuffer.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/icBuffer.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -96,8 +96,8 @@
 void ICStub::verify() {
 }
 
-void ICStub::print_on(outputStream* st) {
-  st->print_cr("ICStub: site: " INTPTR_FORMAT, _ic_site);
+void ICStub::print() {
+  tty->print_cr("ICStub: site: " INTPTR_FORMAT, _ic_site);
 }
 #endif
 
--- a/src/share/vm/code/icBuffer.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/icBuffer.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -75,8 +75,8 @@
   void* cached_value() const;   // cached_value for stub
 
   // Debugging
-  void    verify()                   PRODUCT_RETURN;
-  void    print_on(outputStream* st) PRODUCT_RETURN;
+  void    verify()            PRODUCT_RETURN;
+  void    print()             PRODUCT_RETURN;
 
   // Creation
   friend ICStub* ICStub_from_destination_address(address destination_address);
--- a/src/share/vm/code/nmethod.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/nmethod.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -42,8 +42,6 @@
 #include "utilities/dtrace.hpp"
 #include "utilities/events.hpp"
 #include "utilities/xmlstream.hpp"
-#include "utilities/debug.hpp"
-#include "utilities/machineCodePrinter.hpp"
 #ifdef SHARK
 #include "shark/sharkCompiler.hpp"
 #endif
@@ -126,6 +124,7 @@
 //   PrintC1Statistics, PrintOptoStatistics, LogVMOutput, and LogCompilation.
 // (In the latter two cases, they like other stats are printed to the log only.)
 
+#ifndef PRODUCT
 // These variables are put into one block to reduce relocations
 // and make it simpler to print from the debugger.
 static
@@ -215,6 +214,7 @@
                   pc_desc_tests, pc_desc_searches, pc_desc_adds);
   }
 } nmethod_stats;
+#endif //PRODUCT
 
 
 //---------------------------------------------------------------------------------
@@ -520,13 +520,9 @@
               code_buffer, frame_size,
               basic_lock_owner_sp_offset, basic_lock_sp_offset,
               oop_maps);
-    if (nm != NULL)  nmethod_stats.note_native_nmethod(nm);
+    NOT_PRODUCT(if (nm != NULL)  nmethod_stats.note_native_nmethod(nm));
     if (PrintAssembly && nm != NULL)
       Disassembler::decode(nm);
-
-    if (PrintMachineCodeToFile) {
-      MachineCodePrinter::print(nm);
-    }
   }
   // verify nmethod
   debug_only(if (nm) nm->verify();) // might block
@@ -558,7 +554,7 @@
 
     nm = new (nmethod_size) nmethod(method(), nmethod_size, &offsets, code_buffer, frame_size);
 
-    if (nm != NULL)  nmethod_stats.note_nmethod(nm);
+    NOT_PRODUCT(if (nm != NULL)  nmethod_stats.note_nmethod(nm));
     if (PrintAssembly && nm != NULL)
       Disassembler::decode(nm);
   }
@@ -637,13 +633,9 @@
         InstanceKlass::cast(klass)->add_dependent_nmethod(nm);
       }
     }
-    if (nm != NULL)  nmethod_stats.note_nmethod(nm);
+    NOT_PRODUCT(if (nm != NULL)  nmethod_stats.note_nmethod(nm));
     if (PrintAssembly && nm != NULL)
       Disassembler::decode(nm);
-
-    if (nm != NULL && PrintMachineCodeToFile) {
-      MachineCodePrinter::print(nm);
-    }
   }
 
   // verify nmethod
@@ -1819,8 +1811,8 @@
 // really alive.
 void nmethod::verify_metadata_loaders(address low_boundary, BoolObjectClosure* is_alive) {
 #ifdef ASSERT
-  RelocIterator iter(this, low_boundary);
-  while (iter.next()) {
+    RelocIterator iter(this, low_boundary);
+    while (iter.next()) {
     // static_stub_Relocations may have dangling references to
     // Method*s so trim them out here.  Otherwise it looks like
     // compiled code is maintaining a link to dead metadata.
@@ -1829,13 +1821,11 @@
       CompiledIC* cic = CompiledIC_at(iter.reloc());
       if (!cic->is_call_to_interpreted()) {
         static_call_addr = iter.addr();
-        cic->set_to_clean();
       }
     } else if (iter.type() == relocInfo::static_call_type) {
       CompiledStaticCall* csc = compiledStaticCall_at(iter.reloc());
       if (!csc->is_call_to_interpreted()) {
         static_call_addr = iter.addr();
-        csc->set_to_clean();
       }
     }
     if (static_call_addr != NULL) {
@@ -2512,9 +2502,7 @@
         // information in a table.
         break;
     }
-#ifndef GRAAL
     assert(stub == NULL || stub_contains(stub), "static call stub outside stub section");
-#endif
   }
 }
 
@@ -3006,8 +2994,6 @@
   ImplicitExceptionTable(this).print(code_begin());
 }
 
-#endif // PRODUCT
-
 void nmethod::print_statistics() {
   ttyLocker ttyl;
   if (xtty != NULL)  xtty->head("statistics type='nmethod'");
@@ -3019,18 +3005,4 @@
   if (xtty != NULL)  xtty->tail("statistics");
 }
 
-#ifdef GRAAL
-void DebugScopedNMethod::print_on(outputStream* st) {
-  if (_nm != NULL) {
-    st->print("nmethod@%p", _nm);
-    Method* method = _nm->method();
-    if (method != NULL) {
-      char holder[O_BUFLEN];
-      char nameAndSig[O_BUFLEN];
-      method->method_holder()->name()->as_C_string(holder, O_BUFLEN);
-      method->name_and_sig_as_C_string(nameAndSig, O_BUFLEN);
-      st->print(" - %s::%s", holder, nameAndSig);
-    }
-  }
-}
-#endif
+#endif // PRODUCT
--- a/src/share/vm/code/nmethod.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/nmethod.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -291,7 +291,7 @@
   // Inform external interfaces that a compiled method has been unloaded
   void post_compiled_method_unload();
 
-  // Initialize fields to their default values
+  // Initailize fields to their default values
   void init_defaults();
 
  public:
@@ -357,9 +357,6 @@
   bool is_compiled_by_c2() const;
   bool is_compiled_by_shark() const;
 
-
-#define CHECK_POSITIVE(val) assert(val, "should be positive")
-
   // boundaries for different parts
   address consts_begin          () const          { return           header_begin() + _consts_offset        ; }
   address consts_end            () const          { return           header_begin() +  code_offset()        ; }
@@ -367,8 +364,8 @@
   address insts_end             () const          { return           header_begin() + _stub_offset          ; }
   address stub_begin            () const          { return           header_begin() + _stub_offset          ; }
   address stub_end              () const          { return           header_begin() + _oops_offset          ; }
-  address exception_begin       () const          { assert(_exception_offset >= 0, "no exception handler"); return header_begin() + _exception_offset ; }
-  address deopt_handler_begin   () const          { assert(_deoptimize_offset >= 0, "no deopt handler"); return header_begin() + _deoptimize_offset ; }
+  address exception_begin       () const          { return           header_begin() + _exception_offset     ; }
+  address deopt_handler_begin   () const          { return           header_begin() + _deoptimize_offset    ; }
   address deopt_mh_handler_begin() const          { return           header_begin() + _deoptimize_mh_offset ; }
   address unwind_handler_begin  () const          { return _unwind_handler_offset != -1 ? (header_begin() + _unwind_handler_offset) : NULL; }
   oop*    oops_begin            () const          { return (oop*)   (header_begin() + _oops_offset)         ; }
@@ -689,7 +686,7 @@
 
   // Prints a comment for one native instruction (reloc info, pc desc)
   void print_code_comment_on(outputStream* st, int column, address begin, address end);
-  static void print_statistics();
+  static void print_statistics()                  PRODUCT_RETURN;
 
   // Compiler task identification.  Note that all OSR methods
   // are numbered in an independent sequence if CICountOSR is true,
@@ -774,19 +771,4 @@
   }
 };
 
-#ifdef GRAAL
-class DebugScopedNMethod : public DebugScopedValue {
-private:
-  nmethod* _nm;
-public:
-  DebugScopedNMethod(const char* file, int line, nmethod* nm) : DebugScopedValue(file, line), _nm(nm) {}
-  void print_on(outputStream* st);
-};
-#define DS_NMETHOD(nm) DebugScopedNMethod __dsnm__(__FILE__, __LINE__, nm)
-#define DS_NMETHOD1(name, nm) DebugScopedNMethod name(__FILE__, __LINE__, nm)
-#else
-#define DS_NMETHOD(nm) do {} while (0)
-#define DS_NMETHOD1(name, nm) do {} while (0)
-#endif
-
 #endif // SHARE_VM_CODE_NMETHOD_HPP
--- a/src/share/vm/code/pcDesc.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/pcDesc.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -81,8 +81,7 @@
   bool is_same_info(const PcDesc* pd) {
     return _scope_decode_offset == pd->_scope_decode_offset &&
       _obj_decode_offset == pd->_obj_decode_offset &&
-      _flags == pd->_flags
-      ;
+      _flags == pd->_flags;
   }
 
   bool     is_method_handle_invoke()       const { return (_flags & PCDESC_is_method_handle_invoke) != 0;     }
--- a/src/share/vm/code/stubs.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/stubs.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -254,9 +254,10 @@
   guarantee(_queue_begin != _queue_end || n == 0, "buffer indices must be the same");
 }
 
-void StubQueue::print_on(outputStream* st) const {
+
+void StubQueue::print() {
   MutexLockerEx lock(_mutex);
   for (Stub* s = first(); s != NULL; s = next(s)) {
-    stub_print(s, st);
+    stub_print(s);
   }
 }
--- a/src/share/vm/code/stubs.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/code/stubs.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -107,21 +107,20 @@
  public:
   // Initialization/finalization
   virtual void    initialize(Stub* self, int size,
-                             CodeComments& comments)           = 0; // called after creation (called twice if allocated via (request, commit))
-  virtual void    finalize(Stub* self)                         = 0; // called before deallocation
+                             CodeComments& comments)       = 0; // called after creation (called twice if allocated via (request, commit))
+  virtual void    finalize(Stub* self)                     = 0; // called before deallocation
 
   // General info/converters
-  virtual int     size(Stub* self) const                       = 0; // the total size of the stub in bytes (must be a multiple of CodeEntryAlignment)
-  virtual int     code_size_to_size(int code_size) const       = 0; // computes the total stub size in bytes given the code size in bytes
+  virtual int     size(Stub* self) const                   = 0; // the total size of the stub in bytes (must be a multiple of CodeEntryAlignment)
+  virtual int     code_size_to_size(int code_size) const   = 0; // computes the total stub size in bytes given the code size in bytes
 
   // Code info
-  virtual address code_begin(Stub* self) const                 = 0; // points to the first code byte
-  virtual address code_end(Stub* self) const                   = 0; // points to the first byte after the code
+  virtual address code_begin(Stub* self) const             = 0; // points to the first code byte
+  virtual address code_end(Stub* self) const               = 0; // points to the first byte after the code
 
   // Debugging
-  virtual void    verify(Stub* self) const                     = 0; // verifies the stub
-  NOT_PRODUCT(using AllocatedObj::print_on;)
-  virtual void    print_on(Stub* self, outputStream* st) const = 0; // prints information about the stub
+  virtual void    verify(Stub* self)                       = 0; // verifies the stub
+  virtual void    print(Stub* self)                        = 0; // prints information about the stub
 };
 
 
@@ -129,29 +128,28 @@
 // class, forwarding stub interface calls to the corresponding
 // stub calls.
 
-#define DEF_STUB_INTERFACE(stub)                                 \
-  class stub##Interface: public StubInterface {                  \
-   private:                                                      \
-    static stub*    cast(Stub* self)                             { return (stub*)self; }                 \
-                                                                 \
-   public:                                                       \
-    /* Initialization/finalization */                            \
-    virtual void    initialize(Stub* self, int size,             \
-                               CodeComments& comments)           { cast(self)->initialize(size, comments); } \
-    virtual void    finalize(Stub* self)                         { cast(self)->finalize(); }             \
-                                                                 \
-    /* General info */                                           \
-    virtual int     size(Stub* self) const                       { return cast(self)->size(); }          \
-    virtual int     code_size_to_size(int code_size) const       { return stub::code_size_to_size(code_size); } \
-                                                                 \
-    /* Code info */                                              \
-    virtual address code_begin(Stub* self) const                 { return cast(self)->code_begin(); }    \
-    virtual address code_end(Stub* self) const                   { return cast(self)->code_end(); }      \
-                                                                 \
-    /* Debugging */                                              \
-    virtual void    verify(Stub* self) const                     { cast(self)->verify(); }               \
-    NOT_PRODUCT(using AllocatedObj::print_on;)                   \
-    virtual void    print_on(Stub* self, outputStream* st) const { cast(self)->print_on(st); }           \
+#define DEF_STUB_INTERFACE(stub)                           \
+  class stub##Interface: public StubInterface {            \
+   private:                                                \
+    static stub*    cast(Stub* self)                       { return (stub*)self; }                 \
+                                                           \
+   public:                                                 \
+    /* Initialization/finalization */                      \
+    virtual void    initialize(Stub* self, int size,       \
+                               CodeComments& comments)     { cast(self)->initialize(size, comments); } \
+    virtual void    finalize(Stub* self)                   { cast(self)->finalize(); }             \
+                                                           \
+    /* General info */                                     \
+    virtual int     size(Stub* self) const                 { return cast(self)->size(); }          \
+    virtual int     code_size_to_size(int code_size) const { return stub::code_size_to_size(code_size); } \
+                                                           \
+    /* Code info */                                        \
+    virtual address code_begin(Stub* self) const           { return cast(self)->code_begin(); }    \
+    virtual address code_end(Stub* self) const             { return cast(self)->code_end(); }      \
+                                                           \
+    /* Debugging */                                        \
+    virtual void    verify(Stub* self)                     { cast(self)->verify(); }               \
+    virtual void    print(Stub* self)                      { cast(self)->print(); }                \
   };
 
 
@@ -184,7 +182,7 @@
   bool  stub_contains(Stub* s, address pc) const { return _stub_interface->code_begin(s) <= pc && pc < _stub_interface->code_end(s); }
   int   stub_code_size_to_size(int code_size) const { return _stub_interface->code_size_to_size(code_size); }
   void  stub_verify(Stub* s)                     { _stub_interface->verify(s); }
-  void  stub_print(Stub* s, outputStream* st) const { _stub_interface->print_on(s, st); }
+  void  stub_print(Stub* s)                      { _stub_interface->print(s); }
 
   static void register_queue(StubQueue*);
 
@@ -228,9 +226,8 @@
   address stub_code_end(Stub* s) const           { return _stub_interface->code_end(s);   }
 
   // Debugging/printing
-  void verify();                                 // verifies the stub queue
-  virtual void print() const                     { print_on(tty); }
-  virtual void print_on(outputStream* st) const;
+  void  verify();                                // verifies the stub queue
+  void  print();                                 // prints information about the stub queue
 };
 
 #endif // SHARE_VM_CODE_STUBS_HPP
--- a/src/share/vm/compiler/compileBroker.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/compiler/compileBroker.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -44,9 +44,6 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/sweeper.hpp"
 #include "utilities/dtrace.hpp"
-#ifdef GRAAL
-#include "graal/graalCompiler.hpp"
-#endif
 #include "utilities/events.hpp"
 #ifdef COMPILER1
 #include "c1/c1_Compiler.hpp"
--- a/src/share/vm/compiler/oopMap.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/compiler/oopMap.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -47,7 +47,7 @@
 class OopMapValue: public StackObj {
   friend class VMStructs;
 private:
-  int _value;
+  short _value;
   int value() const                                 { return _value; }
   void set_value(int value)                         { _value = value; }
   short _content_reg;
@@ -55,7 +55,7 @@
 public:
   // Constants
   enum { type_bits                = 5,
-         register_bits            = BitsPerJavaInteger - type_bits };
+         register_bits            = BitsPerShort - type_bits };
 
   enum { type_shift               = 0,
          register_shift           = type_bits };
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -617,7 +617,6 @@
 
   NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset);
   jint next_pc_offset = 0x0;
-  bool is_call_reg = false;
   if (inst->is_call() || inst->is_jump()) {
     assert(NativeCall::instruction_size == (int)NativeJump::instruction_size, "unexpected size");
     next_pc_offset = pc_offset + NativeCall::instruction_size;
@@ -630,10 +629,8 @@
   } else if (inst->is_call_reg()) {
     // the inlined vtable stub contains a "call register" instruction
     assert(hotspot_method != NULL, "only valid for virtual calls");
-    is_call_reg = true;
     next_pc_offset = pc_offset + ((NativeCallReg *) inst)->next_instruction_offset();
   } else {
-    tty->print_cr("at pc_offset %d", pc_offset);
     fatal("unsupported type of instruction for call site");
   }
 
--- a/src/share/vm/graal/graalCompiler.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/graal/graalCompiler.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -159,11 +159,10 @@
 
   assert(_initialized, "must already be initialized");
   ResourceMark rm;
-  assert(JavaThread::current()->env() == NULL, "ciEnv should be null");
-  JavaThread::current()->set_compiling(true);
+  JavaThread::current()->set_is_compiling(true);
   Handle holder = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK);
   jboolean success = VMToCompiler::compileMethod(method(), holder, entry_bci, blocking, method->graal_priority());
-  JavaThread::current()->set_compiling(false);
+  JavaThread::current()->set_is_compiling(false);
   if (success != JNI_TRUE) {
     method->clear_queued_for_compilation();
     CompilationPolicy::policy()->delay_compilation(method());
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -877,7 +877,8 @@
     THROW_0(vmSymbols::MethodInvalidatedException());
   }
 
-  JavaCalls::call(&result, mh, nm, &jca, CHECK_NULL);
+  jca.set_alternative_target(nm);
+  JavaCalls::call(&result, mh, &jca, CHECK_NULL);
 
   if (jap.get_ret_type() == T_VOID) {
     return NULL;
@@ -906,7 +907,8 @@
     THROW_0(vmSymbols::MethodInvalidatedException());
   }
 
-  JavaCalls::call(&result, method, nm, &args, CHECK_NULL);
+  args.set_alternative_target(nm);
+  JavaCalls::call(&result, method, &args, CHECK_NULL);
 
   return JNIHandles::make_local((oop) result.get_jobject());
 C2V_END
--- a/src/share/vm/interpreter/interpreter.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/interpreter/interpreter.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -63,8 +63,9 @@
 
 void InterpreterCodelet::print_on(outputStream* st) const {
   ttyLocker ttyl;
-  if (PrintInterpreter || PrintMachineCodeToFile) {
 
+  if (PrintInterpreter) {
+    st->cr();
     st->print_cr("----------------------------------------------------------------------");
   }
 
@@ -73,7 +74,8 @@
   st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "]  %d bytes",
                 code_begin(), code_end(), code_size());
 
-  if (PrintInterpreter || PrintMachineCodeToFile) {
+  if (PrintInterpreter) {
+    st->cr();
     Disassembler::decode(code_begin(), code_end(), st, DEBUG_ONLY(_comments) NOT_DEBUG(CodeComments()));
   }
 }
@@ -388,7 +390,6 @@
   assert(method->contains(bcp), "just checkin'");
   Bytecodes::Code code   = Bytecodes::java_code_at(method, bcp);
 #if defined(COMPILER1) || defined(GRAAL)
-
   if(code == Bytecodes::_athrow ) {
     return Interpreter::rethrow_exception_entry();
   }
@@ -434,8 +435,7 @@
     case Bytecodes::_getstatic :
     case Bytecodes::_putstatic :
     case Bytecodes::_aastore   :
-#if defined(COMPILER1)
-
+#ifdef COMPILER1
     //special case of reexecution
     case Bytecodes::_athrow    :
 #endif
--- a/src/share/vm/interpreter/rewriter.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/interpreter/rewriter.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -115,9 +115,7 @@
   while (!bcs.is_last_bytecode()) {
     Bytecodes::Code opcode = bcs.raw_next();
     switch (opcode) {
-      case Bytecodes::_return:
-          *bcs.bcp() = Bytecodes::_return_register_finalizer;
-        break;
+      case Bytecodes::_return: *bcs.bcp() = Bytecodes::_return_register_finalizer; break;
 
       case Bytecodes::_istore:
       case Bytecodes::_lstore:
@@ -317,12 +315,12 @@
       switch (c) {
         case Bytecodes::_lookupswitch   : {
 #ifndef CC_INTERP
-            Bytecode_lookupswitch bc(method, bcp);
-            (*bcp) = (
-              bc.number_of_pairs() < BinarySwitchThreshold
-              ? Bytecodes::_fast_linearswitch
-              : Bytecodes::_fast_binaryswitch
-            );
+          Bytecode_lookupswitch bc(method, bcp);
+          (*bcp) = (
+            bc.number_of_pairs() < BinarySwitchThreshold
+            ? Bytecodes::_fast_linearswitch
+            : Bytecodes::_fast_binaryswitch
+          );
 #endif
           break;
         }
--- a/src/share/vm/interpreter/templateInterpreter.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/interpreter/templateInterpreter.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -27,7 +27,6 @@
 #include "interpreter/interpreterGenerator.hpp"
 #include "interpreter/interpreterRuntime.hpp"
 #include "interpreter/templateTable.hpp"
-#include "utilities/machineCodePrinter.hpp"
 
 #ifndef CC_INTERP
 
@@ -52,9 +51,6 @@
                           "Interpreter");
     InterpreterGenerator g(_code);
     if (PrintInterpreter) print();
-    if (PrintMachineCodeToFile) {
-      MachineCodePrinter::print(_code);
-    }
   }
 
   // initialize dispatch table
--- a/src/share/vm/memory/allocation.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/memory/allocation.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -34,9 +34,6 @@
 #ifdef COMPILER2
 #include "opto/c2_globals.hpp"
 #endif
-#ifdef GRAAL
-#include "graal/graalGlobals.hpp"
-#endif
 
 #include <new>
 
--- a/src/share/vm/memory/heap.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/memory/heap.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -127,7 +127,7 @@
   assert(_number_of_reserved_segments >= _number_of_committed_segments, "just checking");
 
   // reserve space for _segmap
-  if (!_segmap.initialize(align_to_allocation_size(_number_of_reserved_segments), align_to_allocation_size(_number_of_committed_segments))) {
+  if (!_segmap.initialize(align_to_page_size(_number_of_reserved_segments), align_to_page_size(_number_of_committed_segments))) {
     return false;
   }
 
--- a/src/share/vm/oops/instanceKlass.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/oops/instanceKlass.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -1024,6 +1024,7 @@
   void print_value_on(outputStream* st) const;
 
   void oop_print_value_on(oop obj, outputStream* st);
+
 #ifndef PRODUCT
   void oop_print_on      (oop obj, outputStream* st);
 
--- a/src/share/vm/oops/method.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/oops/method.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -54,9 +54,6 @@
 #include "runtime/signature.hpp"
 #include "utilities/quickSort.hpp"
 #include "utilities/xmlstream.hpp"
-#ifdef GRAAL
-#include "graal/graalJavaAccess.hpp"
-#endif
 
 
 // Implementation of Method
@@ -712,7 +709,6 @@
     tty->cr();
   }
   if ((TraceDeoptimization || LogCompilation) && (xtty != NULL)) {
-    ResourceMark rm;
     ttyLocker ttyl;
     xtty->begin_elem("make_not_%scompilable thread='" UINTX_FORMAT "'",
                      is_osr ? "osr_" : "", os::current_thread_id());
@@ -1944,16 +1940,3 @@
   guarantee(md == NULL ||
       md->is_methodData(), "should be method data");
 }
-
-#ifdef GRAAL
-void DebugScopedMethod::print_on(outputStream* st) {
-  if (_method != NULL) {
-    st->print("Method@%p", _method);
-    char holder[O_BUFLEN];
-    char nameAndSig[O_BUFLEN];
-    _method->method_holder()->name()->as_C_string(holder, O_BUFLEN);
-    _method->name_and_sig_as_C_string(nameAndSig, O_BUFLEN);
-    st->print(" - %s::%s", holder, nameAndSig);
-  }
-}
-#endif
--- a/src/share/vm/oops/method.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/oops/method.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -1000,20 +1000,4 @@
   }
 };
 
-#ifdef GRAAL
-class DebugScopedMethod : public DebugScopedValue {
-private:
-  Method* _method;
-public:
-  DebugScopedMethod(const char* file, int line, Method* method) : DebugScopedValue(file, line), _method(method) {}
-  void print_on(outputStream* st);
-};
-#define DS_METHOD(method) DebugScopedMethod __dsm__(__FILE__, __LINE__, method)
-#define DS_METHOD1(var, method) DebugScopedMethod var(__FILE__, __LINE__, method)
-#else
-#define DS_METHOD(method) do {} while (0)
-#define DS_METHOD1(var, method) do {} while (0)
-#endif
-
 #endif // SHARE_VM_OOPS_METHODOOP_HPP
-
--- a/src/share/vm/opto/bytecodeInfo.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/opto/bytecodeInfo.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -236,7 +236,8 @@
     return false;
   }
   if (callee_method->should_not_inline()) {
-    return "disallowed by CompilerOracle";
+    set_msg("disallowed by CompilerOracle");
+    return false;
   }
 
   // Now perform checks which are heuristic
--- a/src/share/vm/prims/jni.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/prims/jni.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -1319,7 +1319,6 @@
 }
 
 
-static bool first_time_InvokeMain = true;
 
 static void jni_invoke_static(JNIEnv *env, JavaValue* result, jobject receiver, JNICallType call_type, jmethodID method_id, JNI_ArgumentPusher *args, TRAPS) {
   methodHandle method(THREAD, Method::resolve_jmethod_id(method_id));
@@ -1328,8 +1327,6 @@
   // the jni parser
   ResourceMark rm(THREAD);
   int number_of_parameters = method->size_of_parameters();
-
-  // Invoke the method. Result is returned as oop.
   JavaCallArguments java_args(number_of_parameters);
   args->set_java_argument_object(&java_args);
 
@@ -1337,23 +1334,16 @@
 
   // Fill out JavaCallArguments object
   args->iterate( Fingerprinter(method).fingerprint() );
-  // Initialize result type (must be done after args->iterate())
+  // Initialize result type
   result->set_type(args->get_ret_type());
 
+  // Invoke the method. Result is returned as oop.
   JavaCalls::call(result, method, &java_args, CHECK);
 
   // Convert result
   if (result->get_type() == T_OBJECT || result->get_type() == T_ARRAY) {
     result->set_jobject(JNIHandles::make_local(env, (oop) result->get_jobject()));
   }
-
-#ifdef HIGH_LEVEL_INTERPRETER
-  if (invoked_main_method) {
-    assert(THREAD->is_Java_thread(), "other threads must not call into java");
-    JavaThread* thread = (JavaThread*)THREAD;
-    thread->set_high_level_interpreter_in_vm(false);
-  }
-#endif
 }
 
 
--- a/src/share/vm/runtime/arguments.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/arguments.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -2180,6 +2180,7 @@
 }
 
 // Parse JavaVMInitArgs structure
+
 jint Arguments::parse_vm_init_args(const JavaVMInitArgs* args) {
   // For components of the system classpath.
   SysClassPath scp(Arguments::get_sysclasspath());
--- a/src/share/vm/runtime/basicLock.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/basicLock.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -63,7 +63,6 @@
  public:
   // Manipulation
   oop      obj() const                                { return _obj;  }
-  oop*     obj_addr()                                 { return &_obj; }
   void set_obj(oop obj)                               { _obj = obj; }
   BasicLock* lock()                                   { return &_lock; }
 
--- a/src/share/vm/runtime/compilationPolicy.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/compilationPolicy.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -60,7 +60,7 @@
     break;
 
   case 1:
-#if defined(COMPILER2)
+#ifdef COMPILER2
     CompilationPolicy::set_policy(new StackWalkCompPolicy());
 #else
     Unimplemented();
@@ -81,7 +81,7 @@
 #endif
     break;
   case 4:
-#if defined(GRAALVM)
+#ifdef GRAALVM
     CompilationPolicy::set_policy(new GraalCompPolicy());
 #else
     Unimplemented();
@@ -188,7 +188,6 @@
 #endif
 
 #ifdef COMPILER1
-  GRAALVM_ONLY(ShouldNotReachHere();)
   if (is_c1_compile(comp_level)) {
     return _compiler_count;
   } else {
@@ -212,7 +211,6 @@
 }
 
 void NonTieredCompPolicy::reset_counter_for_back_branch_event(methodHandle m) {
-//  GRAAL_ONLY(assert(false, "unexpected"));
   // Delay next back-branch event but pump up invocation counter to triger
   // whole method compilation.
   InvocationCounter* i = m->invocation_counter();
@@ -510,7 +508,7 @@
 
 // StackWalkCompPolicy - walk up stack to find a suitable method to compile
 
-#if defined(COMPILER2)
+#ifdef COMPILER2
 const char* StackWalkCompPolicy::_msg = NULL;
 
 
--- a/src/share/vm/runtime/compilationPolicy.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/compilationPolicy.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -126,7 +126,7 @@
 
 // StackWalkCompPolicy - existing C2 policy
 
-#if defined(COMPILER2)
+#ifdef COMPILER2
 class StackWalkCompPolicy : public NonTieredCompPolicy {
  public:
   virtual void method_invocation_event(methodHandle m, JavaThread* thread);
--- a/src/share/vm/runtime/deoptimization.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/deoptimization.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -1325,7 +1325,7 @@
       GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
       guarantee(expressions != NULL, "must have exception to throw");
       ScopeValue* topOfStack = expressions->top();
-      Handle topOfStackObj = cvf->create_stack_value(topOfStack)->get_obj();
+      Handle topOfStackObj = StackValue::create_stack_value(&fr, &reg_map, topOfStack)->get_obj();
       THREAD->set_pending_exception(topOfStackObj(), NULL, 0);
     }
     
--- a/src/share/vm/runtime/deoptimization.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/deoptimization.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -37,7 +37,7 @@
   friend class VMStructs;
 
  public:
-  // What condition caused the deoptimization
+  // What condition caused the deoptimization?
   enum DeoptReason {
     Reason_many = -1,             // indicates presence of several reasons
     Reason_none = 0,              // indicates absence of a relevant deopt.
@@ -85,7 +85,7 @@
     // Note:  Reason_RECORDED_LIMIT should be < 8 to fit into 3 bits of
     // DataLayout::trap_bits.  This dependency is enforced indirectly
     // via asserts, to avoid excessive direct header-to-header dependencies.
-    // See Deoptimization::trap_state_reason and class DataLayout
+    // See Deoptimization::trap_state_reason and class DataLayout.
   };
 
   // What action must be taken by the runtime?
@@ -132,7 +132,7 @@
   // executing in a particular CodeBlob if UseBiasedLocking is enabled
   static void revoke_biases_of_monitors(CodeBlob* cb);
 
-//#ifdef COMPILER2
+#if defined(COMPILER2) || defined(GRAAL)
   // Support for restoring non-escaping objects
   static bool realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS);
   static void reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type);
@@ -140,7 +140,7 @@
   static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects);
   static void relock_objects(GrowableArray<MonitorInfo*>* monitors, JavaThread* thread);
   NOT_PRODUCT(static void print_objects(GrowableArray<ScopeValue*>* objects);)
-//#endif // COMPILER2
+#endif // COMPILER2 || GRAAL
 
   public:
   static vframeArray* create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk);
@@ -319,12 +319,11 @@
     assert((1 << _reason_bits) >= Reason_LIMIT, "enough bits");
     assert((1 << _action_bits) >= Action_LIMIT, "enough bits");
     int trap_request;
-    if (index != -1) {
+    if (index != -1)
       trap_request = index;
-    } else {
+    else
       trap_request = (~(((reason) << _reason_shift)
                         + ((action) << _action_shift)));
-    }
     assert(reason == trap_request_reason(trap_request), "valid reason");
     assert(action == trap_request_action(trap_request), "valid action");
     assert(index  == trap_request_index(trap_request),  "valid index");
--- a/src/share/vm/runtime/fieldDescriptor.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/fieldDescriptor.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -25,10 +25,7 @@
 #ifndef SHARE_VM_RUNTIME_FIELDDESCRIPTOR_HPP
 #define SHARE_VM_RUNTIME_FIELDDESCRIPTOR_HPP
 
-#include "oops/annotations.hpp"
 #include "oops/constantPool.hpp"
-#include "oops/fieldInfo.hpp"
-#include "oops/instanceKlass.hpp"
 #include "oops/symbol.hpp"
 #include "runtime/fieldType.hpp"
 #include "utilities/accessFlags.hpp"
--- a/src/share/vm/runtime/frame.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/frame.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -597,67 +597,44 @@
 void frame::interpreter_frame_print_on(outputStream* st) const {
 #ifndef PRODUCT
   assert(is_interpreted_frame(), "Not an interpreted frame");
-  assert(interpreter_frame_method() != NULL && interpreter_frame_method()->contains(interpreter_frame_bcp()), "must be");
   jint i;
-  st->print_cr(" - sp                                  = " INTPTR_FORMAT, sp());
-  // expressions
+  for (i = 0; i < interpreter_frame_method()->max_locals(); i++ ) {
+    intptr_t x = *interpreter_frame_local_at(i);
+    st->print(" - local  [" INTPTR_FORMAT "]", x);
+    st->fill_to(23);
+    st->print_cr("; #%d", i);
+  }
   for (i = interpreter_frame_expression_stack_size() - 1; i >= 0; --i ) {
-    intptr_t* x = interpreter_frame_expression_stack_at(i);
-    st->print(" - stack         at " INTPTR_FORMAT " = " INTPTR_FORMAT, x, *x);
-    st->fill_to(70);
+    intptr_t x = *interpreter_frame_expression_stack_at(i);
+    st->print(" - stack  [" INTPTR_FORMAT "]", x);
+    st->fill_to(23);
     st->print_cr("; #%d", i);
   }
   // locks for synchronization
-  st->print_cr(" - monitorend                          = " INTPTR_FORMAT, interpreter_frame_monitor_end());
   for (BasicObjectLock* current = interpreter_frame_monitor_end();
        current < interpreter_frame_monitor_begin();
        current = next_monitor_in_interpreter_frame(current)) {
-    st->print (" - lock          at " INTPTR_FORMAT " = ", current->lock());
+    st->print(" - obj    [");
+    current->obj()->print_value_on(st);
+    st->print_cr("]");
+    st->print(" - lock   [");
     current->lock()->print_on(st);
-    st->cr();
-    st->print (" - obj           at " INTPTR_FORMAT " = " INTPTR_FORMAT " ", current->obj_addr(), *current->obj_addr());
-    current->obj()->print_value_on(st);
-    st->cr();
+    st->print_cr("]");
   }
-  st->print_cr(" - monitorbegin                        = " INTPTR_FORMAT, interpreter_frame_monitor_begin());
-  
-  // bcp/bcx
-  st->print   (" - bcp           at " INTPTR_FORMAT " = " INTPTR_FORMAT, interpreter_frame_bcx_addr(), interpreter_frame_bcp());
-  st->fill_to(70);
-  st->print_cr("; @%d - %s", interpreter_frame_bci(), Bytecodes::name(interpreter_frame_method()->code_at(interpreter_frame_bci())));
+  // monitor
+  st->print_cr(" - monitor[" INTPTR_FORMAT "]", interpreter_frame_monitor_begin());
+  // bcp
+  st->print(" - bcp    [" INTPTR_FORMAT "]", interpreter_frame_bcp());
+  st->fill_to(23);
+  st->print_cr("; @%d", interpreter_frame_bci());
   // locals
-  st->print_cr(" - locals        at " INTPTR_FORMAT " = " INTPTR_FORMAT, interpreter_frame_locals_addr(), *interpreter_frame_locals_addr());
-  // constant pool cache
-  st->print_cr(" - constant pool at " INTPTR_FORMAT " = " INTPTR_FORMAT, interpreter_frame_cache_addr(), *interpreter_frame_cache_addr());
-  // method data
-  st->print_cr(" - method data   at " INTPTR_FORMAT " = " INTPTR_FORMAT, interpreter_frame_mdx_addr(), *interpreter_frame_mdx_addr());
+  st->print_cr(" - locals [" INTPTR_FORMAT "]", interpreter_frame_local_at(0));
   // method
-  st->print   (" - method        at " INTPTR_FORMAT " = " INTPTR_FORMAT, interpreter_frame_method_addr(), *interpreter_frame_method_addr());
-  st->fill_to(70);
+  st->print(" - method [" INTPTR_FORMAT "]", (address)interpreter_frame_method());
+  st->fill_to(23);
   st->print("; ");
   interpreter_frame_method()->print_name(st);
   st->cr();
-#ifdef AMD64
-  // last sp
-  st->print_cr(" - last sp       at " INTPTR_FORMAT " = " INTPTR_FORMAT, interpreter_frame_last_sp_addr(), *interpreter_frame_last_sp_addr());
-#endif
-  // sender sp
-  st->print_cr(" - sender sp     at " INTPTR_FORMAT " = " INTPTR_FORMAT, interpreter_frame_sender_sp_addr(), *interpreter_frame_sender_sp_addr());
-  // old fp
-  st->print_cr(" - old fp        at " INTPTR_FORMAT " = " INTPTR_FORMAT, link_addr(), *link_addr());
-  // return address
-  st->print_cr(" - return pc     at " INTPTR_FORMAT " = " INTPTR_FORMAT, sender_pc_addr(), *sender_pc_addr());
-
-  // locals
-  for (i = interpreter_frame_method()->max_locals() - 1; i >= 0; i--) {
-    intptr_t* x = interpreter_frame_local_at(i);
-    st->print (" - local         at " INTPTR_FORMAT " = " INTPTR_FORMAT, x, *x);
-    st->fill_to(70);
-    st->print_cr("; #%d", i);
-  }
-
-  // fp
-  st->print_cr(" - fp                                  = " INTPTR_FORMAT, fp());
 #endif
 }
 
@@ -735,9 +712,8 @@
     } else if (_cb->is_nmethod()) {
       Method* m = ((nmethod *)_cb)->method();
       if (m != NULL) {
-        address code = _cb->code_begin();
         m->name_and_sig_as_C_string(buf, buflen);
-        st->print("J  %s [" PTR_FORMAT "+%d]", buf, code, pc() - code);
+        st->print("J  %s", buf);
       } else {
         st->print("J  " PTR_FORMAT, pc());
       }
--- a/src/share/vm/runtime/frame.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/frame.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -204,11 +204,9 @@
  public:
   // Link (i.e., the pointer to the previous frame)
   intptr_t* link() const;
-  intptr_t** link_addr() const;
   void set_link(intptr_t* addr);
 
   // Return address
-  address* sender_pc_addr() const;
   address  sender_pc() const;
 
   // Support for deoptimization
@@ -305,7 +303,6 @@
   jint  interpreter_frame_expression_stack_size() const;
 
   intptr_t* interpreter_frame_sender_sp() const;
-  intptr_t** interpreter_frame_sender_sp_addr() const;
 
 #ifndef CC_INTERP
   // template based interpreter deoptimization support
--- a/src/share/vm/runtime/globals.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/globals.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -1218,9 +1218,6 @@
   notproduct(bool, TraceJVMCalls, false,                                    \
           "Trace JVM calls")                                                \
                                                                             \
-  product(bool, TraceSignals, false,                                        \
-          "Trace signals and implicit exception handling")                  \
-                                                                            \
   product(ccstr, TraceJVMTI, NULL,                                          \
           "Trace flags for JVMTI functions and events")                     \
                                                                             \
@@ -1252,7 +1249,7 @@
   develop(bool, TraceClassInitialization, false,                            \
           "Trace class initialization")                                     \
                                                                             \
-  product(bool, TraceExceptions, false,                                     \
+  develop(bool, TraceExceptions, false,                                     \
           "Trace exceptions")                                               \
                                                                             \
   develop(bool, TraceICs, false,                                            \
@@ -2621,9 +2618,6 @@
   diagnostic(bool, PrintInterpreter, false,                                 \
           "Prints the generated interpreter code")                          \
                                                                             \
-  product(bool, PrintMachineCodeToFile, false,                              \
-          "Prints the generated machine code to a file (int + comp)")       \
-                                                                            \
   product(bool, UseInterpreter, true,                                       \
           "Use interpreter for non-compiled methods")                       \
                                                                             \
--- a/src/share/vm/runtime/init.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/init.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -35,7 +35,6 @@
 #include "runtime/safepoint.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "utilities/macros.hpp"
-#include "utilities/machineCodePrinter.hpp"
 
 // Initialization done by VM thread in vm_init_globals()
 void check_ThreadShadow();
@@ -88,10 +87,6 @@
   mutex_init();
   chunkpool_init();
   perfMemory_init();
-
-  if(PrintMachineCodeToFile) {
-    MachineCodePrinter::initialize();
-  }
 }
 
 
--- a/src/share/vm/runtime/java.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/java.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -249,13 +249,10 @@
     Runtime1::print_statistics();
     Deoptimization::print_statistics();
     SharedRuntime::print_statistics();
+    nmethod::print_statistics();
   }
 #endif /* COMPILER1 */
 
-  if(PrintNMethodStatistics) {
-    nmethod::print_statistics();
-  }
-
 #ifdef COMPILER2
   if ((PrintOptoStatistics || LogVMOutput || LogCompilation) && UseCompiler) {
     FlagSetting fs(DisplayVMOutput, DisplayVMOutput && PrintOptoStatistics);
@@ -376,10 +373,6 @@
     CompileBroker::print_times();
   }
 
-  if(PrintNMethodStatistics) {
-    nmethod::print_statistics();
-  }
-
   if (PrintCodeCache) {
     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     CodeCache::print();
--- a/src/share/vm/runtime/javaCalls.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/javaCalls.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -39,21 +39,7 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/signature.hpp"
 #include "runtime/stubRoutines.hpp"
-#ifdef HIGH_LEVEL_INTERPRETER
-# include "graal/graalVMToInterpreter.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 // -----------------------------------------------------
 // Implementation of JavaCallWrapper
@@ -335,19 +321,10 @@
   assert(THREAD->is_Java_thread(), "only JavaThreads can make JavaCalls");
   // Need to wrap each and everytime, since there might be native code down the
   // stack that has installed its own exception handlers
-  os::os_exception_wrapper(call_helper, result, &method, NULL, args, THREAD);
+  os::os_exception_wrapper(call_helper, result, &method, args, THREAD);
 }
 
-void JavaCalls::call(JavaValue* result, methodHandle method, nmethod* nm, JavaCallArguments* args, TRAPS) {
-  // Check if we need to wrap a potential OS exception handler around thread
-  // This is used for e.g. Win32 structured exception handlers
-  assert(THREAD->is_Java_thread(), "only JavaThreads can make JavaCalls");
-  // Need to wrap each and everytime, since there might be native code down the
-  // stack that has installed its own exception handlers
-  os::os_exception_wrapper(call_helper, result, &method, nm, args, THREAD);
-}
-
-void JavaCalls::call_helper(JavaValue* result, methodHandle* m, nmethod* nm, JavaCallArguments* args, TRAPS) {
+void JavaCalls::call_helper(JavaValue* result, methodHandle* m, JavaCallArguments* args, TRAPS) {
   methodHandle method = *m;
   JavaThread* thread = (JavaThread*)THREAD;
   assert(thread->is_Java_thread(), "must be called by a java thread");
@@ -373,6 +350,7 @@
   }
 #endif
 
+
 #ifdef ASSERT
   { InstanceKlass* holder = method->method_holder();
     // A klass might not be initialized since JavaCall's might be used during the executing of
@@ -427,26 +405,18 @@
     os::bang_stack_shadow_pages();
   }
 
+#ifdef GRAAL
+  nmethod* nm = args->alternative_target();
   if (nm != NULL) {
-#ifdef GRAAL
     if (nm->is_alive()) {
       ((JavaThread*) THREAD)->set_graal_alternate_call_target(nm->verified_entry_point());
       entry_point = method->adapter()->get_i2c_entry();
     } else {
       THROW(vmSymbols::MethodInvalidatedException());
     }
-#else
-    ShouldNotReachHere();
+  }
 #endif
-  }
   
-#ifdef HIGH_LEVEL_INTERPRETER
-  if (thread->high_level_interpreter_in_vm() && !method->is_native() && Interpreter::contains(entry_point)) {
-    assert(nm == NULL || !nm->is_alive(), "otherwise nm should be invoked");
-    VMToInterpreter::execute(result, m, args, result->get_type(), thread);
-    oop_result_flag = false; // result already holds the correct value
-  } else
-#endif
   // do call
   { JavaCallWrapper link(method, receiver, result, CHECK);
     { HandleMark hm(thread);  // HandleMark used by HandleMarkCleaner
@@ -482,6 +452,7 @@
   }
 }
 
+
 //--------------------------------------------------------------------------------------
 // Implementation of JavaCallArguments
 
--- a/src/share/vm/runtime/javaCalls.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/javaCalls.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -98,6 +98,9 @@
   int         _size;
   int         _max_size;
   bool        _start_at_zero;      // Support late setting of receiver
+#ifdef GRAAL
+  nmethod*    _alternative_target; // Nmethod that should be called instead of normal target
+#endif
 
   void initialize() {
     // Starts at first element to support set_receiver.
@@ -107,6 +110,7 @@
     _max_size = _default_size;
     _size = 0;
     _start_at_zero = false;
+    GRAAL_ONLY(_alternative_target = NULL;)
   }
 
  public:
@@ -128,11 +132,22 @@
       _max_size = max_size;
       _size = 0;
       _start_at_zero = false;
+      GRAAL_ONLY(_alternative_target = NULL;)
     } else {
       initialize();
     }
   }
 
+#ifdef GRAAL
+  void set_alternative_target(nmethod* target) {
+    _alternative_target = target;
+  }
+
+  nmethod* alternative_target() {
+    return _alternative_target;
+  }
+#endif
+
   inline void push_oop(Handle h)    { _is_oop[_size] = true;
                                JNITypes::put_obj((oop)h.raw_value(), _value, _size); }
 
@@ -148,12 +163,6 @@
   inline void push_float(float f)   { _is_oop[_size] = false;
                                JNITypes::put_float(f, _value, _size); }
 
-  inline oop* get_raw_oop(int& pos)   { return (oop*)JNITypes::get_obj(_value, pos); }
-  inline jint get_int(int& pos)       { return JNITypes::get_int(_value, pos); }
-  inline jdouble get_double(int& pos) { return JNITypes::get_double(_value, pos); }
-  inline jlong get_long(int& pos)     { return JNITypes::get_long(_value, pos); }
-  inline jfloat get_float(int& pos)   { return JNITypes::get_float(_value, pos); }
-
   // receiver
   Handle receiver() {
     assert(_size > 0, "must at least be one argument");
@@ -185,8 +194,8 @@
 //
 
 class JavaCalls: AllStatic {
-  static void call_helper(JavaValue* result, methodHandle* method, nmethod* nm, JavaCallArguments* args, TRAPS);
-public:
+  static void call_helper(JavaValue* result, methodHandle* method, JavaCallArguments* args, TRAPS);
+ public:
   // Optimized Constuctor call
   static void call_default_constructor(JavaThread* thread, methodHandle method, Handle receiver, TRAPS);
 
@@ -225,7 +234,6 @@
 
   // Low-level interface
   static void call(JavaValue* result, methodHandle method, JavaCallArguments* args, TRAPS);
-  static void call(JavaValue* result, methodHandle method, nmethod* nm, JavaCallArguments* args, TRAPS);
 };
 
 #endif // SHARE_VM_RUNTIME_JAVACALLS_HPP
--- a/src/share/vm/runtime/os.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/os.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -79,7 +79,7 @@
 };
 
 // Typedef for structured exception handling support
-typedef void (*java_call_t)(JavaValue* value, methodHandle* method, nmethod* nm, JavaCallArguments* args, Thread* thread);
+typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread);
 
 class os: AllStatic {
  public:
@@ -658,7 +658,7 @@
   static void init_random(long initval);   // initialize random sequence
 
   // Structured OS Exception support
-  static void os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, nmethod* nm, JavaCallArguments* args, Thread* thread);
+  static void os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread);
 
   // On Windows this will create an actual minidump, on Linux/Solaris it will simply check core dump limits
   static void check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize);
--- a/src/share/vm/runtime/reflectionUtils.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/reflectionUtils.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -26,9 +26,6 @@
 #include "classfile/javaClasses.hpp"
 #include "memory/universe.inline.hpp"
 #include "runtime/reflectionUtils.hpp"
-#ifdef GRAAL
-#include "graal/graalJavaAccess.hpp"
-#endif
 
 KlassStream::KlassStream(instanceKlassHandle klass, bool local_only, bool classes_only) {
   _klass = klass;
--- a/src/share/vm/runtime/safepoint.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/safepoint.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -80,9 +80,6 @@
 #ifdef COMPILER1
 #include "c1/c1_globals.hpp"
 #endif
-#ifdef GRAAL
-#include "graal/graalGlobals.hpp"
-#endif
 
 // --------------------------------------------------------------------------------------------------
 // Implementation of Safepoint begin/end
--- a/src/share/vm/runtime/sharedRuntime.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -773,9 +773,6 @@
 #ifdef GRAAL
 address SharedRuntime::deoptimize_for_implicit_exception(JavaThread* thread, address pc, nmethod* nm, int deopt_reason) {
   assert(deopt_reason > Deoptimization::Reason_none && deopt_reason < Deoptimization::Reason_LIMIT, "invalid deopt reason");
-  if (TraceSignals) {
-    tty->print_cr(err_msg("Deoptimizing on implicit exception at relative pc=%d in method %s", pc - nm->entry_point(), nm->method()->name()->as_C_string()));
-  }
   thread->_ScratchA = (intptr_t)pc;
   thread->_ScratchB = Deoptimization::make_trap_request((Deoptimization::DeoptReason)deopt_reason, Deoptimization::Action_reinterpret);
   return (SharedRuntime::deopt_blob()->implicit_exception_uncommon_trap());
@@ -899,9 +896,6 @@
 #endif
 #ifdef GRAAL
         if (nm->is_compiled_by_graal()) {
-          if (TraceSignals) {
-            tty->print_cr("Graal implicit div0");
-          }
           target_pc = deoptimize_for_implicit_exception(thread, pc, nm, Deoptimization::Reason_div0_check);
         } else {
 #endif
--- a/src/share/vm/runtime/stackValue.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/stackValue.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -118,22 +118,6 @@
          val = (oop)NULL;
       }
 #endif
-#ifndef PRODUCT
-      if (val != NULL && !val->is_oop()) {
-        ResourceMark rm;
-        tty->print_cr("found wrong oop " INTPTR_FORMAT " at location " INTPTR_FORMAT " (%d):", val, value_addr, val->is_oop());
-        if (fr->cb() != NULL) {
-          CodeBlob* cb = fr->cb();
-          if (cb->is_nmethod()) {
-            nmethod* nm = (nmethod*)cb;
-            tty->print_cr("method is %s", nm->method()->name()->as_C_string());
-          }
-        }
-        sv->print();
-        tty->print_cr("");
-        tty->print_cr("one less %d; one more %d", (*(((oop *)value_addr) - 1))->is_oop(), (*(((oop *)value_addr) + 1))->is_oop());
-      }
-#endif
       Handle h(val); // Wrap a handle around the oop
       return new StackValue(h);
     }
--- a/src/share/vm/runtime/thread.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/thread.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -1410,7 +1410,6 @@
   // Set the claimed par_id to -1 (ie not claiming any par_ids)
   set_claimed_par_id(-1);
   
-  _env   = NULL;
   _buffer_blob = NULL;
   set_saved_exception_pc(NULL);
   set_threadObj(NULL);
@@ -1441,10 +1440,6 @@
   _stack_guard_state = stack_guard_unused;
 #ifdef GRAAL
   _graal_alternate_call_target = NULL;
-  _debug_scope = NULL;
-#endif
-#ifdef HIGH_LEVEL_INTERPRETER
-  _high_level_interpreter_in_vm = false;
 #endif
   _exception_oop = NULL;
   _exception_pc  = 0;
@@ -2194,9 +2189,7 @@
 
   // Do not throw asynchronous exceptions against the compiler thread
   // (the compiler thread should not be a Java thread -- fix in 1.4.2)
-
-  // (thomaswue) May we do this?
-  //if (is_Compiler_thread()) return;
+  if (is_Compiler_thread()) return;
 
   {
     // Actually throw the Throwable against the target Thread - however
@@ -3240,6 +3233,7 @@
 // Create a CompilerThread
 CompilerThread::CompilerThread(CompileQueue* queue, CompilerCounters* counters)
 : JavaThread(&compiler_thread_entry) {
+  _env   = NULL;
   _log   = NULL;
   _task  = NULL;
   _queue = queue;
--- a/src/share/vm/runtime/thread.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/thread.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -769,13 +769,10 @@
   JavaThread*    _next;                          // The next thread in the Threads list
   oop            _threadObj;                     // The Java level thread object
 
-  // (thomaswue) Necessary for holding a compilation buffer and ci environment.
+  // (thomaswue) Necessary for holding a compilation buffer.
   // Moved up from CompilerThread to JavaThread in order to enable code
   // installation from Java application code.
   BufferBlob*   _buffer_blob;
-  ciEnv*        _env;
-  bool          _is_compiling;
-
 #ifdef ASSERT
  private:
   int _java_call_counter;
@@ -905,12 +902,7 @@
 
 #ifdef GRAAL
   address _graal_alternate_call_target;
-  DebugScopedValue* _debug_scope;
 #endif
-#ifdef HIGH_LEVEL_INTERPRETER
-  bool _high_level_interpreter_in_vm;
-#endif
-
   StackGuardState        _stack_guard_state;
 
   nmethod*      _scanned_nmethod;  // nmethod being scanned by the sweeper
@@ -923,6 +915,9 @@
   volatile address _exception_handler_pc;        // PC for handler of exception
   volatile int     _is_method_handle_return;     // true (== 1) if the current exception PC is a MethodHandle call site.
 
+  // support for compilation
+  bool    _is_compiling;                         // is true if a compilation is active inthis thread (one compilation per thread possible)
+
   // support for JNI critical regions
   jint    _jni_active_critical;                  // count of entries into JNI critical region
 
@@ -982,13 +977,7 @@
   struct JNINativeInterface_* get_jni_functions() {
     return (struct JNINativeInterface_ *)_jni_environment.functions;
   }
-  
-  bool is_compiling() const                      { return _is_compiling; }
-  void set_compiling(bool b)                     { _is_compiling = b; }
 
-  // Get/set the thread's compilation environment.
-  ciEnv*        env()                            { return _env; }
-  void          set_env(ciEnv* env)              { _env = env; }
 
   BufferBlob*   get_buffer_blob()                { return _buffer_blob; }
   void          set_buffer_blob(BufferBlob* b)   { _buffer_blob = b; };
@@ -1018,6 +1007,10 @@
   // Testers
   virtual bool is_Java_thread() const            { return true;  }
 
+  // compilation
+  void set_is_compiling(bool f)                  { _is_compiling = f; }
+  bool is_compiling() const                      { return _is_compiling; }
+
   // Thread chain operations
   JavaThread* next() const                       { return _next; }
   void set_next(JavaThread* p)                   { _next = p; }
@@ -1283,13 +1276,6 @@
 
 #ifdef GRAAL
   void set_graal_alternate_call_target(address a) { _graal_alternate_call_target = a; }
-
-  DebugScopedValue* debug_scope() const                { return _debug_scope; }
-  void set_debug_scope(DebugScopedValue* ds)           { _debug_scope = ds; }
-#endif
-#ifdef HIGH_LEVEL_INTERPRETER
-  bool high_level_interpreter_in_vm()            { return _high_level_interpreter_in_vm; }
-  void set_high_level_interpreter_in_vm(bool value) { _high_level_interpreter_in_vm = value; }
 #endif
 
   // Exception handling for compiled methods
@@ -1374,9 +1360,6 @@
 #ifdef GRAAL
   static ByteSize graal_alternate_call_target_offset() { return byte_offset_of(JavaThread, _graal_alternate_call_target); }
 #endif
-#ifdef HIGH_LEVEL_INTERPRETER
-  static ByteSize high_level_interpreter_in_vm_offset() { return byte_offset_of(JavaThread, _high_level_interpreter_in_vm); }
-#endif
   static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop       ); }
   static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc        ); }
   static ByteSize exception_handler_pc_offset()  { return byte_offset_of(JavaThread, _exception_handler_pc); }
@@ -1832,6 +1815,7 @@
  private:
   CompilerCounters* _counters;
 
+  ciEnv*        _env;
   CompileLog*   _log;
   CompileTask*  _task;
   CompileQueue* _queue;
@@ -1845,18 +1829,15 @@
 
   bool is_Compiler_thread() const                { return true; }
   // Hide this compiler thread from external view.
-  // (thomaswue) For Graal, the compiler thread should be visible.
-  bool is_hidden_from_external_view() const      {
-#ifdef GRAALVM
-    return !DebugGraal;
-#else
-    return true;
-#endif
-  }
+  bool is_hidden_from_external_view() const      { return true; }
 
   CompileQueue* queue()                          { return _queue; }
   CompilerCounters* counters()                   { return _counters; }
 
+  // Get/set the thread's compilation environment.
+  ciEnv*        env()                            { return _env; }
+  void          set_env(ciEnv* env)              { _env = env; }
+
   // Get/set the thread's logging information
   CompileLog*   log()                            { return _log; }
   void          init_log(CompileLog* log) {
--- a/src/share/vm/runtime/vframe.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/vframe.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -266,8 +266,8 @@
 
   // Get oopmap describing oops and int for current bci
   InterpreterOopMap oop_mask;
-  if (PrintDeoptimizationDetails) {
-    methodHandle m_h(method());
+  if (TraceDeoptimization && Verbose) {
+    methodHandle m_h(thread(), method());
     OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask);
   } else {
     method()->mask_for(bci(), &oop_mask);
@@ -333,7 +333,7 @@
 
   InterpreterOopMap oop_mask;
   // Get oopmap describing oops and int for current bci
-  if (PrintDeoptimizationDetails) {
+  if (TraceDeoptimization && Verbose) {
     methodHandle m_h(method());
     OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask);
   } else {
--- a/src/share/vm/runtime/vframeArray.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/vframeArray.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -63,7 +63,7 @@
   _method = vf->method();
   _bci    = vf->raw_bci();
   _reexecute = vf->should_reexecute();
-  
+
   int index;
 
   // Get the monitors off-stack
@@ -429,6 +429,11 @@
     RegisterMap map(thread);
     vframe* f = vframe::new_vframe(iframe(), &map, thread);
     f->print();
+
+    tty->print_cr("locals size     %d", locals()->size());
+    tty->print_cr("expression size %d", expressions()->size());
+
+    method()->print_value();
     tty->cr();
     // method()->print_codes();
   } else if (TraceDeoptimization) {
--- a/src/share/vm/runtime/vframe_hp.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/vframe_hp.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -70,12 +70,6 @@
     }
   }
 
-  if (PrintDeoptimizationDetails) {
-    tty->print_cr("bci=%d length=%d", this->bci(), length);
-    tty->print_cr(err_msg("method name = %s", this->method()->name()->as_C_string()));
-    tty->print_cr("relative pc=%d", this->fr().pc() - this->nm()->code_begin());
-  }
-
   for( int i = 0; i < length; i++ ) {
     result->add( create_stack_value(scv_list->at(i)) );
   }
--- a/src/share/vm/runtime/vframe_hp.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/vframe_hp.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -66,7 +66,7 @@
   // Returns SynchronizationEntryBCI or bci() (used for synchronization)
   int raw_bci() const;
 
- //protected:
+ protected:
   ScopeDesc* _scope;
 
 
--- a/src/share/vm/runtime/vmStructs.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/runtime/vmStructs.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -209,7 +209,7 @@
 // type name, indicating an "opaque" type to the serviceability agent.
 
 // NOTE: there is an interdependency between this file and
-// HotSpotJavaTypeDataBase.java, which parses the type strings.
+// HotSpotTypeDataBase.java, which parses the type strings.
 
 #ifndef REG_COUNT
   #define REG_COUNT 0
@@ -2384,32 +2384,26 @@
   declare_constant(Location::on_stack)                                    \
   declare_constant(Location::in_register)                                 \
                                                                           \
-  /* TODO (chaeubl) those constants should be graal/c1/c2 specific */         \
-  /*declare_constant(Deoptimization::Reason_many)*/                           \
-  /*declare_constant(Deoptimization::Reason_none)*/                           \
-  /*declare_constant(Deoptimization::Reason_null_check)*/                     \
-  /*declare_constant(Deoptimization::Reason_range_check)*/                    \
-  /*declare_constant(Deoptimization::Reason_class_check)*/                    \
-  /*declare_constant(Deoptimization::Reason_array_check)*/                    \
-  /*declare_constant(Deoptimization::Reason_unreached)*/                      \
-  /*declare_constant(Deoptimization::Reason_constraint)*/                     \
-  /*declare_constant(Deoptimization::Reason_div0_check)*/                     \
-  /*declare_constant(Deoptimization::Reason_type_checked_inlining)*/          \
-  /*declare_constant(Deoptimization::Reason_optimized_type_check)*/           \
-  /*declare_constant(Deoptimization::Reason_not_compiled_exception_handler)*/ \
-  /*declare_constant(Deoptimization::Reason_unresolved)*/                     \
-  /*declare_constant(Deoptimization::Reason_jsr_mismatch)*/                   \
-  /*declare_constant(Deoptimization::Reason_LIMIT)*/                          \
-  /*declare_constant(Deoptimization::Reason_RECORDED_LIMIT)*/                 \
-  /*declare_constant(Deoptimization::Reason_null_assert)*/                    \
-  /*declare_constant(Deoptimization::Reason_intrinsic)*/                      \
-  /*declare_constant(Deoptimization::Reason_bimorphic)*/                      \
-  /*declare_constant(Deoptimization::Reason_unloaded)*/                       \
-  /*declare_constant(Deoptimization::Reason_uninitialized) */                 \
-  /*declare_constant(Deoptimization::Reason_unhandled)*/                      \
-  /*declare_constant(Deoptimization::Reason_age)*/                            \
-  /*declare_constant(Deoptimization::Reason_predicate)*/                      \
-  /*declare_constant(Deoptimization::Reason_loop_limit_check)*/               \
+  declare_constant(Deoptimization::Reason_many)                           \
+  declare_constant(Deoptimization::Reason_none)                           \
+  declare_constant(Deoptimization::Reason_null_check)                     \
+  declare_constant(Deoptimization::Reason_null_assert)                    \
+  declare_constant(Deoptimization::Reason_range_check)                    \
+  declare_constant(Deoptimization::Reason_class_check)                    \
+  declare_constant(Deoptimization::Reason_array_check)                    \
+  declare_constant(Deoptimization::Reason_intrinsic)                      \
+  declare_constant(Deoptimization::Reason_bimorphic)                      \
+  declare_constant(Deoptimization::Reason_unloaded)                       \
+  declare_constant(Deoptimization::Reason_uninitialized)                  \
+  declare_constant(Deoptimization::Reason_unreached)                      \
+  declare_constant(Deoptimization::Reason_unhandled)                      \
+  declare_constant(Deoptimization::Reason_constraint)                     \
+  declare_constant(Deoptimization::Reason_div0_check)                     \
+  declare_constant(Deoptimization::Reason_age)                            \
+  declare_constant(Deoptimization::Reason_predicate)                      \
+  declare_constant(Deoptimization::Reason_loop_limit_check)               \
+  declare_constant(Deoptimization::Reason_LIMIT)                          \
+  declare_constant(Deoptimization::Reason_RECORDED_LIMIT)                 \
                                                                           \
   /*********************/                                                 \
   /* Matcher (C2 only) */                                                 \
--- a/src/share/vm/utilities/debug.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/utilities/debug.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -830,37 +830,3 @@
 #endif
 
 #endif // !PRODUCT
-
-#ifdef GRAAL
-
-DebugScopedValue::DebugScopedValue(const char* file, int line) {
-  _file = file;
-  _line = line;
-  Thread* thread = Thread::current();
-  if (thread != NULL && thread->is_Java_thread()) {
-    JavaThread* javaThread = (JavaThread*) thread;
-    _parent = javaThread->debug_scope();
-    javaThread->set_debug_scope(this);
-  } else {
-    _parent = NULL;
-  }
-}
-
-DebugScopedValue::~DebugScopedValue() {
-  Thread* thread = Thread::current();
-  if (thread != NULL && thread->is_Java_thread()) {
-    JavaThread* javaThread = (JavaThread*) thread;
-    javaThread->set_debug_scope(_parent);
-    _parent = NULL;
-  }
-}
-
-void DebugScopedValue::print(outputStream* st) {
-  st->print("%s:%d: ", _file, _line);
-  print_on(st);
-}
-
-void DebugScopedScalar::print_on(outputStream* st) {
-  st->print("int: %d, char: %c, long: %ld, hex: %p", _value, _value, _value, _value);
-}
-#endif
--- a/src/share/vm/utilities/debug.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/utilities/debug.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -30,35 +30,6 @@
 
 #include <stdarg.h>
 
-#ifdef GRAAL
-// Scopes a value that may be of interest in a crash log.
-class DebugScopedValue {
-protected:
-  DebugScopedValue *_parent;
-  const char* _file;
-  int _line;
-public:
-  DebugScopedValue(const char* file, int line);
-  ~DebugScopedValue();
-  void print(outputStream* st);
-  virtual void print_on(outputStream* st) = 0;
-  DebugScopedValue* parent() { return _parent; }
-};
-
-class DebugScopedScalar : DebugScopedValue {
-private:
-  void* _value;
-public:
-  DebugScopedScalar(const char* file, int line, void* v) : DebugScopedValue(file, line), _value(v) {}
-  void print_on(outputStream* st);
-};
-#define DS_SCALAR(val) DebugScopedScalar __dss__(__FILE__, __LINE__, (void*) val)
-#define DS_SCALAR1(name, val) DebugScopedScalar name(__FILE__, __LINE__, (void*) val)
-#else
-#define DS_SCALAR(name) do {} while (0)
-#define DS_SCALAR1(name, val) do {} while (0)
-#endif
-
 // Simple class to format the ctor arguments into a fixed-sized buffer.
 class FormatBufferBase {
  protected:
--- a/src/share/vm/utilities/machineCodePrinter.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "precompiled.hpp"
-#include "code/stubs.hpp"
-#include "compiler/disassembler.hpp"
-#include "runtime/thread.hpp"
-#include "utilities/machineCodePrinter.hpp"
-#include "utilities/ostream.hpp"
-
-fileStream* MachineCodePrinter::_st = NULL;
-volatile int MachineCodePrinter::_write_lock = 0;
-
-void MachineCodePrinter::initialize() {
-  _st = new (ResourceObj::C_HEAP, mtInternal) fileStream("machineCode.txt");
-}
-
-void MachineCodePrinter::print(nmethod* nm) {
-  lock();
-  Disassembler::decode(nm, _st);
-  unlock();
-}
-
-void MachineCodePrinter::print(CodeBlob* cb) {
-  lock();
-  Disassembler::decode(cb, _st);
-  unlock();
-}
-
-void MachineCodePrinter::print(StubQueue* stub_queue) {
-  lock();
-  stub_queue->print_on(_st);
-  unlock();
-}
-
-void MachineCodePrinter::flush() {
-  _st->flush();
-}
-
-void MachineCodePrinter::lock() {
-  Thread::SpinAcquire(&_write_lock, "Put");
-}
-
-void MachineCodePrinter::unlock() {
-  Thread::SpinRelease(&_write_lock);
-}
--- a/src/share/vm/utilities/machineCodePrinter.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef SHARE_VM_UTILITIES_MACHINE_CODE_PRINTER_HPP
-#define SHARE_VM_UTILITIES_MACHINE_CODE_PRINTER_HPP
-
-#include "memory/allocation.hpp"
-#include "utilities/ostream.hpp"
-
-class MachineCodePrinter : public AllStatic {
-private:
-  static fileStream* _st;
-  static volatile int _write_lock;
-
-public:
-  static void initialize();
-  static void print(nmethod* nm);
-  static void print(CodeBlob* cb);
-  static void print(StubQueue* stub_queue);
-  static void flush();
-
-private:
-  static void lock();
-  static void unlock();
-};
-
-#endif // SHARE_VM_UTILITIES_MACHINE_CODE_PRINTER_HPP
--- a/src/share/vm/utilities/macros.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/utilities/macros.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -201,14 +201,6 @@
 #define NOT_GRAALVM(code) code
 #endif // GRAAL
 
-#ifdef HIGH_LEVEL_INTERPRETER
-#define HIGH_LEVEL_INTERPRETER_ONLY(code) code
-#define NOT_HIGH_LEVEL_INTERPRETER(code)
-#else
-#define HIGH_LEVEL_INTERPRETER_ONLY(code)
-#define NOT_HIGH_LEVEL_INTERPRETER(code) code
-#endif // HIGH_LEVEL_INTERPRETER
-
 #ifdef TIERED
 #define TIERED_ONLY(code) code
 #define NOT_TIERED(code)
--- a/src/share/vm/utilities/ostream.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/utilities/ostream.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -102,7 +102,6 @@
     result_len = strlen(result);
   } else {
     DEBUG_ONLY(warning("increase O_BUFLEN in ostream.hpp -- output truncated");)
-
     result = buffer;
     result_len = buflen - 1;
     buffer[result_len] = 0;
@@ -658,9 +657,7 @@
       // Print it as a java-style property list.
       // System properties don't generally contain newlines, so don't bother with unparsing.
       for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
-        xs->text()->print(p->key() ? p->key() : "");
-        xs->text()->print("=");
-        xs->text()->print_cr(p->value() ? p->value() : "");
+        xs->text()->print_cr("%s=%s", p->key(), p->value());
       }
       xs->tail("properties");
     }
--- a/src/share/vm/utilities/top.hpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/utilities/top.hpp	Fri Mar 08 15:58:08 2013 +0100
@@ -39,12 +39,12 @@
 #ifdef COMPILER1
 #include "c1/c1_globals.hpp"
 #endif
+#ifdef COMPILER2
+#include "opto/c2_globals.hpp"
+#endif
 #ifdef GRAAL
 #include "graal/graalGlobals.hpp"
 #endif
-#ifdef COMPILER2
-#include "opto/c2_globals.hpp"
-#endif
 
 // THIS FILE IS INTESIONALLY LEFT EMPTY
 // IT IS USED TO MINIMIZE THE NUMBER OF DEPENDENCIES IN includeDB
--- a/src/share/vm/utilities/vmError.cpp	Fri Mar 08 15:57:41 2013 +0100
+++ b/src/share/vm/utilities/vmError.cpp	Fri Mar 08 15:58:08 2013 +0100
@@ -491,30 +491,6 @@
        print_bug_submit_message(st, _thread);
      }
 
-#ifdef GRAAL
-  STEP(67, "(printing debug scope)" )
-
-     if (_verbose) {
-       if (_thread != NULL && _thread->is_Java_thread()) {
-         JavaThread* javaThread = (JavaThread*) _thread;
-         DebugScopedValue* ds = javaThread->debug_scope();
-         int level = 0;
-         while (ds != NULL) {
-           if (level == 0) {
-             st->cr();
-             st->print_cr("---------------  D E B U G  S C O P E ---------------");
-             st->cr();
-           }
-           st->print("%d: ", level);
-           ds->print(st);
-           st->cr();
-           ds = ds->parent();
-           level++;
-         }
-       }
-     }
-#endif
-
   STEP(70, "(printing thread)" )
 
      if (_verbose) {