[llvm-commits] [llvm] r70517 - /llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Thu Apr 30 16:01:58 PDT 2009
Author: akirtzidis
Date: Thu Apr 30 18:01:58 2009
New Revision: 70517
URL: http://llvm.org/viewvc/llvm-project?rev=70517&view=rev
Log:
Set FnEnd in JITEmitter::finishFunction to point strictly to the end of function's machine code.
Don't include memory allocated for global variables during relocations resolution.
Modified:
llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=70517&r1=70516&r2=70517&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Apr 30 18:01:58 2009
@@ -1051,6 +1051,9 @@
unsigned char *FnStart =
(unsigned char *)TheJIT->getPointerToGlobalIfAvailable(F.getFunction());
+ // FnEnd is the end of the function's machine code.
+ unsigned char *FnEnd = CurBufferPtr;
+
if (!Relocations.empty()) {
CurFn = F.getFunction();
NumRelos += Relocations.size();
@@ -1128,9 +1131,9 @@
}
}
- unsigned char *FnEnd = CurBufferPtr;
-
- MemMgr->endFunctionBody(F.getFunction(), BufferBegin, FnEnd);
+ // CurBufferPtr may have moved beyond FnEnd, due to memory allocation for
+ // global variables that were referenced in the relocations.
+ MemMgr->endFunctionBody(F.getFunction(), BufferBegin, CurBufferPtr);
if (CurBufferPtr == BufferEnd) {
// FIXME: Allocate more space, then try again.
More information about the llvm-commits
mailing list