[vmkit-commits] [vmkit] r59132 - /vmkit/trunk/lib/Mvm/Runtime/JIT.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Wed Nov 12 06:12:12 PST 2008


Author: geoffray
Date: Wed Nov 12 08:11:59 2008
New Revision: 59132

URL: http://llvm.org/viewvc/llvm-project?rev=59132&view=rev
Log:
Correctly use the pointer type with the execution engine.


Modified:
    vmkit/trunk/lib/Mvm/Runtime/JIT.cpp

Modified: vmkit/trunk/lib/Mvm/Runtime/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/JIT.cpp?rev=59132&r1=59131&r2=59132&view=diff

==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/JIT.cpp Wed Nov 12 08:11:59 2008
@@ -60,9 +60,18 @@
   globalModuleProvider = new ExistingModuleProvider (globalModule);
   memoryManager = new MvmMemoryManager();
   
+
+
   executionEngine = ExecutionEngine::createJIT(globalModuleProvider, 0,
                                                memoryManager, Fast);
+  
+  std::string str = 
+    executionEngine->getTargetData()->getStringRepresentation();
+  globalModule->setDataLayout(str);
+
+  
   Module module("unused");
+  module.setDataLayout(str);
   mvm::llvm_runtime::makeLLVMModuleContents(&module);
   
   llvm_atomic_cmp_swap_i8 = (uint8 (*)(uint8*, uint8, uint8))
@@ -82,7 +91,8 @@
   ptrType = PointerType::getUnqual(Type::Int8Ty);
   ptr32Type = PointerType::getUnqual(Type::Int32Ty);
   ptrPtrType = PointerType::getUnqual(ptrType);
-  pointerSizeType = Type::Int32Ty;
+  pointerSizeType = module.getPointerSize() == llvm::Module::Pointer32 ?
+    Type::Int32Ty : Type::Int64Ty;
 
   // Constant declaration
   constantLongMinusOne = ConstantInt::get(Type::Int64Ty, (uint64_t)-1);
@@ -149,9 +159,9 @@
   unwindResume = module->getFunction("_Unwind_Resume_or_Rethrow");
   
   llvmGetException = module->getFunction("llvm.eh.exception");
-  exceptionSelector = sizeof(void*) == 4 ?
+  exceptionSelector = (getPointerSize() == llvm::Module::Pointer32 ?
                 module->getFunction("llvm.eh.selector.i32") : 
-                module->getFunction("llvm.eh.selector.i64");
+                module->getFunction("llvm.eh.selector.i64"));
   
   personality = module->getFunction("__gxx_personality_v0");
   exceptionEndCatch = module->getFunction("__cxa_end_catch");





More information about the vmkit-commits mailing list