aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2009-02-18 08:31:02 +0000
committerNate Begeman <natebegeman@mac.com>2009-02-18 08:31:02 +0000
commit18d85e7403292bb548a30cf28b14773df5ce6c71 (patch)
tree14f058b74a1972455aba2349d12ac35749558569 /llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
parente08484daf29b6258bba47d45b5b8e34eb4f817b0 (diff)
downloadllvm-18d85e7403292bb548a30cf28b14773df5ce6c71.zip
llvm-18d85e7403292bb548a30cf28b14773df5ce6c71.tar.gz
llvm-18d85e7403292bb548a30cf28b14773df5ce6c71.tar.bz2
Add support to the JIT for true non-lazy operation. When a call to a function
that has not been JIT'd yet, the callee is put on a list of pending functions to JIT. The call is directed through a stub, which is updated with the address of the function after it has been JIT'd. A new interface for allocating and updating empty stubs is provided. Add support for removing the ModuleProvider the JIT was created with, which would otherwise invalidate the JIT's PassManager, which is initialized with the ModuleProvider's Module. Add support under a new ExecutionEngine flag for emitting the infomration necessary to update Function and GlobalVariable stubs after JITing them, by recording the address of the stub and the name of the GlobalValue. This allows code to be copied from one address space to another, where libraries may live at different virtual addresses, and have the stubs updated with their new correct target addresses. llvm-svn: 64906
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
index cc072a8..0dcc71f 100644
--- a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
@@ -258,6 +258,7 @@ namespace {
unsigned char *CurStubPtr, *StubBase;
unsigned char *GOTBase; // Target Specific reserved memory
+ void *DlsymTable; // Stub external symbol information
// Centralize memory block allocation.
sys::MemoryBlock getNewMemoryBlock(unsigned size);
@@ -269,7 +270,8 @@ namespace {
~DefaultJITMemoryManager();
void AllocateGOT();
-
+ void SetDlsymTable(void *);
+
unsigned char *allocateStub(const GlobalValue* F, unsigned StubSize,
unsigned Alignment);
@@ -343,6 +345,10 @@ namespace {
return GOTBase;
}
+ void *getDlsymTable() const {
+ return DlsymTable;
+ }
+
/// deallocateMemForFunction - Deallocate all memory for the specified
/// function body.
void deallocateMemForFunction(const Function *F) {
@@ -463,6 +469,7 @@ DefaultJITMemoryManager::DefaultJITMemoryManager() {
FreeMemoryList = Mem0;
GOTBase = NULL;
+ DlsymTable = NULL;
}
void DefaultJITMemoryManager::AllocateGOT() {
@@ -471,6 +478,9 @@ void DefaultJITMemoryManager::AllocateGOT() {
HasGOT = true;
}
+void DefaultJITMemoryManager::SetDlsymTable(void *ptr) {
+ DlsymTable = ptr;
+}
DefaultJITMemoryManager::~DefaultJITMemoryManager() {
for (unsigned i = 0, e = Blocks.size(); i != e; ++i)