diff options
| author | Argiris Kirtzidis <akyrtzi@gmail.com> | 2009-04-30 23:01:58 +0000 |
|---|---|---|
| committer | Argiris Kirtzidis <akyrtzi@gmail.com> | 2009-04-30 23:01:58 +0000 |
| commit | b9e97bc4237a7e307f87f3937ec1166c2134fe2a (patch) | |
| tree | 5881507ec613b2b8ec6a141be009c837048136bc /lib/ExecutionEngine | |
| parent | 7ebb6ac102ed5ced799bf7b42b517ab48c896622 (diff) | |
| download | external_llvm-b9e97bc4237a7e307f87f3937ec1166c2134fe2a.zip external_llvm-b9e97bc4237a7e307f87f3937ec1166c2134fe2a.tar.gz external_llvm-b9e97bc4237a7e307f87f3937ec1166c2134fe2a.tar.bz2 | |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70517 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
| -rw-r--r-- | lib/ExecutionEngine/JIT/JITEmitter.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp index afb89e7..7356df4 100644 --- a/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -1051,6 +1051,9 @@ bool JITEmitter::finishFunction(MachineFunction &F) { 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 @@ bool JITEmitter::finishFunction(MachineFunction &F) { } } - 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. |
