aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ExecutionEngine/RuntimeDyld.h
diff options
context:
space:
mode:
authorFilip Pizlo <fpizlo@apple.com>2013-05-21 20:24:07 +0000
committerFilip Pizlo <fpizlo@apple.com>2013-05-21 20:24:07 +0000
commita4ea4a72031809911d77f543eb65175e00fe914e (patch)
treec52901daaada23258b60c45f1dc37ffd036d10b7 /include/llvm/ExecutionEngine/RuntimeDyld.h
parent50f19a906a9d5e42d7707b54a11c0f0c9265fc1f (diff)
downloadexternal_llvm-a4ea4a72031809911d77f543eb65175e00fe914e.zip
external_llvm-a4ea4a72031809911d77f543eb65175e00fe914e.tar.gz
external_llvm-a4ea4a72031809911d77f543eb65175e00fe914e.tar.bz2
Put RTDyldMemoryManager into its own file, and make it linked into
libExecutionEngine. Move method implementations that aren't specific to allocation out of SectionMemoryManager and into RTDyldMemoryManager. This is in preparation for exposing RTDyldMemoryManager through the C API. This is a fixed version of r182407 and r182411. That first revision broke builds because I forgot to move the conditional includes of various POSIX headers from SectionMemoryManager into RTDyldMemoryManager. Those includes are necessary because of how getPointerToNamedFunction works around the glibc libc_nonshared.a thing. The latter revision still broke things because I forgot to include llvm/Config/config.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182418 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ExecutionEngine/RuntimeDyld.h')
-rw-r--r--include/llvm/ExecutionEngine/RuntimeDyld.h53
1 files changed, 1 insertions, 52 deletions
diff --git a/include/llvm/ExecutionEngine/RuntimeDyld.h b/include/llvm/ExecutionEngine/RuntimeDyld.h
index 7dba040..1a57317 100644
--- a/include/llvm/ExecutionEngine/RuntimeDyld.h
+++ b/include/llvm/ExecutionEngine/RuntimeDyld.h
@@ -16,6 +16,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ExecutionEngine/ObjectBuffer.h"
+#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
#include "llvm/Support/Memory.h"
namespace llvm {
@@ -23,58 +24,6 @@ namespace llvm {
class RuntimeDyldImpl;
class ObjectImage;
-// RuntimeDyld clients often want to handle the memory management of
-// what gets placed where. For JIT clients, this is the subset of
-// JITMemoryManager required for dynamic loading of binaries.
-//
-// FIXME: As the RuntimeDyld fills out, additional routines will be needed
-// for the varying types of objects to be allocated.
-class RTDyldMemoryManager {
- RTDyldMemoryManager(const RTDyldMemoryManager&) LLVM_DELETED_FUNCTION;
- void operator=(const RTDyldMemoryManager&) LLVM_DELETED_FUNCTION;
-public:
- RTDyldMemoryManager() {}
- virtual ~RTDyldMemoryManager();
-
- /// Allocate a memory block of (at least) the given size suitable for
- /// executable code. The SectionID is a unique identifier assigned by the JIT
- /// engine, and optionally recorded by the memory manager to access a loaded
- /// section.
- virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
- unsigned SectionID) = 0;
-
- /// Allocate a memory block of (at least) the given size suitable for data.
- /// The SectionID is a unique identifier assigned by the JIT engine, and
- /// optionally recorded by the memory manager to access a loaded section.
- virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
- unsigned SectionID, bool IsReadOnly) = 0;
-
- /// This method returns the address of the specified function. As such it is
- /// only useful for resolving library symbols, not code generated symbols.
- ///
- /// If AbortOnFailure is false and no function with the given name is
- /// found, this function returns a null pointer. Otherwise, it prints a
- /// message to stderr and aborts.
- virtual void *getPointerToNamedFunction(const std::string &Name,
- bool AbortOnFailure = true) = 0;
-
- /// This method is called when object loading is complete and section page
- /// permissions can be applied. It is up to the memory manager implementation
- /// to decide whether or not to act on this method. The memory manager will
- /// typically allocate all sections as read-write and then apply specific
- /// permissions when this method is called. Code sections cannot be executed
- /// until this function has been called. In addition, any cache coherency
- /// operations needed to reliably use the memory are also performed.
- ///
- /// Returns true if an error occurred, false otherwise.
- virtual bool finalizeMemory(std::string *ErrMsg = 0) = 0;
-
- /// Register the EH frames with the runtime so that c++ exceptions work. The
- /// default implementation does nothing. Look at SectionMemoryManager for one
- /// that uses __register_frame.
- virtual void registerEHFrames(StringRef SectionData);
-};
-
class RuntimeDyld {
RuntimeDyld(const RuntimeDyld &) LLVM_DELETED_FUNCTION;
void operator=(const RuntimeDyld &) LLVM_DELETED_FUNCTION;