changeset 2293:e3c42b8de67e

Removed a reference to getRiType(Class c) and some checkstyle fixes.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 11 Apr 2011 17:42:45 +0200
parents 175e7b4d7322
children 0eb807bd8942
files c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/Compiler.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/CompilerImpl.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotRuntime.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypePrimitive.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypeResolvedImpl.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypeUnresolved.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMEntries.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMEntriesNative.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java src/share/vm/c1x/c1x_VMEntries.cpp
diffstat 10 files changed, 74 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/Compiler.java	Mon Apr 11 17:12:01 2011 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/Compiler.java	Mon Apr 11 17:42:45 2011 +0200
@@ -24,10 +24,8 @@
 
 public interface Compiler {
 
-    public VMEntries getVMEntries();
-
-    public VMExits getVMExits();
-
-    public C1XCompiler getCompiler();
+    VMEntries getVMEntries();
+    VMExits getVMExits();
+    C1XCompiler getCompiler();
 
 }
\ No newline at end of file
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/CompilerImpl.java	Mon Apr 11 17:12:01 2011 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/CompilerImpl.java	Mon Apr 11 17:42:45 2011 +0200
@@ -133,8 +133,9 @@
     private CompilerImpl(VMEntries entries) {
 
         // initialize VMEntries
-        if (entries == null)
+        if (entries == null) {
             entries = new VMEntriesNative();
+        }
 
         // initialize VMExits
         VMExits exits = new VMExitsNative(this);
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotRuntime.java	Mon Apr 11 17:12:01 2011 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotRuntime.java	Mon Apr 11 17:42:45 2011 +0200
@@ -146,6 +146,10 @@
         return compiler.getVMEntries().getType(javaClass);
     }
 
+    public Class<?> getJavaClass(CiConstant c) {
+        return null;
+    }
+
     @Override
     public RiType getRiType(CiKind kind) {
         return getRiType(kind.toJavaClass());
@@ -154,7 +158,9 @@
     @Override
     public RiType getRiType(CiConstant constant) {
         Object o = constant.asObject();
-        if (o == null) return null;
+        if (o == null) {
+            return null;
+        }
         return getRiType(o.getClass());
     }
 
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypePrimitive.java	Mon Apr 11 17:12:01 2011 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypePrimitive.java	Mon Apr 11 17:42:45 2011 +0200
@@ -61,6 +61,11 @@
     }
 
     @Override
+    public RiType superType() {
+        return null;
+    }
+
+    @Override
     public CiConstant getEncoding(Representation r) {
         throw Util.unimplemented("HotSpotTypePrimitive.getEncoding");
     }
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypeResolvedImpl.java	Mon Apr 11 17:12:01 2011 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypeResolvedImpl.java	Mon Apr 11 17:42:45 2011 +0200
@@ -31,7 +31,7 @@
  *
  * @author Thomas Wuerthinger, Lukas Stadler
  */
