[vmkit-commits] [vmkit] r69535 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaClass.cpp JavaClass.h

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sun Apr 19 12:28:34 PDT 2009


Author: geoffray
Date: Sun Apr 19 14:28:34 2009
New Revision: 69535

URL: http://llvm.org/viewvc/llvm-project?rev=69535&view=rev
Log:
This was supposed to get in in the previous commit.



Modified:
    vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=69535&r1=69534&r2=69535&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Sun Apr 19 14:28:34 2009
@@ -565,68 +565,9 @@
   }
 }
 
-bool UserCommonClass::implements(UserCommonClass* cl) {
-  if (this == cl) return true;
-  else {
-    for (uint16 i = 0; i < nbInterfaces; ++i) {
-      Class* I = interfaces[i];
-      if (I == cl) return true;
-      else if (I->implements(cl)) return true;
-    }
-    if (super) {
-      return super->implements(cl);
-    }
-  }
-  return false;
-}
-
-bool UserCommonClass::instantiationOfArray(UserClassArray* cl) {
-  if (this == cl) return true;
-  else {
-    if (isArray()) {
-      UserCommonClass* baseThis = ((UserClassArray*)this)->baseClass();
-      UserCommonClass* baseCl = ((UserClassArray*)cl)->baseClass();
-
-      if (baseThis->isInterface() && baseCl->isInterface()) {
-        return baseThis->implements(baseCl);
-      } else {
-        return baseThis->isAssignableFrom(baseCl);
-      }
-    }
-  }
-  return false;
-}
-
-bool UserCommonClass::subclassOf(UserCommonClass* cl) {
-  if (cl->depth <= depth) {
-    return display[cl->depth] == cl;
-  } else {
-    return false;
-  }
-}
-
 bool UserCommonClass::isAssignableFrom(UserCommonClass* cl) {
-  bool res = false;
-  if (this == cl) {
-    res = true;
-  } else if (cl->isInterface()) {
-    res = this->implements(cl);
-  } else if (cl->isArray()) {
-    res = this->instantiationOfArray((UserClassArray*)cl);
-  } else {
-    res = this->subclassOf(cl);
-  }
-  if(virtualVT && cl->virtualVT && res != virtualVT->isSubtypeOf(cl->virtualVT)) {
-    fprintf(stderr, "wrong result for %s and %s\n", printString(), cl->printString());
-    fprintf(stderr, "I have offset = %d\n", cl->virtualVT->offset);
-    fprintf(stderr, "I have secondary types = %d\n", virtualVT->nbSecondaryTypes);
-    fprintf(stderr, "I have secondary types = %s\n", virtualVT->secondaryTypes[0]->cl->printString());
-    fprintf(stderr, "I have secondary types = %d\n", virtualVT->secondaryTypes[0]->cl->super->virtualVT->nbSecondaryTypes);
-    fprintf(stderr, "I have secondary types = %s\n", virtualVT->secondaryTypes[0]->cl->super->printString());
-    fprintf(stderr, "I have secondary types = %d\n", virtualVT->secondaryTypes[0]->cl->nbInterfaces);
-    abort();
-  }
-  return res;
+  assert(virtualVT && cl->virtualVT);
+  return virtualVT->isSubtypeOf(cl->virtualVT);
 }
 
 bool JavaVirtualTable::isSubtypeOf(JavaVirtualTable* otherVT) {

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=69535&r1=69534&r2=69535&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Sun Apr 19 14:28:34 2009
@@ -302,21 +302,6 @@
   ///
   bool isOfTypeName(Jnjvm* vm, const UTF8* Tname);
 
-  /// implements - Does this class implement the given class? Returns true if
-  /// the class is in the interface class hierarchy.
-  ///
-  bool implements(CommonClass* cl);
-  
-  /// instantationOfArray - If this class is an array class, does its subclass
-  /// implements the given array class subclass?
-  ///
-  bool instantiationOfArray(ClassArray* cl);
-  
-  /// subclassOf - If this class is a regular class, is it a subclass of the
-  /// given class?
-  ///
-  bool subclassOf(CommonClass* cl);
-
   /// isAssignableFrom - Is this class assignable from the given class? The
   /// classes may be of any type.
   ///





More information about the vmkit-commits mailing list