changeset 6328:6e66d97a16ae

Clean up Kind class.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 07 Sep 2012 12:12:47 +0200
parents be0788825ffa
children 92bc58dc5b5e
files graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.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/DeoptimizationReason.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotXirGenerator.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MaterializeNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/WordTypeRewriterPhase.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanForwardNode.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanReverseNode.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ReverseBytesNode.java
diffstat 21 files changed, 244 insertions(+), 159 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java	Fri Sep 07 12:12:47 2012 +0200
@@ -119,8 +119,8 @@
         this.flags = createMask(flags);
         this.encoding = encoding;
 
-        values = new RegisterValue[Kind.VALUES.length];
-        for (Kind kind : Kind.VALUES) {
+        values = new RegisterValue[Kind.values().length];
+        for (Kind kind : Kind.values()) {
             values[kind.ordinal()] = new RegisterValue(kind, this);
         }
     }
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java	Fri Sep 07 12:12:47 2012 +0200
@@ -162,7 +162,7 @@
     private static final StackSlot[][] OUT_CACHE = makeCache(PARAM_CACHE_PER_KIND_SIZE, 1, false);
 
     private static StackSlot[][] makeCache(int cachePerKindSize, int sign, boolean addFrameSize) {
-        StackSlot[][] cache = new StackSlot[Kind.VALUES.length][];
+        StackSlot[][] cache = new StackSlot[Kind.values().length][];
         for (Kind kind : new Kind[] {Illegal, Int, Long, Float, Double, Object, Jsr}) {
             StackSlot[] slots = new StackSlot[cachePerKindSize];
             for (int i = 0; i < cachePerKindSize; i++) {
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java	Fri Sep 07 12:12:47 2012 +0200
@@ -179,7 +179,7 @@
      * @return the int value of this constant
      */
     public int asInt() {
-        if (kind.stackKind().isInt() || kind.isJsr()) {
+        if (kind.stackKind().isStackInt() || kind.isJsr()) {
             return (int) primitive;
         }
         throw new Error("Constant is not int: " + this);
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java	Fri Sep 07 12:12:47 2012 +0200
@@ -22,7 +22,9 @@
  */
 package com.oracle.graal.api.meta;
 
-
+/**
+ * Enumeration of reasons for why a deoptimization is happening.
+ */
 public enum DeoptimizationReason {
     None,
     NullCheckException,
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Fri Sep 07 12:12:47 2012 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,59 +22,61 @@
  */
 package com.oracle.graal.api.meta;
 
-import static com.oracle.graal.api.meta.Kind.Flags.*;
-
 import java.lang.reflect.*;
 
 import sun.misc.*;
 
 /**
- * Denotes the basic kinds of types in CRI, including the all the Java primitive types,
- * for example, {@link Kind#Int} for {@code int} and {@link Kind#Object}
- * for all object types.
- * A kind has a single character short name, a Java name, and a set of flags
- * further describing its behavior.
+ * Denotes the basic kinds of types in CRI, including the all the Java primitive types, for example, {@link Kind#Int}
+ * for {@code int} and {@link Kind#Object} for all object types. A kind has a single character short name, a Java name,
+ * and a set of flags further describing its behavior.
  */
 public enum Kind {
-    Boolean('z', "boolean", PRIMITIVE | STACK_INT),
-    Byte   ('b', "byte",    PRIMITIVE | STACK_INT),
-    Short  ('s', "short",   PRIMITIVE | STACK_INT),
-    Char   ('c', "char",    PRIMITIVE | STACK_INT),
-    Int    ('i', "int",     PRIMITIVE | STACK_INT),
-    Float  ('f', "float",   PRIMITIVE),
-    Long   ('j', "long",    PRIMITIVE),
-    Double ('d', "double",  PRIMITIVE),
-    Object ('a', "Object",  0),
-    Void   ('v', "void",    0),
+    /** The primitive boolean kind, represented as an int on the stack. */
+    Boolean('z', "boolean", true, true),
+
+    /** The primitive byte kind, represented as an int on the stack. */
+    Byte('b', "byte", true, true),
+
+    /** The primitive short kind, represented as an int on the stack. */
+    Short('s', "short", true, true),
+
+    /** The primitive char kind, represented as an int on the stack. */
+    Char('c', "char", true, true),
+
+    /** The primitive int kind, represented as an int on the stack. */
+    Int('i', "int", true, true),
+
+    /** The primitive float kind. */
+    Float('f', "float", true, false),
+
+    /** The primitive long kind. */
+    Long('j', "long", true, false),
+
+    /** The primitive double kind. */
+    Double('d', "double", true, false),
+
+    /** The Object kind, also used for arrays. */
+    Object('a', "Object", false, false),
+
+    /** The void float kind. */
+    Void('v', "void", false, false),
+
     /** Denote a bytecode address in a {@code JSR} bytecode. */
-    Jsr    ('r', "jsr",     0),
+    Jsr('r', "jsr", false, false),
+
     /** The non-type. */
-    Illegal('-', "illegal", 0);
+    Illegal('-', "illegal", false, false);
 
-    public static final Kind[] VALUES = values();
-    public static final Kind[] JAVA_VALUES = new Kind[] {Kind.Boolean, Kind.Byte, Kind.Short, Kind.Char, Kind.Int, Kind.Float, Kind.Long, Kind.Double, Kind.Object};
-
-    Kind(char ch, String name, int flags) {
+    private Kind(char ch, String name, boolean isPrimitive, boolean isStackInt) {
         this.typeChar = ch;
         this.javaName = name;
-        this.flags = flags;
+        this.isPrimitive = isPrimitive;
+        this.isStackInt = isStackInt;
     }
 
-    static class Flags {
-        /**
-         * Behaves as an integer when on Java evaluation stack.
-         */
-        public static final int STACK_INT   = 0x0004;
-        /**
-         * Represents a Java primitive type.
-         */
-        public static final int PRIMITIVE   = 0x0008;
-    }
-
-    /**
-     * The flags for this kind.
-     */
-    private final int flags;
+    private final boolean isStackInt;
+    private final boolean isPrimitive;
 
     /**
      * The name of the kind as a single character.
@@ -82,39 +84,48 @@
     public final char typeChar;
 
     /**
-     * The name of this kind which will also be it Java programming language name if
-     * it is {@linkplain #isPrimitive() primitive} or {@code void}.
+     * The name of this kind which will also be it Java programming language name if it is {@linkplain #isPrimitive()
+     * primitive} or {@code void}.
      */
     public final String javaName;
 
     /**
      * Checks whether this type is valid as an {@code int} on the Java operand stack.
+     *
      * @return {@code true} if this type is represented by an {@code int} on the operand stack
      */
-    public boolean isInt() {
-        return (flags & STACK_INT) != 0;
+    public boolean isStackInt() {
+        return this.isStackInt;
     }
 
     /**
      * Checks whether this type is a Java primitive type.
-     * @return {@code true} if this is {@link #Boolean}, {@link #Byte}, {@link #Char}, {@link #Short},
-     *                                 {@link #Int}, {@link #Long}, {@link #Float} or {@link #Double}.
+     *
+     * @return {@code true} if this is {@link #Boolean}, {@link #Byte}, {@link #Char}, {@link #Short}, {@link #Int},
+     *         {@link #Long}, {@link #Float} or {@link #Double}.
      */
     public boolean isPrimitive() {
-        return (flags & PRIMITIVE) != 0;
+        return this.isPrimitive;
     }
 
     /**
      * Gets the kind that represents this kind when on the Java operand stack.
+     *
      * @return the kind used on the operand stack
      */
     public Kind stackKind() {
-        if (isInt()) {
+        if (isStackInt()) {
             return Int;
         }
         return this;
     }
 
+    /**
+     * Returns the kind corresponding to the Java type string.
+     *
+     * @param typeString the Java type string
+     * @return the kind
+     */
     public static Kind fromTypeString(String typeString) {
         assert typeString.length() > 0;
         final char first = typeString.charAt(0);
@@ -126,62 +137,97 @@
 
     /**
      * Gets the kind from the character describing a primitive or void.
+     *
      * @param ch the character
      * @return the kind
      */
     public static Kind fromPrimitiveOrVoidTypeChar(char ch) {
-        // Checkstyle: stop
         switch (ch) {
-            case 'Z': return Boolean;
-            case 'C': return Char;
-            case 'F': return Float;
-            case 'D': return Double;
-            case 'B': return Byte;
-            case 'S': return Short;
-            case 'I': return Int;
-            case 'J': return Long;
-            case 'V': return Void;
+            case 'Z':
+                return Boolean;
+            case 'C':
+                return Char;
+            case 'F':
+                return Float;
+            case 'D':
+                return Double;
+            case 'B':
+                return Byte;
+            case 'S':
+                return Short;
+            case 'I':
+                return Int;
+            case 'J':
+                return Long;
+            case 'V':
+                return Void;
         }
-        // Checkstyle: resume
         throw new IllegalArgumentException("unknown primitive or void type character: " + ch);
     }
 
+    /**
+     * Returns the Java class representing this kind.
+     *
+     * @return the Java class
+     */
     public Class< ? > toJavaClass() {
-        // Checkstyle: stop
-        switch(this) {
-            case Void:      return java.lang.Void.TYPE;
-            case Long:      return java.lang.Long.TYPE;
-            case Int:       return java.lang.Integer.TYPE;
-            case Byte:      return java.lang.Byte.TYPE;
-            case Char:      return java.lang.Character.TYPE;
-            case Double:    return java.lang.Double.TYPE;
-            case Float:     return java.lang.Float.TYPE;
-            case Short:     return java.lang.Short.TYPE;
-            case Boolean:   return java.lang.Boolean.TYPE;
-            default:        return null;
+        switch (this) {
+            case Void:
+                return java.lang.Void.TYPE;
+            case Long:
+                return java.lang.Long.TYPE;
+            case Int:
+                return java.lang.Integer.TYPE;
+            case Byte:
+                return java.lang.Byte.TYPE;
+            case Char:
+                return java.lang.Character.TYPE;
+            case Double:
+                return java.lang.Double.TYPE;
+            case Float:
+                return java.lang.Float.TYPE;
+            case Short:
+                return java.lang.Short.TYPE;
+            case Boolean:
+                return java.lang.Boolean.TYPE;
+            default:
+                return null;
         }
-        // Checkstyle: resume
     }
 
+    /**
+     * Returns the Java class for instances of boxed values of this kind.
+     *
+     * @return the Java class
+     */
     public Class< ? > toBoxedJavaClass() {
-        // Checkstyle: stop
-        switch(this) {
-            case Void:      return null;
-            case Long:      return java.lang.Long.class;
-            case Int:       return java.lang.Integer.class;
-            case Byte:      return java.lang.Byte.class;
-            case Char:      return java.lang.Character.class;
-            case Double:    return java.lang.Double.class;
-            case Float:     return java.lang.Float.class;
-            case Short:     return java.lang.Short.class;
-            case Boolean:   return java.lang.Boolean.class;
-            default:        return null;
+        switch (this) {
+            case Void:
+                return java.lang.Void.class;
+            case Long:
+                return java.lang.Long.class;
+            case Int:
+                return java.lang.Integer.class;
+            case Byte:
+                return java.lang.Byte.class;
+            case Char:
+                return java.lang.Character.class;
+            case Double:
+                return java.lang.Double.class;
+            case Float:
+                return java.lang.Float.class;
+            case Short:
+                return java.lang.Short.class;
+            case Boolean:
+                return java.lang.Boolean.class;
+            default:
+                return null;
         }
-        // Checkstyle: resume
     }
 
     /**
      * Checks whether this value type is void.
+     *
      * @return {@code true} if this type is void
      */
     public final boolean isVoid() {
@@ -190,6 +236,7 @@
 
     /**
      * Checks whether this value type is long.
+     *
      * @return {@code true} if this type is long
      */
     public final boolean isLong() {
@@ -198,6 +245,7 @@
 
     /**
      * Checks whether this value type is float.
+     *
      * @return {@code true} if this type is float
      */
     public final boolean isFloat() {
@@ -206,6 +254,7 @@
 
     /**
      * Checks whether this value type is double.
+     *
      * @return {@code true} if this type is double
      */
     public final boolean isDouble() {
@@ -214,14 +263,16 @@
 
     /**
      * Checks whether this value type is float or double.
+     *
      * @return {@code true} if this type is float or double
      */
     public final boolean isFloatOrDouble() {
         return this == Kind.Double || this == Kind.Float;
     }
 
-   /**
+    /**
      * Checks whether this value type is an object type.
+     *
      * @return {@code true} if this type is an object
      */
     public final boolean isObject() {
@@ -230,6 +281,7 @@
 
     /**
      * Checks whether this value type is an address type.
+     *
      * @return {@code true} if this type is an address
      */
     public boolean isJsr() {
@@ -245,10 +297,11 @@
     }
 
     /**
-     * Marker interface for types that should be {@linkplain Kind#format(Object) formatted}
-     * with their {@link Object#toString()} value.
+     * Marker interface for types that should be {@linkplain Kind#format(Object) formatted} with their
+     * {@link Object#toString()} value.
      */
-    public interface FormatWithToString {}
+    public interface FormatWithToString {
+    }
 
     /**
      * Gets a formatted string for a given value of this kind.
@@ -285,16 +338,13 @@
         }
     }
 
-    private static final int MAX_FORMAT_ARRAY_LENGTH = Integer.getInteger("maxFormatArrayLength", 5);
+    private static final int MAX_FORMAT_ARRAY_LENGTH = 5;
 
     private static String formatArray(Object array) {
         Class< ? > componentType = array.getClass().getComponentType();
         assert componentType != null;
         int arrayLength = Array.getLength(array);
-        StringBuilder buf = new StringBuilder(MetaUtil.getSimpleName(componentType, true)).
-                        append('[').
-                        append(arrayLength).
-                        append("]{");
+        StringBuilder buf = new StringBuilder(MetaUtil.getSimpleName(componentType, true)).append('[').append(arrayLength).append("]{");
         int length = Math.min(MAX_FORMAT_ARRAY_LENGTH, arrayLength);
         boolean primitive = componentType.isPrimitive();
         for (int i = 0; i < length; i++) {
@@ -314,12 +364,13 @@
         return buf.append('}').toString();
     }
 
-    public final char signatureChar() {
-        return Character.toUpperCase(typeChar);
-    }
-
-    public final int arrayBaseOffset() {
-        switch(this) {
+    /**
+     * The offset from the origin of an array to the first element.
+     *
+     * @return the offset in bytes
+     */
+    public final int getArrayBaseOffset() {
+        switch (this) {
             case Boolean:
                 return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
             case Byte:
@@ -344,8 +395,13 @@
         }
     }
 
-    public final int arrayIndexScale() {
-        switch(this) {
+    /**
+     * The scale used for the index when accessing elements of an array of this kind.
+     *
+     * @return the scale in order to convert the index into a byte offset
+     */
+    public final int getArrayIndexScale() {
+        switch (this) {
             case Boolean:
                 return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE;
             case Byte:
@@ -370,35 +426,47 @@
         }
     }
 
-    public Constant readUnsafeConstant(Object value, long displacement) {
-        assert value != null;
+    /**
+     * Utility function for reading a value of this kind using an object and a displacement.
+     *
+     * @param object the object from which the value is read
+     * @param displacement the displacement within the object in bytes
+     * @return the read value encapsulated in a {@link Constant} object
+     */
+    public Constant readUnsafeConstant(Object object, long displacement) {
+        assert object != null;
         Unsafe u = Unsafe.getUnsafe();
-        switch(this) {
+        switch (this) {
             case Boolean:
-                return Constant.forBoolean(u.getBoolean(value, displacement));
+                return Constant.forBoolean(u.getBoolean(object, displacement));
             case Byte:
-                return Constant.forByte(u.getByte(value, displacement));
+                return Constant.forByte(u.getByte(object, displacement));
             case Char:
-                return Constant.forChar(u.getChar(value, displacement));
+                return Constant.forChar(u.getChar(object, displacement));
             case Short:
-                return Constant.forShort(u.getShort(value, displacement));
+                return Constant.forShort(u.getShort(object, displacement));
             case Int:
-                return Constant.forInt(u.getInt(value, displacement));
+                return Constant.forInt(u.getInt(object, displacement));
             case Long:
-                return Constant.forLong(u.getLong(value, displacement));
+                return Constant.forLong(u.getLong(object, displacement));
             case Float:
-                return Constant.forFloat(u.getFloat(value, displacement));
+                return Constant.forFloat(u.getFloat(object, displacement));
             case Double:
-                return Constant.forDouble(u.getDouble(value, displacement));
+                return Constant.forDouble(u.getDouble(object, displacement));
             case Object:
-                return Constant.forObject(u.getObject(value, displacement));
+                return Constant.forObject(u.getObject(object, displacement));
             default:
                 assert false : "unexpected kind: " + this;
                 return null;
         }
     }
 
-    public long minValue() {
+    /**
+     * The minimum value that can be represented as a value of this kind.
+     *
+     * @return the minimum value
+     */
+    public long getMinValue() {
         switch (this) {
             case Boolean:
                 return 0;
@@ -418,7 +486,12 @@
         }
     }
 
-    public long maxValue() {
+    /**
+     * The maximum value that can be represented as a value of this kind.
+     *
+     * @return the maximum value
+     */
+    public long getMaxValue() {
         switch (this) {
             case Boolean:
                 return 1;
@@ -438,7 +511,12 @@
         }
     }
 
-    public int bits() {
+    /**
+     * Number of bits that are necessary to represent a value of this kind.
+     *
+     * @return the number of bits
+     */
+    public int getBitCount() {
         switch (this) {
             case Boolean:
                 return 1;
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java	Fri Sep 07 12:12:47 2012 +0200
@@ -41,6 +41,11 @@
     ResolvedJavaType getTypeOf(Constant constant);
 
 
+    /**
+     * Returns the resolved Java type representing a given Java class.
+     * @param clazz the Java class object
+     * @return the resolved Java type object
+     */
     ResolvedJavaType getResolvedJavaType(Class<?> clazz);
 
     /**
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Fri Sep 07 12:12:47 2012 +0200
@@ -116,7 +116,7 @@
         return (type == null) ? null : internalNameToJava(type.name(), true);
     }
 
-    public static String internalNameToJava(String name, boolean qualified) {
+    private static String internalNameToJava(String name, boolean qualified) {
         switch (name.charAt(0)) {
             case 'L': {
                 String result = name.substring(1, name.length() - 1).replace('/', '.');
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Sep 07 12:12:47 2012 +0200
@@ -445,7 +445,7 @@
     }
 
     private static IndexedLocationNode createArrayLocation(Graph graph, Kind elementKind, ValueNode index) {
-        return IndexedLocationNode.create(LocationNode.getArrayLocation(elementKind), elementKind, elementKind.arrayBaseOffset(), index, graph, true);
+        return IndexedLocationNode.create(LocationNode.getArrayLocation(elementKind), elementKind, elementKind.getArrayBaseOffset(), index, graph, true);
     }
 
     private SafeReadNode safeReadArrayLength(ValueNode array, long leafGraphId) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java	Fri Sep 07 12:12:47 2012 +0200
@@ -212,12 +212,12 @@
 
     @Fold
     static int arrayBaseOffset(Kind elementKind) {
-        return elementKind.arrayBaseOffset();
+        return elementKind.getArrayBaseOffset();
     }
 
     @Fold
     static int arrayIndexScale(Kind elementKind) {
-        return elementKind.arrayIndexScale();
+        return elementKind.getArrayIndexScale();
     }
 
     static {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java	Fri Sep 07 12:12:47 2012 +0200
@@ -265,7 +265,7 @@
             ResolvedJavaType arrayType = elementType.arrayOf();
             Kind elementKind = elementType.kind();
             final int alignment = target.wordSize;
-            final int headerSize = elementKind.arrayBaseOffset();
+            final int headerSize = elementKind.getArrayBaseOffset();
             final Integer length = lengthNode.isConstant() ? Integer.valueOf(lengthNode.asConstant().asInt()) : null;
             int log2ElementSize = CodeUtil.log2(target.sizeInBytes(elementKind));
             if (!useTLAB) {
@@ -333,7 +333,7 @@
             assert elementType != null;
             HotSpotKlassOop hub = type.klassOop();
             Kind elementKind = elementType.kind();
-            final int headerSize = elementKind.arrayBaseOffset();
+            final int headerSize = elementKind.getArrayBaseOffset();
             Key key = new Key(elementKind.isObject() ? initializeObjectArray : initializePrimitiveArray).add("headerSize", headerSize);
             ValueNode memory = initializeNode.memory();
             Arguments arguments = arguments("memory", memory).add("hub", hub).add("initialMarkWord", type.initialMarkWord()).add("size", initializeNode.size()).add("length", initializeNode.length());
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotXirGenerator.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotXirGenerator.java	Fri Sep 07 12:12:47 2012 +0200
@@ -358,7 +358,7 @@
 
             final int aligning = target.wordSize;
             final int arrayLengthOffset = target.wordSize * 2;
-            final int arrayElementOffset = kind.arrayBaseOffset();
+            final int arrayElementOffset = kind.getArrayBaseOffset();
 
             // Calculate aligned size
             asm.mov(size, length);
@@ -978,7 +978,7 @@
 
         @Override
         protected final XirTemplate create(XirAssembler asm, long flags) {
-            return create(asm, flags & FLAGS_MASK, Kind.VALUES[(int) (flags & INDEX_MASK)]);
+            return create(asm, flags & FLAGS_MASK, Kind.values()[(int) (flags & INDEX_MASK)]);
         }
 
         protected abstract XirTemplate create(XirAssembler asm, long flags, Kind kind);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MaterializeNode.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MaterializeNode.java	Fri Sep 07 12:12:47 2012 +0200
@@ -37,15 +37,15 @@
             if (x.kind().isObject()) {
                 comparison = new ObjectEqualsNode(x, y);
             } else {
-                assert x.kind().stackKind().isInt() || x.kind().isLong();
+                assert x.kind().stackKind().isStackInt() || x.kind().isLong();
                 comparison = new IntegerEqualsNode(x, y);
             }
         } else if (condition == Condition.LT) {
-            assert x.kind().stackKind().isInt() || x.kind().isLong();
+            assert x.kind().stackKind().isStackInt() || x.kind().isLong();
             comparison = new IntegerLessThanNode(x, y);
         } else {
             assert condition == Condition.BT;
-            assert x.kind().stackKind().isInt() || x.kind().isLong();
+            assert x.kind().stackKind().isStackInt() || x.kind().isLong();
             comparison = new IntegerBelowThanNode(x, y);
         }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java	Fri Sep 07 12:12:47 2012 +0200
@@ -79,11 +79,11 @@
 
     public static boolean isIntegerAddition(ValueNode result, ValueNode a, ValueNode b) {
         Kind kind = result.kind();
-        if (kind != a.kind() || kind != b.kind() || !(kind.isInt() || kind.isLong())) {
+        if (kind != a.kind() || kind != b.kind() || !(kind.isStackInt() || kind.isLong())) {
             return false;
         }
         if (result.isConstant() && a.isConstant() && b.isConstant()) {
-            if (kind.isInt()) {
+            if (kind.isStackInt()) {
                 return result.asConstant().asInt() == a.asConstant().asInt() + b.asConstant().asInt();
             } else if (kind.isLong()) {
                 return result.asConstant().asLong() == a.asConstant().asLong() + b.asConstant().asLong();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java	Fri Sep 07 12:12:47 2012 +0200
@@ -70,7 +70,7 @@
                 // no rounding if dividend is positive or if its low bits are always 0
                 if (stampX.canBeNegative() || (stampX.mask() & (abs - 1)) != 0) {
                     int bits;
-                    if (kind().isInt()) {
+                    if (kind().isStackInt()) {
                         bits = 32;
                     } else {
                         assert kind().isLong();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java	Fri Sep 07 12:12:47 2012 +0200
@@ -64,7 +64,7 @@
                 int length = Array.getLength(array);
                 if (index >= 0 && index < length) {
                     return ConstantNode.forConstant(elementKind().readUnsafeConstant(array,
-                                    elementKind().arrayBaseOffset() + index * elementKind().arrayIndexScale()), runtime, graph());
+                                    elementKind().getArrayBaseOffset() + index * elementKind().getArrayIndexScale()), runtime, graph());
                 }
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java	Fri Sep 07 12:12:47 2012 +0200
@@ -38,14 +38,14 @@
     private final long mask;
 
     public IntegerStamp(Kind kind) {
-        this(kind, kind.minValue(), kind.maxValue(), defaultMask(kind));
+        this(kind, kind.getMinValue(), kind.getMaxValue(), defaultMask(kind));
     }
 
     public IntegerStamp(Kind kind, long lowerBound, long upperBound, long mask) {
         super(kind);
         assert lowerBound <= upperBound;
-        assert lowerBound >= kind.minValue();
-        assert upperBound <= kind.maxValue();
+        assert lowerBound >= kind.getMinValue();
+        assert upperBound <= kind.getMaxValue();
         assert (mask & defaultMask(kind)) == mask;
         this.lowerBound = lowerBound;
         this.upperBound = upperBound;
@@ -75,7 +75,7 @@
     }
 
     public boolean isUnrestricted() {
-        return lowerBound == kind().minValue() && upperBound == kind().maxValue() && mask == defaultMask(kind());
+        return lowerBound == kind().getMinValue() && upperBound == kind().getMaxValue() && mask == defaultMask(kind());
     }
 
     public boolean contains(long value) {
@@ -112,7 +112,7 @@
         str.append(kind().typeChar);
         if (lowerBound == upperBound) {
             str.append(" [").append(lowerBound).append(']');
-        } else if (lowerBound != kind().minValue() || upperBound != kind().maxValue()) {
+        } else if (lowerBound != kind().getMinValue() || upperBound != kind().getMaxValue()) {
             str.append(" [").append(lowerBound).append(" - ").append(upperBound).append(']');
         }
         if (mask != defaultMask(kind())) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java	Fri Sep 07 12:12:47 2012 +0200
@@ -36,7 +36,7 @@
         Kind kind = stamp.kind();
         if (stamp instanceof IntegerStamp) {
             IntegerStamp integerStamp = (IntegerStamp) stamp;
-            if (integerStamp.lowerBound() != kind.minValue()) {
+            if (integerStamp.lowerBound() != kind.getMinValue()) {
                 // TODO(ls) check if the mask calculation is correct...
                 return new IntegerStamp(kind, -integerStamp.upperBound(), -integerStamp.lowerBound(), IntegerStamp.defaultMask(kind) & (integerStamp.mask() | -integerStamp.mask()));
             }
@@ -180,11 +180,11 @@
         long mask = fromStamp.mask() & IntegerStamp.defaultMask(toKind);
         long lowerBound = saturate(fromStamp.lowerBound(), toKind);
         long upperBound = saturate(fromStamp.upperBound(), toKind);
-        if (fromStamp.lowerBound() < toKind.minValue()) {
-            upperBound = toKind.maxValue();
+        if (fromStamp.lowerBound() < toKind.getMinValue()) {
+            upperBound = toKind.getMaxValue();
         }
-        if (fromStamp.upperBound() > toKind.maxValue()) {
-            lowerBound = toKind.minValue();
+        if (fromStamp.upperBound() > toKind.getMaxValue()) {
+            lowerBound = toKind.getMinValue();
         }
         return StampFactory.forInteger(toKind.stackKind(), lowerBound, upperBound, mask);
     }
@@ -206,11 +206,11 @@
     }
 
     public static long saturate(long v, Kind kind) {
-        long max = kind.maxValue();
+        long max = kind.getMaxValue();
         if (v > max) {
             return max;
         }
-        long min = kind.minValue();
+        long min = kind.getMinValue();
         if (v < min) {
             return min;
         }
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/WordTypeRewriterPhase.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/WordTypeRewriterPhase.java	Fri Sep 07 12:12:47 2012 +0200
@@ -219,10 +219,10 @@
         if (value.kind() != wordKind) {
             Op op;
             if (wordKind.isLong()) {
-                assert value.kind().isInt();
+                assert value.kind().isStackInt();
                 op = Op.I2L;
             } else {
-                assert wordKind.isInt();
+                assert wordKind.isStackInt();
                 assert value.kind().isLong();
                 op = Op.L2I;
             }
@@ -238,7 +238,7 @@
             if (from.isLong()) {
                 op = Op.L2I;
             } else {
-                assert from.isInt();
+                assert from.isStackInt();
                 op = Op.I2L;
             }
             return graph.unique(new ConvertNode(op, value));
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanForwardNode.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanForwardNode.java	Fri Sep 07 12:12:47 2012 +0200
@@ -38,7 +38,7 @@
     @Input private ValueNode value;
 
     public BitScanForwardNode(ValueNode value) {
-        super(StampFactory.forInteger(Kind.Int, 0, value.kind().bits()));
+        super(StampFactory.forInteger(Kind.Int, 0, value.kind().getBitCount()));
         this.value = value;
     }
 
@@ -46,7 +46,7 @@
     public ValueNode canonical(CanonicalizerTool tool) {
         if (value.isConstant()) {
             long v = value.asConstant().asLong();
-            if (value.kind().isInt()) {
+            if (value.kind().isStackInt()) {
                 return ConstantNode.forInt(Integer.numberOfTrailingZeros((int) v), graph());
             } else if (value.kind().isLong()) {
                 return ConstantNode.forInt(Long.numberOfTrailingZeros(v), graph());
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanReverseNode.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanReverseNode.java	Fri Sep 07 12:12:47 2012 +0200
@@ -39,7 +39,7 @@
     @Input private ValueNode value;
 
     public BitScanReverseNode(ValueNode value) {
-        super(StampFactory.forInteger(Kind.Int, 0, value.kind().bits()));
+        super(StampFactory.forInteger(Kind.Int, 0, value.kind().getBitCount()));
         this.value = value;
     }
 
@@ -47,7 +47,7 @@
     public ValueNode canonical(CanonicalizerTool tool) {
         if (value.isConstant()) {
             long v = value.asConstant().asLong();
-            if (value.kind().isInt()) {
+            if (value.kind().isStackInt()) {
                 return ConstantNode.forInt(31 - Integer.numberOfLeadingZeros((int) v), graph());
             } else if (value.kind().isLong()) {
                 return ConstantNode.forInt(63 - Long.numberOfLeadingZeros(v), graph());
@@ -70,7 +70,7 @@
     public void generate(LIRGenerator gen) {
         Variable result = gen.newVariable(Kind.Int);
         IntrinsicOpcode opcode;
-        if (value.kind().isInt()) {
+        if (value.kind().isStackInt()) {
             opcode = IntrinsicOpcode.IBSR;
         } else if (value.kind().isLong()) {
             opcode = IntrinsicOpcode.LBSR;
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ReverseBytesNode.java	Fri Sep 07 11:10:48 2012 +0200
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ReverseBytesNode.java	Fri Sep 07 12:12:47 2012 +0200
@@ -37,7 +37,7 @@
 
     public ReverseBytesNode(ValueNode value) {
         super(StampFactory.forKind(value.kind()));
-        assert kind().isInt() || kind().isLong();
+        assert kind().isStackInt() || kind().isLong();
         this.value = value;
     }
 
@@ -45,7 +45,7 @@
     public ValueNode canonical(CanonicalizerTool tool) {
         if (value.isConstant()) {
             long v = value.asConstant().asLong();
-            if (kind().isInt()) {
+            if (kind().isStackInt()) {
                 return ConstantNode.forInt(Integer.reverseBytes((int) v), graph());
             } else if (kind().isLong()) {
                 return ConstantNode.forLong(Long.reverseBytes(v), graph());