diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-03-29 23:23:59 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-03-29 23:23:59 +0000 |
commit | 288967dfac246c8e35dc4f85afb667e74d1d26a8 (patch) | |
tree | 7dd4eef16e2e567d38180a3dbdbc01f5e9be3b0c /lib/ExecutionEngine/MCJIT | |
parent | 7a4c071cd9f67599eba21e902079d0e85f2abf97 (diff) | |
download | llvm-288967dfac246c8e35dc4f85afb667e74d1d26a8.tar.gz llvm-288967dfac246c8e35dc4f85afb667e74d1d26a8.tar.bz2 llvm-288967dfac246c8e35dc4f85afb667e74d1d26a8.tar.xz |
Revert r153694. It was causing failures in the buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153701 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/MCJIT')
-rw-r--r-- | lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h b/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h index a68949aa41..118b0d42ee 100644 --- a/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h +++ b/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h @@ -34,12 +34,12 @@ public: uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) { - return JMM->allocateSpace(Size, Alignment); + return JMM->allocateDataSection(Size, Alignment, SectionID); } uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) { - return JMM->allocateSpace(Size, Alignment); + return JMM->allocateCodeSection(Size, Alignment, SectionID); } virtual void *getPointerToNamedFunction(const std::string &Name, @@ -47,6 +47,40 @@ public: return JMM->getPointerToNamedFunction(Name, AbortOnFailure); } + // Allocate ActualSize bytes, or more, for the named function. Return + // a pointer to the allocated memory and update Size to reflect how much + // memory was acutally allocated. + uint8_t *startFunctionBody(const char *Name, uintptr_t &Size) { + // FIXME: This should really reference the MCAsmInfo to get the global + // prefix. + if (Name[0] == '_') ++Name; + Function *F = M->getFunction(Name); + // Some ObjC names have a prefixed \01 in the IR. If we failed to find + // the symbol and it's of the ObjC conventions (starts with "-" or + // "+"), try prepending a \01 and see if we can find it that way. + if (!F && (Name[0] == '-' || Name[0] == '+')) + F = M->getFunction((Twine("\1") + Name).str()); + assert(F && "No matching function in JIT IR Module!"); + return JMM->startFunctionBody(F, Size); + } + + // Mark the end of the function, including how much of the allocated + // memory was actually used. + void endFunctionBody(const char *Name, uint8_t *FunctionStart, + uint8_t *FunctionEnd) { + // FIXME: This should really reference the MCAsmInfo to get the global + // prefix. + if (Name[0] == '_') ++Name; + Function *F = M->getFunction(Name); + // Some ObjC names have a prefixed \01 in the IR. If we failed to find + // the symbol and it's of the ObjC conventions (starts with "-" or + // "+"), try prepending a \01 and see if we can find it that way. + if (!F && (Name[0] == '-' || Name[0] == '+')) + F = M->getFunction((Twine("\1") + Name).str()); + assert(F && "No matching function in JIT IR Module!"); + JMM->endFunctionBody(F, FunctionStart, FunctionEnd); + } + }; } // End llvm namespace |