[vmkit-commits] [vmkit] r84089 - /vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Wed Oct 14 04:47:32 PDT 2009
Author: geoffray
Date: Wed Oct 14 06:47:32 2009
New Revision: 84089
URL: http://llvm.org/viewvc/llvm-project?rev=84089&view=rev
Log:
Initialize MMTk fields with the JIT.
Modified:
vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
Modified: vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/JIT.cpp?rev=84089&r1=84088&r2=84089&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Wed Oct 14 06:47:32 2009
@@ -39,6 +39,7 @@
#include "mvm/Threads/Thread.h"
#include "mvm/VirtualMachine.h"
#include "mvm/GC/GC.h"
+#include "MutatorThread.h"
#include "MvmGC.h"
using namespace mvm;
@@ -92,7 +93,7 @@
InitializeNativeTarget();
executionEngine = ExecutionEngine::createJIT(globalModuleProvider, 0,
- 0, level);
+ 0, level, false);
std::string str =
executionEngine->getTargetData()->getStringRepresentation();
@@ -123,6 +124,42 @@
loadBytecodeFile(*i);
}
+#ifdef WITH_MMTK
+ llvm::GlobalVariable* GV = globalModule->getGlobalVariable("MMTkCollectorSize", false);
+ if (GV && executionEngine) {
+ ConstantInt* C = dyn_cast<ConstantInt>(GV->getInitializer());
+ uint64_t val = C->getZExtValue();
+ MutatorThread::MMTkCollectorSize = val;
+
+ GV = globalModule->getGlobalVariable("MMTkMutatorSize", false);
+ assert(GV && "Could not find MMTkMutatorSize");
+ C = dyn_cast<ConstantInt>(GV->getInitializer());
+ val = C->getZExtValue();
+ MutatorThread::MMTkMutatorSize = val;
+
+ Function* F = globalModule->getFunction("JnJVM_org_j3_config_Selected_00024Mutator__0003Cinit_0003E__");
+ assert(F && "Could not find <init> from Mutator");
+ MutatorThread::MutatorInit = (MutatorThread::MMTkInitType)
+ (uintptr_t)executionEngine->getPointerToFunction(F);
+
+ F = globalModule->getFunction("JnJVM_org_j3_config_Selected_00024Collector__0003Cinit_0003E__");
+ assert(F && "Could not find <init> from Collector");
+ MutatorThread::CollectorInit = (MutatorThread::MMTkInitType)
+ (uintptr_t)executionEngine->getPointerToFunction(F);
+
+ GlobalAlias* GA = dyn_cast<GlobalAlias>(globalModule->getNamedValue("MMTkAlloc"));
+ assert(GA && "Could not find MMTkAlloc alias");
+ F = dyn_cast<Function>(GA->getAliasee());
+ gc::MMTkGCAllocator = (gc::MMTkAllocType)
+ (uintptr_t)executionEngine->getPointerToFunction(F);
+
+ GA = dyn_cast<GlobalAlias>(globalModule->getNamedValue("MMTkPostAlloc"));
+ assert(GA && "Could not find MMTkPostAlloc alias");
+ F = dyn_cast<Function>(GA->getAliasee());
+ gc::MMTkGCPostAllocator = (gc::MMTkPostAllocType)
+ (uintptr_t)executionEngine->getPointerToFunction(F);
+ }
+#endif
}
More information about the vmkit-commits
mailing list