[vmkit-commits] [vmkit] r78341 - in /vmkit/trunk/lib: JnJVM/Compiler/JITInfo.cpp JnJVM/Compiler/JavaAOTCompiler.cpp N3/VMCore/VMClass.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Aug 6 14:32:24 PDT 2009


Author: geoffray
Date: Thu Aug  6 16:32:24 2009
New Revision: 78341

URL: http://llvm.org/viewvc/llvm-project?rev=78341&view=rev
Log:
Move to new LLVM API.


Modified:
    vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp
    vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
    vmkit/trunk/lib/N3/VMCore/VMClass.cpp

Modified: vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp?rev=78341&r1=78340&r2=78341&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JITInfo.cpp Thu Aug  6 16:32:24 2009
@@ -44,7 +44,8 @@
     const StructType* structType = 0;
     JavaLLVMCompiler* Mod = 
       (JavaLLVMCompiler*)classDef->classLoader->getCompiler();
-    
+    LLVMContext& context = Mod->getLLVMModule()->getContext();
+
     if (classDef->super) {
       LLVMClassInfo* CLI = JavaLLVMCompiler::getClassInfo(classDef->super);
       const llvm::Type* Ty = CLI->getVirtualType()->getContainedType(0);
@@ -59,7 +60,7 @@
       }
     
     
-      structType = StructType::get(fields, false);
+      structType = StructType::get(context, fields, false);
       virtualType = PointerType::getUnqual(structType);
       sl = targetData->getStructLayout(structType);
     
@@ -91,6 +92,10 @@
   if (!staticType) {
     Class* cl = (Class*)classDef;
     std::vector<const llvm::Type*> fields;
+    
+    JavaLLVMCompiler* Mod = 
+      (JavaLLVMCompiler*)classDef->classLoader->getCompiler();
+    LLVMContext& context = Mod->getLLVMModule()->getContext();
 
     for (uint32 i = 0; i < classDef->nbStaticFields; ++i) {
       JavaField& field = classDef->staticFields[i];
@@ -100,7 +105,7 @@
       fields.push_back(LAI.llvmType);
     }
   
-    StructType* structType = StructType::get(fields, false);
+    StructType* structType = StructType::get(context, fields, false);
     staticType = PointerType::getUnqual(structType);
     const TargetData* targetData = JnjvmModule::TheTargetData;
     const StructLayout* sl = targetData->getStructLayout(structType);

Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp?rev=78341&r1=78340&r2=78341&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp Thu Aug  6 16:32:24 2009
@@ -291,7 +291,7 @@
         Elemts.push_back(JnjvmModule::JavaObjectType->getContainedType(0));
         Elemts.push_back(JnjvmModule::pointerSizeType);
         Elemts.push_back(ATy);
-        Ty = StructType::get(Elemts);
+        Ty = StructType::get(getLLVMModule()->getContext(), Elemts);
 
       } else {
         LLVMClassInfo* LCI = getClassInfo(cl->asClass());
@@ -1212,7 +1212,7 @@
 
   Elemts.push_back(ATy);
 
-  const StructType* STy = StructType::get(Elemts);
+  const StructType* STy = StructType::get(getLLVMModule()->getContext(), Elemts);
   
   std::vector<Constant*> Cts;
   Cts.push_back(CreateConstantForBaseObject(val->getClass()));
@@ -1245,7 +1245,8 @@
 
   Elemts.push_back(ATy);
 
-  const StructType* STy = StructType::get(Elemts);
+  const StructType* STy = StructType::get(getLLVMModule()->getContext(),
+                                          Elemts);
   
   std::vector<Constant*> Cts;
   Cts.push_back(ConstantInt::get(JnjvmModule::pointerSizeType, val->size));

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

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMClass.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VMClass.cpp Thu Aug  6 16:32:24 2009
@@ -287,7 +287,7 @@
     fields.push_back((*i)->signature->naturalType);
   }
 
-  cl->staticType = llvm::PointerType::getUnqual(llvm::StructType::get(fields, false));
+  cl->staticType = llvm::PointerType::getUnqual(llvm::StructType::get(vm->LLVMModule->getContext(), fields, false));
 
   VirtualTable* VT = CLIJit::makeVT(cl, true);
 
@@ -333,7 +333,7 @@
           const llvm::Type* type = (*i)->signature->naturalType;
           Elts.push_back(type);
         }
-        ResultTy = llvm::StructType::get(Elts);
+        ResultTy = llvm::StructType::get(vm->LLVMModule->getContext(), Elts);
       }
     } else if (super == MSCorlib::pEnum) {
       ResultTy = llvm::Type::Int32Ty; // TODO find max
@@ -347,7 +347,7 @@
         const llvm::Type* type = (*i)->signature->naturalType;
         Elts.push_back(type);
       }
-      ResultTy = llvm::PointerType::getUnqual(llvm::StructType::get(Elts));
+      ResultTy = llvm::PointerType::getUnqual(llvm::StructType::get(vm->LLVMModule->getContext(), Elts));
     }
   } else {
     ResultTy = VMObject::llvmType;
@@ -372,7 +372,7 @@
          e = virtualFields.end(); i!= e; ++i) {
       Elts.push_back((*i)->signature->naturalType);
     }
-    virtualType = llvm::PointerType::getUnqual(llvm::StructType::get(Elts)); 
+    virtualType = llvm::PointerType::getUnqual(llvm::StructType::get(vm->LLVMModule->getContext(), Elts)); 
   } else {
     virtualType = naturalType;
   }
@@ -386,7 +386,7 @@
   arrayFields.push_back(VMObject::llvmType->getContainedType(0));
   arrayFields.push_back(llvm::Type::Int32Ty);
   arrayFields.push_back(llvm::ArrayType::get(baseClass->naturalType, 0));
-  const llvm::Type* type = llvm::PointerType::getUnqual(llvm::StructType::get(arrayFields, false));
+  const llvm::Type* type = llvm::PointerType::getUnqual(llvm::StructType::get(vm->LLVMModule->getContext(), arrayFields, false));
   ((llvm::OpaqueType*)naturalType)->refineAbstractTypeTo(type);
   naturalType = type;
   virtualType = naturalType;





More information about the vmkit-commits mailing list