-public class HotSpotTypeResolvedImpl extends HotSpotType implements HotSpotTypeResolved {
+public final class HotSpotTypeResolvedImpl extends HotSpotType implements HotSpotTypeResolved {
 
     private Class javaMirror;
     private String simpleName;
@@ -73,6 +73,11 @@
     }
 
     @Override
+    public RiType superType() {
+        return compiler.getVMEntries().RiType_superType(this);
+    }
+
+    @Override
     public RiType exactType() {
         if (Modifier.isFinal(accessFlags)) {
             return this;
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypeUnresolved.java	Mon Apr 11 17:12:01 2011 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypeUnresolved.java	Mon Apr 11 17:42:45 2011 +0200
@@ -153,6 +153,11 @@
     }
 
     @Override
+    public RiType superType() {
+        throw unresolved("superType()");
+    }
+
+    @Override
     public RiType arrayOf() {
         return new HotSpotTypeUnresolved(compiler, simpleName, dimensions + 1);
     }
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMEntries.java	Mon Apr 11 17:12:01 2011 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMEntries.java	Mon Apr 11 17:42:45 2011 +0200
@@ -86,5 +86,7 @@
     void recordBailout(String reason);
 
     RiType RiType_uniqueConcreteSubtype(HotSpotTypeResolved hotSpotTypeResolved);
+
+    RiType RiType_superType(HotSpotTypeResolved hotSpotTypeResolved);
     // Checkstyle: resume
 }
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMEntriesNative.java	Mon Apr 11 17:12:01 2011 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMEntriesNative.java	Mon Apr 11 17:42:45 2011 +0200
@@ -103,6 +103,9 @@
     public native RiType RiType_uniqueConcreteSubtype(HotSpotTypeResolved klass);
 
     @Override
+    public native RiType RiType_superType(HotSpotTypeResolved klass);
+
+    @Override
     public native RiType getType(Class<?> javaClass);
 
     @Override
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java	Mon Apr 11 17:12:01 2011 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java	Mon Apr 11 17:42:45 2011 +0200
@@ -44,28 +44,28 @@
 
     private final Compiler compiler;
 
-    public final HotSpotTypePrimitive TypeBoolean;
-    public final HotSpotTypePrimitive TypeChar;
-    public final HotSpotTypePrimitive TypeFloat;
-    public final HotSpotTypePrimitive TypeDouble;
-    public final HotSpotTypePrimitive TypeByte;
-    public final HotSpotTypePrimitive TypeShort;
-    public final HotSpotTypePrimitive TypeInt;
-    public final HotSpotTypePrimitive TypeLong;
-    public final HotSpotTypePrimitive TypeVoid;
+    public final HotSpotTypePrimitive typeBoolean;
+    public final HotSpotTypePrimitive typeChar;
+    public final HotSpotTypePrimitive typeFloat;
+    public final HotSpotTypePrimitive typeDouble;
+    public final HotSpotTypePrimitive typeByte;
+    public final HotSpotTypePrimitive typeShort;
+    public final HotSpotTypePrimitive typeInt;
+    public final HotSpotTypePrimitive typeLong;
+    public final HotSpotTypePrimitive typeVoid;
 
     public VMExitsNative(Compiler compiler) {
         this.compiler = compiler;
 
-        TypeBoolean = new HotSpotTypePrimitive(compiler, CiKind.Boolean);
-        TypeChar = new HotSpotTypePrimitive(compiler, CiKind.Char);
-        TypeFloat = new HotSpotTypePrimitive(compiler, CiKind.Float);
-        TypeDouble = new HotSpotTypePrimitive(compiler, CiKind.Double);
-        TypeByte = new HotSpotTypePrimitive(compiler, CiKind.Byte);
-        TypeShort = new HotSpotTypePrimitive(compiler, CiKind.Short);
-        TypeInt = new HotSpotTypePrimitive(compiler, CiKind.Int);
-        TypeLong = new HotSpotTypePrimitive(compiler, CiKind.Long);
-        TypeVoid = new HotSpotTypePrimitive(compiler, CiKind.Void);
+        typeBoolean = new HotSpotTypePrimitive(compiler, CiKind.Boolean);
+        typeChar = new HotSpotTypePrimitive(compiler, CiKind.Char);
+        typeFloat = new HotSpotTypePrimitive(compiler, CiKind.Float);
+        typeDouble = new HotSpotTypePrimitive(compiler, CiKind.Double);
+        typeByte = new HotSpotTypePrimitive(compiler, CiKind.Byte);
+        typeShort = new HotSpotTypePrimitive(compiler, CiKind.Short);
+        typeInt = new HotSpotTypePrimitive(compiler, CiKind.Int);
+        typeLong = new HotSpotTypePrimitive(compiler, CiKind.Long);
+        typeVoid = new HotSpotTypePrimitive(compiler, CiKind.Void);
     }
 
     /**
@@ -227,23 +227,23 @@
     public RiType createRiTypePrimitive(int basicType) {
         switch (basicType) {
             case 4:
-                return TypeBoolean;
+                return typeBoolean;
             case 5:
-                return TypeChar;
+                return typeChar;
             case 6:
-                return TypeFloat;
+                return typeFloat;
             case 7:
-                return TypeDouble;
+                return typeDouble;
             case 8:
-                return TypeByte;
+                return typeByte;
             case 9:
-                return TypeShort;
+                return typeShort;
             case 10:
-                return TypeInt;
+                return typeInt;
             case 11:
-                return TypeLong;
+                return typeLong;
             case 14:
-                return TypeVoid;
+                return typeVoid;
             default:
                 throw new IllegalArgumentException("Unknown basic type: " + basicType);
         }
--- a/src/share/vm/c1x/c1x_VMEntries.cpp	Mon Apr 11 17:12:01 2011 +0200
+++ b/src/share/vm/c1x/c1x_VMEntries.cpp	Mon Apr 11 17:42:45 2011 +0200
@@ -408,10 +408,22 @@
   return JNIHandles::make_local(C1XCompiler::get_RiType(element_type, java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)), THREAD));
 }
 
+// public RiType RiType_superType(HotSpotResolvedType klass);
+JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1superType(JNIEnv *, jobject, jobject klass) {
+  Thread* THREAD = Thread::current();
+  KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)));
+  ciInstanceKlass* k = NULL;
+  {
+    VM_ENTRY_MARK;
+    k = (ciInstanceKlass *) CURRENT_ENV->get_object(klass_handle());
+    if (k->super() == NULL) return NULL;
+    return JNIHandles::make_local(C1XCompiler::get_RiType(k->super(), klass_handle, THREAD));
+  }
+}
 
 // public RiType RiType_uniqueConcreteSubtype(HotSpotResolvedType klass);
 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) {
-
+  
   Thread* THREAD = Thread::current();
   KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)));
   ciInstanceKlass* k = NULL;
@@ -656,6 +668,7 @@
   {CC"RiType_isSubtypeOf",              CC"("RESOLVED_TYPE TYPE")Z",                FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_2isSubtypeOf)},
   {CC"RiType_componentType",            CC"("RESOLVED_TYPE")"TYPE,                  FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1componentType)},
   {CC"RiType_uniqueConcreteSubtype",    CC"("RESOLVED_TYPE")"TYPE,                  FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1uniqueConcreteSubtype)},
+  {CC"RiType_superType",                CC"("RESOLVED_TYPE")"TYPE,                  FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1superType)},
   {CC"RiType_arrayOf",                  CC"("RESOLVED_TYPE")"TYPE,                  FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1arrayOf)},
   {CC"getPrimitiveArrayType",           CC"("CI_KIND")"TYPE,                        FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getPrimitiveArrayType)},
   {CC"getType",                         CC"("CLASS")"TYPE,                          FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getType)},