[vmkit-commits] [vmkit] r94877 - in /vmkit/trunk: Makefile.common.in lib/J3/VMCore/JavaClass.h lib/J3/VMCore/JavaTypes.h lib/N3/VMCore/Assembly.cpp lib/N3/VMCore/CLIJit.cpp lib/N3/VMCore/VMClass.cpp tools/vmjc/vmjc.cpp tools/vmkit/Launcher.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sat Jan 30 01:16:34 PST 2010


Author: geoffray
Date: Sat Jan 30 03:16:33 2010
New Revision: 94877

URL: http://llvm.org/viewvc/llvm-project?rev=94877&view=rev
Log:
Remove all dynamic_cast and make N3 compile again.


Modified:
    vmkit/trunk/Makefile.common.in
    vmkit/trunk/lib/J3/VMCore/JavaClass.h
    vmkit/trunk/lib/J3/VMCore/JavaTypes.h
    vmkit/trunk/lib/N3/VMCore/Assembly.cpp
    vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
    vmkit/trunk/lib/N3/VMCore/VMClass.cpp
    vmkit/trunk/tools/vmjc/vmjc.cpp
    vmkit/trunk/tools/vmkit/Launcher.cpp

Modified: vmkit/trunk/Makefile.common.in
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.common.in?rev=94877&r1=94876&r2=94877&view=diff

==============================================================================
--- vmkit/trunk/Makefile.common.in (original)
+++ vmkit/trunk/Makefile.common.in Sat Jan 30 03:16:33 2010
@@ -23,7 +23,7 @@
 # Include LLVM's Master Makefile.
 include $(LLVM_OBJ_ROOT)/Makefile.common
 
-CXX.Flags += @LLVM_FLAGS@ @GC_FLAGS@ @VM_FLAGS@ @EXCEPTION_FLAGS@ -Wno-variadic-macros -fno-omit-frame-pointer -fno-strict-aliasing -Wno-deprecated -ansi -DENABLE_THREADS
+CXX.Flags += @LLVM_FLAGS@ @GC_FLAGS@ @VM_FLAGS@ @EXCEPTION_FLAGS@ -Wno-variadic-macros -fno-omit-frame-pointer -fno-strict-aliasing -Wno-deprecated -ansi -DENABLE_THREADS -fno-rtti
 
 # GNU Classpath flags
 CLASSPATH_FLAGS = @classpathinclude@

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

==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.h Sat Jan 30 03:16:33 2010
@@ -738,8 +738,6 @@
       JInfo = new(classLoader->allocator, "Class JIT info") Ty(this);
     }   
 
-    assert((void*)dynamic_cast<Ty*>(JInfo) == (void*)JInfo &&
-           "Invalid concrete type or multiple inheritence for getInfo");
     return static_cast<Ty*>(JInfo);
   }
   
@@ -1234,8 +1232,6 @@
       JInfo = new(classDef->classLoader->allocator, "Method JIT info") Ty(this);
     }   
 
-    assert((void*)dynamic_cast<Ty*>(JInfo) == (void*)JInfo &&
-           "Invalid concrete type or multiple inheritence for getInfo");
     return static_cast<Ty*>(JInfo);
   }
   
@@ -1367,8 +1363,6 @@
       JInfo = new(classDef->classLoader->allocator, "Field JIT info") Ty(this);
     }   
 
-    assert((void*)dynamic_cast<Ty*>(JInfo) == (void*)JInfo &&
-           "Invalid concrete type or multiple inheritence for getInfo");
     return static_cast<Ty*>(JInfo);
   }
   

Modified: vmkit/trunk/lib/J3/VMCore/JavaTypes.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaTypes.h?rev=94877&r1=94876&r2=94877&view=diff

==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaTypes.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaTypes.h Sat Jan 30 03:16:33 2010
@@ -381,8 +381,6 @@
       JInfo = new(initialLoader->allocator, "Sign info") Ty(this);
     }   
 
-    assert((void*)dynamic_cast<Ty*>(JInfo) == (void*)JInfo &&
-           "Invalid concrete type or multiple inheritence for getInfo");
     return static_cast<Ty*>(JInfo);
   }
   

Modified: vmkit/trunk/lib/N3/VMCore/Assembly.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Assembly.cpp?rev=94877&r1=94876&r2=94877&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/Assembly.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/Assembly.cpp Sat Jan 30 03:16:33 2010
@@ -1202,7 +1202,7 @@
   Table* methodTable  = CLIHeader->tables[CONSTANT_MethodDef];
   uint32 methodSize   = methodTable->rowsNumber;
   
