changeset 18186:ef357effbda7

Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 30 Oct 2014 11:18:48 +0100
parents a88d819ba6a1
children 9619ba4daf4c
files graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractConstant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractValue.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AllocatableValue.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NullConstant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/PrimitiveConstant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/VMConstant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/ComplexMatchValue.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledRuntimeStub.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCompressedNullConstant.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstant.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMonitorValue.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstant.java graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest1.java graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest2.java graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest3.java graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest4.java graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest1.java graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest2.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValue.java src/share/vm/classfile/systemDictionary.hpp src/share/vm/classfile/vmSymbols.hpp src/share/vm/graal/graalCodeInstaller.cpp src/share/vm/graal/graalJavaAccess.hpp
diffstat 29 files changed, 230 insertions(+), 233 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Thu Oct 30 11:18:48 2014 +0100
@@ -31,7 +31,7 @@
  * The information stored in the {@link VirtualObject} is used during deoptimization to recreate the
  * object.
  */
-public final class VirtualObject extends AbstractValue {
+public final class VirtualObject extends Value {
 
     private static final long serialVersionUID = -2907197776426346021L;
 
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractConstant.java	Wed Oct 29 15:23:46 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, 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.meta;
-
-public abstract class AbstractConstant extends AbstractValue implements Constant {
-
-    private static final long serialVersionUID = -6355452536852663986L;
-
-    protected AbstractConstant(LIRKind kind) {
-        super(kind);
-    }
-
-    @Override
-    public String toString() {
-        if (getKind() == Kind.Illegal) {
-            return "illegal";
-        } else {
-            return getKind().getJavaName() + "[" + toValueString() + "]";
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractValue.java	Wed Oct 29 15:23:46 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, 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.meta;
-
-import java.io.*;
-
-/**
- * Abstract base class for values manipulated by the compiler. All values have a {@linkplain Kind
- * kind} and are immutable.
- */
-public abstract class AbstractValue implements Serializable, Value {
-
-    private static final long serialVersionUID = -6909397188697766469L;
-
-    @SuppressWarnings("serial") public static final AllocatableValue ILLEGAL = new AllocatableValue(LIRKind.Illegal) {
-
-        @Override
-        public String toString() {
-            return "-";
-        }
-    };
-
-    private final Kind kind;
-    private final LIRKind lirKind;
-
-    /**
-     * Initializes a new value of the specified kind.
-     *
-     * @param lirKind the kind
-     */
-    protected AbstractValue(LIRKind lirKind) {
-        this.lirKind = lirKind;
-        if (getPlatformKind() instanceof Kind) {
-            this.kind = (Kind) getPlatformKind();
-        } else {
-            this.kind = Kind.Illegal;
-        }
-    }
-
-    /**
-     * Returns the kind of this value.
-     */
-    public final Kind getKind() {
-        return kind;
-    }
-
-    public final LIRKind getLIRKind() {
-        return lirKind;
-    }
-
-    /**
-     * Returns the platform specific kind used to store this value.
-     */
-    public final PlatformKind getPlatformKind() {
-        return lirKind.getPlatformKind();
-    }
-
-    @Override
-    public int hashCode() {
-        return 41 + lirKind.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof AbstractValue) {
-            AbstractValue that = (AbstractValue) obj;
-            return kind.equals(that.kind) && lirKind.equals(that.lirKind);
-        }
-        return false;
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AllocatableValue.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AllocatableValue.java	Thu Oct 30 11:18:48 2014 +0100
@@ -26,7 +26,7 @@
  * Common base class for values that are stored in some location that's managed by the register
  * allocator (e.g. register, stack slot).
  */
-public abstract class AllocatableValue extends AbstractValue {
+public abstract class AllocatableValue extends Value {
 
     private static final long serialVersionUID = 153019506717492133L;
 
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java	Thu Oct 30 11:18:48 2014 +0100
@@ -28,39 +28,45 @@
  * {@code Constant} instances that represent frequently used constant values, such as
  * {@link #NULL_OBJECT}.
  */
-public interface Constant extends Value {
+public abstract class Constant extends Value {
+
+    private static final long serialVersionUID = -6355452536852663986L;
 
     /*
      * Using a larger cache for integers leads to only a slight increase in cache hit ratio which is
      * not enough to justify the impact on startup time.
      */
-    Constant NULL_OBJECT = new NullConstant();
-    Constant INT_MINUS_1 = new PrimitiveConstant(Kind.Int, -1);
-    Constant INT_0 = new PrimitiveConstant(Kind.Int, 0);
-    Constant INT_1 = new PrimitiveConstant(Kind.Int, 1);
-    Constant INT_2 = new PrimitiveConstant(Kind.Int, 2);
-    Constant LONG_0 = new PrimitiveConstant(Kind.Long, 0L);
-    Constant LONG_1 = new PrimitiveConstant(Kind.Long, 1L);
-    Constant FLOAT_0 = new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(0.0F));
-    Constant FLOAT_1 = new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(1.0F));
-    Constant DOUBLE_0 = new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(0.0D));
-    Constant DOUBLE_1 = new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(1.0D));
-    Constant TRUE = new PrimitiveConstant(Kind.Boolean, 1L);
-    Constant FALSE = new PrimitiveConstant(Kind.Boolean, 0L);
+    public static final Constant NULL_OBJECT = new NullConstant();
+    public static final Constant INT_MINUS_1 = new PrimitiveConstant(Kind.Int, -1);
+    public static final Constant INT_0 = new PrimitiveConstant(Kind.Int, 0);
+    public static final Constant INT_1 = new PrimitiveConstant(Kind.Int, 1);
+    public static final Constant INT_2 = new PrimitiveConstant(Kind.Int, 2);
+    public static final Constant LONG_0 = new PrimitiveConstant(Kind.Long, 0L);
+    public static final Constant LONG_1 = new PrimitiveConstant(Kind.Long, 1L);
+    public static final Constant FLOAT_0 = new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(0.0F));
+    public static final Constant FLOAT_1 = new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(1.0F));
+    public static final Constant DOUBLE_0 = new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(0.0D));
+    public static final Constant DOUBLE_1 = new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(1.0D));
+    public static final Constant TRUE = new PrimitiveConstant(Kind.Boolean, 1L);
+    public static final Constant FALSE = new PrimitiveConstant(Kind.Boolean, 0L);
+
+    protected Constant(LIRKind kind) {
+        super(kind);
+    }
 
     /**
      * Checks whether this constant is null.
      *
      * @return {@code true} if this constant is the null constant
      */
-    boolean isNull();
+    public abstract boolean isNull();
 
     /**
      * Checks whether this constant is non-null.
      *
      * @return {@code true} if this constant is a primitive, or an object constant that is not null
      */
-    default boolean isNonNull() {
+    public final boolean isNonNull() {
         return !isNull();
     }
 
@@ -69,16 +75,14 @@
      *
      * @return {@code true} if this constant is the default value for its kind
      */
-    boolean isDefaultForKind();
+    public abstract boolean isDefaultForKind();
 
     /**
      * Returns the value of this constant as a boxed Java value.
      *
      * @return the value of this constant
      */
-    default Object asBoxedPrimitive() {
-        throw new IllegalArgumentException();
-    }
+    public abstract Object asBoxedPrimitive();
 
     /**
      * Returns the primitive int value this constant represents. The constant must have a
@@ -86,9 +90,7 @@
      *
      * @return the constant value
      */
-    default int asInt() {
-        throw new IllegalArgumentException();
-    }
+    public abstract int asInt();
 
     /**
      * Returns the primitive boolean value this constant represents. The constant must have kind
@@ -96,9 +98,7 @@
      *
      * @return the constant value
      */
-    default boolean asBoolean() {
-        throw new IllegalArgumentException();
-    }
+    public abstract boolean asBoolean();
 
     /**
      * Returns the primitive long value this constant represents. The constant must have kind
@@ -106,9 +106,7 @@
      *
      * @return the constant value
      */
-    default long asLong() {
-        throw new IllegalArgumentException();
-    }
+    public abstract long asLong();
 
     /**
      * Returns the primitive float value this constant represents. The constant must have kind
@@ -116,9 +114,7 @@
      *
      * @return the constant value
      */
-    default float asFloat() {
-        throw new IllegalArgumentException();
-    }
+    public abstract float asFloat();
 
     /**
      * Returns the primitive double value this constant represents. The constant must have kind
@@ -126,11 +122,9 @@
      *
      * @return the constant value
      */
-    default double asDouble() {
-        throw new IllegalArgumentException();
-    }
+    public abstract double asDouble();
 
-    default String toValueString() {
+    public String toValueString() {
         if (getKind() == Kind.Illegal) {
             return "illegal";
         } else {
@@ -138,13 +132,22 @@
         }
     }
 
+    @Override
+    public String toString() {
+        if (getKind() == Kind.Illegal) {
+            return "illegal";
+        } else {
+            return getKind().getJavaName() + "[" + toValueString() + "]";
+        }
+    }
+
     /**
      * Creates a boxed double constant.
      *
      * @param d the double value to box
      * @return a boxed copy of {@code value}
      */
-    static Constant forDouble(double d) {
+    public static Constant forDouble(double d) {
         if (Double.compare(0.0D, d) == 0) {
             return DOUBLE_0;
         }
@@ -160,7 +163,7 @@
      * @param f the float value to box
      * @return a boxed copy of {@code value}
      */
-    static Constant forFloat(float f) {
+    public static Constant forFloat(float f) {
         if (Float.compare(f, 0.0F) == 0) {
             return FLOAT_0;
         }
@@ -176,7 +179,7 @@
      * @param i the long value to box
      * @return a boxed copy of {@code value}
      */
-    static Constant forLong(long i) {
+    public static Constant forLong(long i) {
         if (i == 0) {
             return LONG_0;
         } else if (i == 1) {
@@ -192,7 +195,7 @@
      * @param i the integer value to box
      * @return a boxed copy of {@code value}
      */
-    static Constant forInt(int i) {
+    public static Constant forInt(int i) {
         switch (i) {
             case -1:
                 return INT_MINUS_1;
@@ -213,7 +216,7 @@
      * @param i the byte value to box
      * @return a boxed copy of {@code value}
      */
-    static Constant forByte(byte i) {
+    public static Constant forByte(byte i) {
         return new PrimitiveConstant(Kind.Byte, i);
     }
 
@@ -223,7 +226,7 @@
      * @param i the boolean value to box
      * @return a boxed copy of {@code value}
      */
-    static Constant forBoolean(boolean i) {
+    public static Constant forBoolean(boolean i) {
         return i ? TRUE : FALSE;
     }
 
@@ -233,7 +236,7 @@
      * @param i the char value to box
      * @return a boxed copy of {@code value}
      */
-    static Constant forChar(char i) {
+    public static Constant forChar(char i) {
         return new PrimitiveConstant(Kind.Char, i);
     }
 
@@ -243,14 +246,14 @@
      * @param i the short value to box
      * @return a boxed copy of {@code value}
      */
-    static Constant forShort(short i) {
+    public static Constant forShort(short i) {
         return new PrimitiveConstant(Kind.Short, i);
     }
 
     /**
      * Creates a {@link Constant} from a primitive integer of a certain kind.
      */
-    static Constant forIntegerKind(Kind kind, long i) {
+    public static Constant forIntegerKind(Kind kind, long i) {
         switch (kind) {
             case Byte:
                 return new PrimitiveConstant(kind, (byte) i);
@@ -270,7 +273,7 @@
     /**
      * Creates a {@link Constant} from a primitive integer of a certain width.
      */
-    static Constant forPrimitiveInt(int bits, long i) {
+    public static Constant forPrimitiveInt(int bits, long i) {
         assert bits <= 64;
         switch (bits) {
             case 1:
@@ -294,7 +297,7 @@
      * @param value the Java boxed value
      * @return the primitive constant holding the {@code value}
      */
-    static Constant forBoxedPrimitive(Object value) {
+    public static Constant forBoxedPrimitive(Object value) {
         if (value instanceof Boolean) {
             return forBoolean((Boolean) value);
         } else if (value instanceof Byte) {
@@ -316,14 +319,14 @@
         }
     }
 
-    static Constant forIllegal() {
+    public static Constant forIllegal() {
         return new PrimitiveConstant(Kind.Illegal, 0);
     }
 
     /**
      * Returns a constant with the default value for the given kind.
      */
-    static Constant defaultForKind(Kind kind) {
+    public static Constant defaultForKind(Kind kind) {
         switch (kind) {
             case Boolean:
                 return FALSE;
@@ -351,7 +354,7 @@
     /**
      * Returns the zero value for a given numeric kind.
      */
-    static Constant zero(Kind kind) {
+    public static Constant zero(Kind kind) {
         switch (kind) {
             case Boolean:
                 return FALSE;
@@ -377,7 +380,7 @@
     /**
      * Returns the one value for a given numeric kind.
      */
-    static Constant one(Kind kind) {
+    public static Constant one(Kind kind) {
         switch (kind) {
             case Boolean:
                 return TRUE;
@@ -403,7 +406,7 @@
     /**
      * Adds two numeric constants.
      */
-    static Constant add(Constant x, Constant y) {
+    public static Constant add(Constant x, Constant y) {
         assert x.getKind() == y.getKind();
         switch (x.getKind()) {
             case Byte:
@@ -428,7 +431,7 @@
     /**
      * Multiplies two numeric constants.
      */
-    static Constant mul(Constant x, Constant y) {
+    public static Constant mul(Constant x, Constant y) {
         assert x.getKind() == y.getKind();
         switch (x.getKind()) {
             case Byte:
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NullConstant.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NullConstant.java	Thu Oct 30 11:18:48 2014 +0100
@@ -25,7 +25,7 @@
 /**
  * The implementation type of the {@link Constant#NULL_OBJECT null constant}.
  */
-final class NullConstant extends AbstractConstant {
+final class NullConstant extends Constant {
 
     private static final long serialVersionUID = 8906209595800783961L;
 
@@ -44,6 +44,36 @@
     }
 
     @Override
+    public Object asBoxedPrimitive() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public int asInt() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public boolean asBoolean() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public long asLong() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public float asFloat() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public double asDouble() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
     public String toValueString() {
         return "null";
     }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/PrimitiveConstant.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/PrimitiveConstant.java	Thu Oct 30 11:18:48 2014 +0100
@@ -26,7 +26,7 @@
  * Represents a primitive constant value, such as an integer or floating point number, within the
  * compiler and across the compiler/runtime interface.
  */
-public class PrimitiveConstant extends AbstractConstant {
+public class PrimitiveConstant extends Constant {
 
     private static final long serialVersionUID = 8787949721295655376L;
 
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/VMConstant.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/VMConstant.java	Thu Oct 30 11:18:48 2014 +0100
@@ -22,5 +22,5 @@
  */
 package com.oracle.graal.api.meta;
 
-public interface VMConstant extends Constant {
+public interface VMConstant {
 }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java	Thu Oct 30 11:18:48 2014 +0100
@@ -22,13 +22,17 @@
  */
 package com.oracle.graal.api.meta;
 
+import java.io.*;
+
 /**
  * Abstract base class for values manipulated by the compiler. All values have a {@linkplain Kind
  * kind} and are immutable.
  */
-public interface Value extends KindProvider {
+public abstract class Value implements Serializable, KindProvider {
 
-    @SuppressWarnings("serial") AllocatableValue ILLEGAL = new AllocatableValue(LIRKind.Illegal) {
+    private static final long serialVersionUID = -6909397188697766469L;
+
+    @SuppressWarnings("serial") public static final AllocatableValue ILLEGAL = new AllocatableValue(LIRKind.Illegal) {
 
         @Override
         public String toString() {
@@ -36,25 +40,62 @@
         }
     };
 
+    private final Kind kind;
+    private final LIRKind lirKind;
+
+    /**
+     * Initializes a new value of the specified kind.
+     *
+     * @param lirKind the kind
+     */
+    protected Value(LIRKind lirKind) {
+        this.lirKind = lirKind;
+        if (getPlatformKind() instanceof Kind) {
+            this.kind = (Kind) getPlatformKind();
+        } else {
+            this.kind = Kind.Illegal;
+        }
+    }
+
     /**
      * Returns a String representation of the kind, which should be the end of all
      * {@link #toString()} implementation of subclasses.
      */
-    default String getKindSuffix() {
+    protected final String getKindSuffix() {
         return "|" + getKind().getTypeChar();
     }
 
     /**
      * Returns the kind of this value.
      */
-    Kind getKind();
+    public final Kind getKind() {
+        return kind;
+    }
 
-    LIRKind getLIRKind();
+    public final LIRKind getLIRKind() {
+        return lirKind;
+    }
 
     /**
      * Returns the platform specific kind used to store this value.
      */
-    PlatformKind getPlatformKind();
+    public final PlatformKind getPlatformKind() {
+        return lirKind.getPlatformKind();
+    }
+
+    @Override
+    public int hashCode() {
+        return 41 + lirKind.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof Value) {
+            Value that = (Value) obj;
+            return kind.equals(that.kind) && lirKind.equals(that.lirKind);
+        }
+        return false;
+    }
 
     /**
      * Checks if this value is identical to {@code other}.
@@ -63,7 +104,7 @@
      * should be used.
      */
     @ExcludeFromIdentityComparisonVerification
-    default boolean identityEquals(Value other) {
+    public final boolean identityEquals(Value other) {
         return this == other;
     }
 }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Thu Oct 30 11:18:48 2014 +0100
@@ -318,7 +318,8 @@
             for (DataPatch dp : ldp) {
                 Kind kind = Kind.Illegal;
                 if (dp.reference instanceof ConstantReference) {
-                    kind = ((ConstantReference) dp.reference).getConstant().getKind();
+                    VMConstant constant = ((ConstantReference) dp.reference).getConstant();
+                    kind = ((Constant) constant).getKind();
                 }
                 dms[kind.ordinal()].add(1);
             }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/ComplexMatchValue.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/ComplexMatchValue.java	Thu Oct 30 11:18:48 2014 +0100
@@ -30,14 +30,14 @@
  * closure because Value is serializable which is a hassle for the little inner classes which
  * usually occur here.
  */
-public class ComplexMatchValue extends AbstractValue {
+public class ComplexMatchValue extends Value {
     private static final long serialVersionUID = -4734670273590368770L;
 
     /**
      * This is the Value of a node which was matched as part of a complex match. The value isn't
      * actually useable but this marks it as having been evaluated.
      */
-    @SuppressWarnings("serial") public static final Value INTERIOR_MATCH = new AbstractValue(LIRKind.Illegal) {
+    @SuppressWarnings("serial") public static final Value INTERIOR_MATCH = new Value(LIRKind.Illegal) {
 
         @Override
         public String toString() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledRuntimeStub.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledRuntimeStub.java	Thu Oct 30 11:18:48 2014 +0100
@@ -29,6 +29,7 @@
 import com.oracle.graal.api.code.CompilationResult.ConstantReference;
 import com.oracle.graal.api.code.CompilationResult.DataPatch;
 import com.oracle.graal.api.code.CompilationResult.Infopoint;
+import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.stubs.*;
 
@@ -56,7 +57,7 @@
             if (data.reference instanceof ConstantReference) {
                 ConstantReference ref = (ConstantReference) data.reference;
                 if (ref.getConstant() instanceof HotSpotMetaspaceConstant) {
-                    Object object = HotSpotMetaspaceConstant.getMetaspaceObject(ref.getConstant());
+                    Object object = HotSpotMetaspaceConstant.getMetaspaceObject((Constant) ref.getConstant());
                     if (object instanceof HotSpotResolvedObjectType && ((HotSpotResolvedObjectType) object).getName().equals("[I")) {
                         // special handling for NewArrayStub
                         // embedding the type '[I' is safe, since it is never unloaded
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java	Thu Oct 30 11:18:48 2014 +0100
@@ -263,12 +263,12 @@
             VMConstant vmConstant = (VMConstant) constant;
             boolean compressed;
             long raw;
-            if (vmConstant instanceof HotSpotObjectConstant) {
+            if (constant instanceof HotSpotObjectConstant) {
                 compressed = HotSpotObjectConstant.isCompressed(constant);
                 raw = 0xDEADDEADDEADDEADL;
-            } else if (vmConstant instanceof HotSpotMetaspaceConstant) {
-                compressed = vmConstant.getKind() != target.wordKind;
-                raw = vmConstant.asLong();
+            } else if (constant instanceof HotSpotMetaspaceConstant) {
+                compressed = constant.getKind() != target.wordKind;
+                raw = constant.asLong();
             } else {
                 throw GraalInternalError.shouldNotReachHere();
             }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCompressedNullConstant.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCompressedNullConstant.java	Thu Oct 30 11:18:48 2014 +0100
@@ -27,7 +27,7 @@
 /**
  * The compressed representation of the {@link Constant#NULL_OBJECT null constant}.
  */
-public final class HotSpotCompressedNullConstant extends AbstractConstant implements HotSpotConstant {
+public final class HotSpotCompressedNullConstant extends Constant implements HotSpotConstant {
 
     private static final long serialVersionUID = 8906209595800783961L;
 
@@ -48,6 +48,36 @@
     }
 
     @Override
+    public Object asBoxedPrimitive() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public int asInt() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public boolean asBoolean() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public long asLong() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public float asFloat() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public double asDouble() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
     public String toValueString() {
         return "null";
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstant.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstant.java	Thu Oct 30 11:18:48 2014 +0100
@@ -22,10 +22,8 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.meta.*;
-
 /**
  * Marker interface for hotspot specific constants.
  */
-public interface HotSpotConstant extends Constant {
+public interface HotSpotConstant {
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMonitorValue.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMonitorValue.java	Thu Oct 30 11:18:48 2014 +0100
@@ -28,7 +28,7 @@
 /**
  * Represents lock information in the debug information.
  */
-public final class HotSpotMonitorValue extends AbstractValue {
+public final class HotSpotMonitorValue extends Value {
 
     private static final long serialVersionUID = 8241681800464483691L;
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstant.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstant.java	Thu Oct 30 11:18:48 2014 +0100
@@ -28,7 +28,7 @@
  * Represents a constant non-{@code null} object reference, within the compiler and across the
  * compiler/runtime interface.
  */
-public final class HotSpotObjectConstant extends AbstractConstant implements HotSpotConstant, VMConstant {
+public final class HotSpotObjectConstant extends Constant implements HotSpotConstant, VMConstant {
 
     private static final long serialVersionUID = 3592151693708093496L;
 
@@ -105,6 +105,36 @@
     }
 
     @Override
+    public Object asBoxedPrimitive() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public int asInt() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public boolean asBoolean() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public long asLong() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public float asFloat() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public double asDouble() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
     public int hashCode() {
         return System.identityHashCode(object);
     }
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java	Thu Oct 30 11:18:48 2014 +0100
@@ -847,8 +847,7 @@
                         delaySlotLir.emitControlTransfer(crb, masm);
                         new Clr(asRegister(result)).emit(masm);
                     } else if (crb.target.inlineObjects) {
-                        VMConstant vmConstant = (VMConstant) input;
-                        crb.recordInlineDataInCode(vmConstant); // relocatable cannot be delayed
+                        crb.recordInlineDataInCode(input); // relocatable cannot be delayed
                         new Setx(0xDEADDEADDEADDEADL, asRegister(result), true).emit(masm);
                     } else {
                         throw GraalInternalError.unimplemented();
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest1.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest1.java	Thu Oct 30 11:18:48 2014 +0100
@@ -50,7 +50,7 @@
 
     }
 
-    private static class DummyValue extends AbstractValue {
+    private static class DummyValue extends Value {
 
         private static final long serialVersionUID = -645435039553382737L;
         private final int id;
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest2.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest2.java	Thu Oct 30 11:18:48 2014 +0100
@@ -51,7 +51,7 @@
 
     }
 
-    private static class DummyValue extends AbstractValue {
+    private static class DummyValue extends Value {
 
         private static final long serialVersionUID = -645435039553382737L;
         private final int id;
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest3.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest3.java	Thu Oct 30 11:18:48 2014 +0100
@@ -51,7 +51,7 @@
 
     }
 
-    private static class DummyValue extends AbstractValue {
+    private static class DummyValue extends Value {
 
         private static final long serialVersionUID = -645435039553382737L;
         private final int id;
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest4.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest4.java	Thu Oct 30 11:18:48 2014 +0100
@@ -51,7 +51,7 @@
 
     }
 
-    private static class DummyValue extends AbstractValue {
+    private static class DummyValue extends Value {
 
         private static final long serialVersionUID = -645435039553382737L;
         private final int id;
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest1.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest1.java	Thu Oct 30 11:18:48 2014 +0100
@@ -48,7 +48,7 @@
 
     }
 
-    private static class DummyValue extends AbstractValue {
+    private static class DummyValue extends Value {
 
         private static final long serialVersionUID = -645435039553382737L;
         private final int id;
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest2.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest2.java	Thu Oct 30 11:18:48 2014 +0100
@@ -50,7 +50,7 @@
 
     }
 
-    private static class DummyValue extends AbstractValue {
+    private static class DummyValue extends Value {
 
         private static final long serialVersionUID = 3620305384660607012L;
         private final int id;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValue.java	Wed Oct 29 15:23:46 2014 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValue.java	Thu Oct 30 11:18:48 2014 +0100
@@ -33,7 +33,7 @@
 /**
  * Base class to represent values that need to be stored in more than one register.
  */
-public abstract class CompositeValue extends AbstractValue implements Cloneable {
+public abstract class CompositeValue extends Value implements Cloneable {
 
     private static final long serialVersionUID = -169180052684126180L;
 
--- a/src/share/vm/classfile/systemDictionary.hpp	Wed Oct 29 15:23:46 2014 +0100
+++ b/src/share/vm/classfile/systemDictionary.hpp	Thu Oct 30 11:18:48 2014 +0100
@@ -233,7 +233,7 @@
   GRAAL_ONLY(do_klass(StackSlot_klass,                       com_oracle_graal_api_code_StackSlot,                          Graal)) \
   GRAAL_ONLY(do_klass(VirtualObject_klass,                   com_oracle_graal_api_code_VirtualObject,                      Graal)) \
   GRAAL_ONLY(do_klass(SpeculationLog_klass,                  com_oracle_graal_api_code_SpeculationLog,                     Graal)) \
-  GRAAL_ONLY(do_klass(AbstractConstant_klass,                com_oracle_graal_api_meta_AbstractConstant,                   Graal)) \
+  GRAAL_ONLY(do_klass(Constant_klass,                        com_oracle_graal_api_meta_Constant,                           Graal)) \
   GRAAL_ONLY(do_klass(PrimitiveConstant_klass,               com_oracle_graal_api_meta_PrimitiveConstant,                  Graal)) \
   GRAAL_ONLY(do_klass(RawConstant_klass,                     com_oracle_graal_api_meta_RawConstant,                        Graal)) \
   GRAAL_ONLY(do_klass(NullConstant_klass,                    com_oracle_graal_api_meta_NullConstant,                       Graal)) \
@@ -242,7 +242,6 @@
   GRAAL_ONLY(do_klass(LIRKind_klass,                         com_oracle_graal_api_meta_LIRKind,                            Graal)) \
   GRAAL_ONLY(do_klass(JavaMethod_klass,                      com_oracle_graal_api_meta_JavaMethod,                         Graal)) \
   GRAAL_ONLY(do_klass(JavaType_klass,                        com_oracle_graal_api_meta_JavaType,                           Graal)) \
-  GRAAL_ONLY(do_klass(AbstractValue_klass,                   com_oracle_graal_api_meta_AbstractValue,                      Graal)) \
   GRAAL_ONLY(do_klass(Value_klass,                           com_oracle_graal_api_meta_Value,                              Graal)) \
 
   /*end*/
--- a/src/share/vm/classfile/vmSymbols.hpp	Wed Oct 29 15:23:46 2014 +0100
+++ b/src/share/vm/classfile/vmSymbols.hpp	Thu Oct 30 11:18:48 2014 +0100
@@ -312,7 +312,7 @@
   GRAAL_ONLY(template(com_oracle_graal_hotspot_meta_HotSpotMetaspaceConstant,   "com/oracle/graal/hotspot/meta/HotSpotMetaspaceConstant"))        \
   GRAAL_ONLY(template(com_oracle_graal_hotspot_HotSpotStackFrameReference,      "com/oracle/graal/hotspot/HotSpotStackFrameReference"))           \
   GRAAL_ONLY(template(com_oracle_graal_hotspot_CompilationTask,                 "com/oracle/graal/hotspot/CompilationTask"))                      \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_AbstractConstant,               "com/oracle/graal/api/meta/AbstractConstant"))                    \
+  GRAAL_ONLY(template(com_oracle_graal_api_meta_Constant,                       "com/oracle/graal/api/meta/Constant"))                            \
   GRAAL_ONLY(template(com_oracle_graal_api_meta_PrimitiveConstant,              "com/oracle/graal/api/meta/PrimitiveConstant"))                   \
   GRAAL_ONLY(template(com_oracle_graal_api_meta_RawConstant,                    "com/oracle/graal/api/meta/RawConstant"))                         \
   GRAAL_ONLY(template(com_oracle_graal_api_meta_NullConstant,                   "com/oracle/graal/api/meta/NullConstant"))                        \
@@ -322,7 +322,6 @@
   GRAAL_ONLY(template(com_oracle_graal_api_meta_Kind,                           "com/oracle/graal/api/meta/Kind"))                                \
   GRAAL_ONLY(template(com_oracle_graal_api_meta_LIRKind,                        "com/oracle/graal/api/meta/LIRKind"))                             \
   GRAAL_ONLY(template(com_oracle_graal_api_meta_Value,                          "com/oracle/graal/api/meta/Value"))                               \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_AbstractValue,                  "com/oracle/graal/api/meta/AbstractValue"))                       \
   GRAAL_ONLY(template(com_oracle_graal_api_code_Assumptions,                    "com/oracle/graal/api/code/Assumptions"))                         \
   GRAAL_ONLY(template(com_oracle_graal_api_code_Assumptions_MethodContents,     "com/oracle/graal/api/code/Assumptions$MethodContents"))          \
   GRAAL_ONLY(template(com_oracle_graal_api_code_Assumptions_ConcreteSubtype,    "com/oracle/graal/api/code/Assumptions$ConcreteSubtype"))         \
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Wed Oct 29 15:23:46 2014 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Thu Oct 30 11:18:48 2014 +0100
@@ -191,7 +191,7 @@
   if (constant->is_a(HotSpotMetaspaceConstant::klass())) {
     oop obj = HotSpotMetaspaceConstant::metaspaceObject(constant);
     jlong prim = HotSpotMetaspaceConstant::primitive(constant);
-    assert(Kind::typeChar(AbstractConstant::kind(constant)) == 'j', "must have word kind");
+    assert(Kind::typeChar(Constant::kind(constant)) == 'j', "must have word kind");
     assert(obj != NULL, "must have an object");
     assert(prim != 0, "must have a primitive value");
 
@@ -209,7 +209,7 @@
     return _illegal_value;
   }
 
-  oop lirKind = AbstractValue::lirKind(value);
+  oop lirKind = Value::lirKind(value);
   oop platformKind = LIRKind::platformKind(lirKind);
   jint referenceMask = LIRKind::referenceMask(lirKind);
   assert(referenceMask == 0 || referenceMask == 1, "unexpected referenceMask");
@@ -288,7 +288,7 @@
       second = value;
     }
     return value;
-  } else if (value->is_a(AbstractConstant::klass())){
+  } else if (value->is_a(Constant::klass())){
     record_metadata_in_constant(value, oop_recorder);
     if (value->is_a(PrimitiveConstant::klass())) {
       assert(!reference, "unexpected primitive constant type");
--- a/src/share/vm/graal/graalJavaAccess.hpp	Wed Oct 29 15:23:46 2014 +0100
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Thu Oct 30 11:18:48 2014 +0100
@@ -190,8 +190,8 @@
     oop_field(BytecodePosition, method, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;")                                                                      \
     int_field(BytecodePosition, bci)                                                                                                                           \
   end_class                                                                                                                                                    \
-  start_class(AbstractConstant)                                                                                                                                \
-    oop_field(AbstractConstant, kind, "Lcom/oracle/graal/api/meta/Kind;")                                                                                      \
+  start_class(Constant)                                                                                                                                        \
+    oop_field(Constant, kind, "Lcom/oracle/graal/api/meta/Kind;")                                                                                              \
   end_class                                                                                                                                                    \
   start_class(PrimitiveConstant)                                                                                                                               \
     long_field(PrimitiveConstant, primitive)                                                                                                                   \
@@ -226,12 +226,10 @@
     int_field(LIRKind, referenceMask)                                                                                                                          \
   end_class                                                                                                                                                    \
   start_class(Value)                                                                                                                                           \
+    oop_field(Value, kind, "Lcom/oracle/graal/api/meta/Kind;")                                                                                                 \
+    oop_field(Value, lirKind, "Lcom/oracle/graal/api/meta/LIRKind;")                                                                                           \
     static_oop_field(Value, ILLEGAL, "Lcom/oracle/graal/api/meta/AllocatableValue;");                                                                          \
   end_class                                                                                                                                                    \
-  start_class(AbstractValue)                                                                                                                                   \
-    oop_field(AbstractValue, kind, "Lcom/oracle/graal/api/meta/Kind;")                                                                                         \
-    oop_field(AbstractValue, lirKind, "Lcom/oracle/graal/api/meta/LIRKind;")                                                                                   \
-  end_class                                                                                                                                                    \
   start_class(RegisterValue)                                                                                                                                   \
     oop_field(RegisterValue, reg, "Lcom/oracle/graal/api/code/Register;")                                                                                      \
   end_class                                                                                                                                                    \