changeset 5545:65f832e7476b

Further clean up on api.meta project.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 09 Jun 2012 17:54:50 +0200
parents 20e390e09717
children e42c0df7212a
files graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.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/MetaUtil.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalJavaAccess.hpp
diffstat 10 files changed, 18 insertions(+), 118 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java	Sat Jun 09 17:35:43 2012 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java	Sat Jun 09 17:54:50 2012 +0200
@@ -88,5 +88,10 @@
      */
     Kind getRepresentationKind(Representation r);
 
+    /**
+     * Resolved this Java type and returns the result.
+     * @param accessingClass the class that requests resolving this type
+     * @return the resolved Java type
+     */
     ResolvedJavaType resolve(ResolvedJavaType accessingClass);
 }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Sat Jun 09 17:35:43 2012 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Sat Jun 09 17:54:50 2012 +0200
@@ -36,16 +36,16 @@
  * further describing its behavior.
  */
 public enum Kind {
-    Boolean('z', "boolean", FIELD_TYPE | RETURN_TYPE | PRIMITIVE | STACK_INT),
-    Byte   ('b', "byte",    FIELD_TYPE | RETURN_TYPE | PRIMITIVE | STACK_INT),
-    Short  ('s', "short",   FIELD_TYPE | RETURN_TYPE | PRIMITIVE | STACK_INT),
-    Char   ('c', "char",    FIELD_TYPE | RETURN_TYPE | PRIMITIVE | STACK_INT),
-    Int    ('i', "int",     FIELD_TYPE | RETURN_TYPE | PRIMITIVE | STACK_INT),
-    Float  ('f', "float",   FIELD_TYPE | RETURN_TYPE | PRIMITIVE),
-    Long   ('j', "long",    FIELD_TYPE | RETURN_TYPE | PRIMITIVE),
-    Double ('d', "double",  FIELD_TYPE | RETURN_TYPE | PRIMITIVE),
-    Object ('a', "Object",  FIELD_TYPE | RETURN_TYPE),
-    Void   ('v', "void",    RETURN_TYPE),
+    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),
     /** Denote a bytecode address in a {@code JSR} bytecode. */
     Jsr    ('r', "jsr",     0),
     /** The non-type. */
@@ -62,14 +62,6 @@
 
     static class Flags {
         /**
-         * Can be an object field type.
-         */
-        public static final int FIELD_TYPE  = 0x0001;
-        /**
-         * Can be result type of a method.
-         */
-        public static final int RETURN_TYPE = 0x0002;
-        /**
          * Behaves as an integer when on Java evaluation stack.
          */
         public static final int STACK_INT   = 0x0004;
@@ -96,22 +88,6 @@
     public final String javaName;
 
     /**
-     * Checks whether this kind is valid as the type of a field.
-     * @return {@code true} if this kind is valid as the type of a Java field
-     */
-    public boolean isValidFieldType() {
-        return (flags & FIELD_TYPE) != 0;
-    }
-
-    /**
-     * Checks whether this kind is valid as the return type of a method.
-     * @return {@code true} if this kind is valid as the return type of a Java method
-     */
-    public boolean isValidReturnType() {
-        return (flags & RETURN_TYPE) != 0;
-    }
-
-    /**
      * 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
      */
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Sat Jun 09 17:35:43 2012 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Sat Jun 09 17:54:50 2012 +0200
@@ -85,10 +85,10 @@
      */
     public static String toJavaName(JavaType riType, boolean qualified) {
         Kind kind = riType.kind();
-        if (kind.isPrimitive() || kind == Kind.Void) {
-            return kind.javaName;
+        if (kind.isObject()) {
+            return internalNameToJava(riType.name(), qualified);
         }
-        return internalNameToJava(riType.name(), qualified);
+        return riType.kind().javaName;
     }
 
     /**
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java	Sat Jun 09 17:35:43 2012 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java	Sat Jun 09 17:54:50 2012 +0200
@@ -113,19 +113,6 @@
     boolean isConstructor();
 
     /**
-     * Checks whether this method has been overridden. Decisions made based
-     * on a method being overridden must be registered as dependencies.
-     * @return {@code true} if the method has been overridden
-     */
-    boolean isOverridden();
-
-    /**
-     * Checks whether the compiler can insert safepoint polls in this method.
-     * @return {@code true} if the method cannot have safepoint polls inserted
-     */
-    boolean noSafepointPolls();
-
-    /**
      * Checks whether this method can be statically bound (that is, it is final or private or static).
      * @return {@code true} if this method can be statically bound
      */
@@ -143,17 +130,6 @@
     StackTraceElement toStackTraceElement(int bci);
 
     /**
-     * Temporary work-around to support the @ACCESSOR Maxine annotation.
-     * Non-Maxine VMs should just return {@code null}.
-     */
-    ResolvedJavaType accessor();
-
-    /**
-     * Gets the intrinsic id of this method.
-     */
-    String intrinsic();
-
-    /**
      * Provides an estimate of how often this method has been executed.
      * @return The number of invocations, or -1 if this information isn't available.
      */
@@ -202,13 +178,6 @@
     Type[] getGenericParameterTypes();
 
     /**
-     * Returns a {@link Type} object that represents the formal return type of this method.
-     *
-     * @see Method#getGenericReturnType()
-     */
-    Type getGenericReturnType();
-
-    /**
      * @return {@code true} if this method can be inlined
      */
     boolean canBeInlined();
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java	Sat Jun 09 17:35:43 2012 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java	Sat Jun 09 17:54:50 2012 +0200
@@ -39,14 +39,6 @@
     Constant getEncoding(Representation r);
 
     /**
-     * Checks whether this type has any subclasses so far. Any decisions
-     * based on this information require the registration of a dependency, since
-     * this information may change.
-     * @return {@code true} if this class has subclasses
-     */
-    boolean hasSubclass();
-
-    /**
      * Checks whether this type has a finalizer method.
      * @return {@code true} if this class has a finalizer
      */
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java	Sat Jun 09 17:35:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java	Sat Jun 09 17:54:50 2012 +0200
@@ -126,16 +126,6 @@
     }
 
     @Override
-    public boolean isOverridden() {
-        throw new UnsupportedOperationException("isOverridden");
-    }
-
-    @Override
-    public boolean noSafepointPolls() {
-        return false;
-    }
-
-    @Override
     public String jniSymbol() {
         throw new UnsupportedOperationException("jniSymbol");
     }
@@ -192,16 +182,6 @@
     }
 
     @Override