-  getProperties(cl, dynamic_cast<VMGenericClass*>(cl), genMethod);
+  getProperties(cl, static_cast<VMGenericClass*>(cl), genMethod);
 
   if (methodList && methodTable != 0 && methodList <= methodSize) {
     uint32 endMethod = (index == typeSize) ? 
@@ -1213,7 +1213,7 @@
     uint32 nbMethods = endMethod - methodList;
 
     for (uint32 i = 0; i < nbMethods; ++i) {
-      VMMethod* meth = readMethodDef(i + methodList, cl, NULL, dynamic_cast<VMGenericClass*>(cl));
+      VMMethod* meth = readMethodDef(i + methodList, cl, NULL, static_cast<VMGenericClass*>(cl));
       
       if (meth != NULL) {
         if (isStatic(meth->flags)) {
@@ -1233,7 +1233,7 @@
     uint32 nbFields = endField - fieldList;
 
     for (uint32 i = 0; i < nbFields; ++i) {
-      VMField* field = readField(i + fieldList, cl, dynamic_cast<VMGenericClass*>(cl), genMethod);
+      VMField* field = readField(i + fieldList, cl, static_cast<VMGenericClass*>(cl), genMethod);
       if (isStatic(field->flags)) {
         cl->staticFields.push_back(field);
       } else {
@@ -1396,7 +1396,7 @@
   offset = blobOffset + signature;
   
   meth->virt = extractMethodSignature(offset, cl, meth->parameters, genClass, 
-      dynamic_cast<VMGenericMethod*> (meth));
+      static_cast<VMGenericMethod*> (meth));
   
   meth->flags = flags;
   meth->implFlags = implFlags;
@@ -1647,7 +1647,7 @@
 
   uint32 offset = blobOffset + memberArray[CONSTANT_MEMBERREF_SIGNATURE];
 
-  VMGenericClass* genericClass = dynamic_cast<VMGenericClass*> (type);
+  VMGenericClass* genericClass = static_cast<VMGenericClass*> (type);
 
   if (genericClass) {
     VMCommonClass* signature = extractFieldSignature(offset, genericClass,
@@ -1739,7 +1739,7 @@
   VMMethod *meth = NULL;
   
   if (genArgs != NULL) {
-    VMClass* cl = dynamic_cast<VMClass*> (type);
+    VMClass* cl = static_cast<VMClass*> (type);
 
     if (cl == NULL) {
       VMThread::get()->getVM()->error(
@@ -1810,7 +1810,7 @@
     case 4: {
       VMClass* type = (VMClass*) readTypeSpec(vm, index, genClass, genMethod);
         
-      VMGenericClass* genClass = dynamic_cast<VMGenericClass*> (type);
+      VMGenericClass* genClass = static_cast<VMGenericClass*> (type);
   
       if (genClass) {
         type->resolveType(false, false, genMethod);

Modified: vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJit.cpp?rev=94877&r1=94876&r2=94877&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJit.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJit.cpp Sat Jan 30 03:16:33 2010
@@ -490,7 +490,7 @@
   jit->inlineMethods = inlineMethods;
   jit->inlineMethods[meth] = true;
   Instruction* ret = jit->inlineCompile(llvmFunction, currentBlock, 
-                                        currentExceptionBlock, args, dynamic_cast<VMGenericClass*>(jit->compilingClass), genMethod);
+                                        currentExceptionBlock, args, static_cast<VMGenericClass*>(jit->compilingClass), genMethod);
   inlineMethods[meth] = false;
 
 	delete a;
@@ -1480,14 +1480,14 @@
   jit->compilingMethod = meth;
   jit->module = cl->vm->module;
   Function* func;
-  meth->getSignature(dynamic_cast<VMGenericMethod*>(meth));
+  meth->getSignature(static_cast<VMGenericMethod*>(meth));
   
   if (isInternal(meth->implFlags)) {
-    func = jit->compileNative(dynamic_cast<VMGenericMethod*>(meth));
+    func = jit->compileNative(static_cast<VMGenericMethod*>(meth));
   } else if (meth->offsetInTextSection == 0) {
     func = jit->compileIntern();
   } else {
-    func = jit->compileFatOrTiny(dynamic_cast<VMGenericClass*>(cl), dynamic_cast<VMGenericMethod*>(meth));
+    func = jit->compileFatOrTiny(static_cast<VMGenericClass*>(cl), static_cast<VMGenericMethod*>(meth));
   }
 
 	delete a;

Modified: vmkit/trunk/lib/N3/VMCore/VMClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMClass.cpp?rev=94877&r1=94876&r2=94877&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMClass.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VMClass.cpp Sat Jan 30 03:16:33 2010
@@ -492,7 +492,7 @@
 
 void VMCommonClass::resolveType(bool stat, bool clinit, VMGenericMethod* genMethod) {
 	//	printf("Resolve type: %s %d %d\n", mvm::PrintBuffer::objectToString(this), stat, clinit);
-  resolveVirtual(dynamic_cast<VMGenericClass*>(this), genMethod);
+  resolveVirtual(static_cast<VMGenericClass*>(this), genMethod);
   if (stat) resolveStatic(clinit, genMethod);
 }
 

Modified: vmkit/trunk/tools/vmjc/vmjc.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/vmjc/vmjc.cpp?rev=94877&r1=94876&r2=94877&view=diff

==============================================================================
--- vmkit/trunk/tools/vmjc/vmjc.cpp (original)
+++ vmkit/trunk/tools/vmjc/vmjc.cpp Sat Jan 30 03:16:33 2010
@@ -153,7 +153,7 @@
       errs() << argv[0] << ": cannot create pass: "
            << PassInf->getPassName() << "\n";
     if (P) {
-        bool isModulePass = dynamic_cast<ModulePass*>(P) != 0;
+        bool isModulePass = (P->getPassKind() == PT_Module);
         if (isModulePass) 
           errs() << argv[0] << ": vmkit does not support module pass: "
              << PassInf->getPassName() << "\n";

Modified: vmkit/trunk/tools/vmkit/Launcher.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/vmkit/Launcher.cpp?rev=94877&r1=94876&r2=94877&view=diff

==============================================================================
--- vmkit/trunk/tools/vmkit/Launcher.cpp (original)
+++ vmkit/trunk/tools/vmkit/Launcher.cpp Sat Jan 30 03:16:33 2010
@@ -94,7 +94,7 @@
       errs() << argv[0] << ": cannot create pass: "
            << PassInf->getPassName() << "\n";
     if (P) {
-        bool isModulePass = dynamic_cast<ModulePass*>(P) != 0;
+        bool isModulePass = (P->getPassKind() == PT_Module);
         if (isModulePass) 
           errs() << argv[0] << ": vmkit does not support module pass: "
              << PassInf->getPassName() << "\n";





More information about the vmkit-commits mailing list