-    public ResolvedJavaType accessor() {
-        return null;
-    }
-
-    @Override
-    public String intrinsic() {
-        return null;
-    }
-
-    @Override
     public int invocationCount() {
         return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_invocationCount(this);
     }
@@ -324,15 +304,6 @@
     }
 
     @Override
-    public Type getGenericReturnType() {
-        if (isConstructor()) {
-            return void.class;
-        }
-        Method javaMethod = toJava();
-        return javaMethod == null ? null : javaMethod.getGenericReturnType();
-    }
-
-    @Override
     public Type[] getGenericParameterTypes() {
         if (isConstructor()) {
             Constructor javaConstructor = toJavaConstructor();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java	Sat Jun 09 17:35:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java	Sat Jun 09 17:54:50 2012 +0200
@@ -96,11 +96,6 @@
     }
 
     @Override
-    public boolean hasSubclass() {
-        return false;
-    }
-
-    @Override
     public boolean isArrayClass() {
         return false;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java	Sat Jun 09 17:35:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java	Sat Jun 09 17:54:50 2012 +0200
@@ -40,7 +40,6 @@
     private String simpleName;
     private int accessFlags;
     private boolean hasFinalizer;
-    private boolean hasSubclass;
     private boolean hasFinalizableSubclass;
     private int superCheckOffset;
     private boolean isArrayClass;
@@ -142,11 +141,6 @@
     }
 
     @Override
-    public boolean hasSubclass() {
-        return hasSubclass;
-    }
-
-    @Override
     public boolean isArrayClass() {
         return isArrayClass;
     }
--- a/src/share/vm/graal/graalCompiler.cpp	Sat Jun 09 17:35:43 2012 +0200
+++ b/src/share/vm/graal/graalCompiler.cpp	Sat Jun 09 17:54:50 2012 +0200
@@ -284,7 +284,6 @@
   }
 
   // TODO replace these with correct values
-  HotSpotTypeResolved::set_hasSubclass(obj, false);
   HotSpotTypeResolved::set_hasFinalizableSubclass(obj, false);
 
   klass->set_graal_mirror(obj());
--- a/src/share/vm/graal/graalJavaAccess.hpp	Sat Jun 09 17:35:43 2012 +0200
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Sat Jun 09 17:54:50 2012 +0200
@@ -50,7 +50,6 @@
     oop_field(HotSpotTypeResolved, simpleName, "Ljava/lang/String;")                    \
     int_field(HotSpotTypeResolved, accessFlags)                                         \
     boolean_field(HotSpotTypeResolved, hasFinalizer)                                    \
-    boolean_field(HotSpotTypeResolved, hasSubclass)                                     \
     boolean_field(HotSpotTypeResolved, hasFinalizableSubclass)                          \
     int_field(HotSpotTypeResolved, superCheckOffset)                                    \
     boolean_field(HotSpotTypeResolved, isArrayClass)                                    \