diff options
author | Filip Pizlo <fpizlo@apple.com> | 2013-05-21 20:03:01 +0000 |
---|---|---|
committer | Filip Pizlo <fpizlo@apple.com> | 2013-05-21 20:03:01 +0000 |
commit | 1441bf7a41b50075cf761cbc794ce3fd0b5762fc (patch) | |
tree | 7fab8692dbd8b536525b99af03b9653a328e0b3a /include | |
parent | 52755c472a738e48a9687240368e4c1f78c45711 (diff) | |
download | llvm-1441bf7a41b50075cf761cbc794ce3fd0b5762fc.tar.gz |
Roll out r182407 and r182408 because they broke builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182409 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm-c/Core.h | 1 | ||||
-rw-r--r-- | include/llvm-c/ExecutionEngine.h | 28 | ||||
-rw-r--r-- | include/llvm/ExecutionEngine/RTDyldMemoryManager.h | 80 | ||||
-rw-r--r-- | include/llvm/ExecutionEngine/RuntimeDyld.h | 53 | ||||
-rw-r--r-- | include/llvm/ExecutionEngine/SectionMemoryManager.h | 11 |
5 files changed, 63 insertions, 110 deletions
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index 0920c5d0b0dc..6b62f33261ea 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -411,7 +411,6 @@ void LLVMShutdown(); /*===-- Error handling ----------------------------------------------------===*/ -char *LLVMCreateMessage(const char *Message); void LLVMDisposeMessage(char *Message); diff --git a/include/llvm-c/ExecutionEngine.h b/include/llvm-c/ExecutionEngine.h index 50fdb6bd7356..8fae77def443 100644 --- a/include/llvm-c/ExecutionEngine.h +++ b/include/llvm-c/ExecutionEngine.h @@ -40,14 +40,12 @@ void LLVMLinkInInterpreter(void); typedef struct LLVMOpaqueGenericValue *LLVMGenericValueRef; typedef struct LLVMOpaqueExecutionEngine *LLVMExecutionEngineRef; -typedef struct LLVMOpaqueMCJITMemoryManager *LLVMMCJITMemoryManagerRef; struct LLVMMCJITCompilerOptions { unsigned OptLevel; LLVMCodeModel CodeModel; LLVMBool NoFramePointerElim; LLVMBool EnableFastISel; - LLVMMCJITMemoryManagerRef MCJMM; }; /*===-- Operations on generic values --------------------------------------===*/ @@ -169,32 +167,6 @@ void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE, LLVMValueRef Global, void *LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE, LLVMValueRef Global); -/*===-- Operations on memory managers -------------------------------------===*/ - -/** - * Create a simple custom MCJIT memory manager. This memory manager can - * intercept allocations in a module-oblivious way. This will return NULL - * if any of the passed functions are NULL. - * - * @param Opaque An opaque client object to pass back to the callbacks. - * @param AllocateCodeSection Allocate a block of memory for executable code. - * @param AllocateDataSection Allocate a block of memory for data. - * @param FinalizeMemory Set page permissions and flush cache. Return 0 on - * success, 1 on error. - */ -LLVMMCJITMemoryManagerRef LLVMCreateSimpleMCJITMemoryManager( - void *Opaque, - uint8_t *(*AllocateCodeSection)(void *Opaque, - uintptr_t Size, unsigned Alignment, - unsigned SectionID), - uint8_t *(*AllocateDataSection)(void *Opaque, - uintptr_t Size, unsigned Alignment, - unsigned SectionID, LLVMBool IsReadOnly), - LLVMBool (*FinalizeMemory)(void *Opaque, char **ErrMsg), - void (*Destroy)(void *Opaque)); - -void LLVMDisposeMCJITMemoryManager(LLVMMCJITMemoryManagerRef MM); - /** * @} */ diff --git a/include/llvm/ExecutionEngine/RTDyldMemoryManager.h b/include/llvm/ExecutionEngine/RTDyldMemoryManager.h deleted file mode 100644 index 99e2594f3cc7..000000000000 --- a/include/llvm/ExecutionEngine/RTDyldMemoryManager.h +++ /dev/null @@ -1,80 +0,0 @@ -//===-- RTDyldMemoryManager.cpp - Memory manager for MC-JIT -----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Interface of the runtime dynamic memory manager base class. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_EXECUTIONENGINE_RT_DYLD_MEMORY_MANAGER_H -#define LLVM_EXECUTIONENGINE_RT_DYLD_MEMORY_MANAGER_H - -#include "llvm/ADT/StringRef.h" -#include "llvm/Support/CBindingWrapping.h" -#include "llvm/Support/Memory.h" -#include "llvm-c/ExecutionEngine.h" - -namespace llvm { - -// 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; - - /// Register the EH frames with the runtime so that c++ exceptions work. - virtual void registerEHFrames(StringRef SectionData); - - /// This method returns the address of the specified function. As such it is - /// only useful for resolving library symbols, not code generated symbols. - /// - /// If \p 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); - - /// 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; -}; - -// Create wrappers for C Binding types (see CBindingWrapping.h). -DEFINE_SIMPLE_CONVERSION_FUNCTIONS( - RTDyldMemoryManager, LLVMMCJITMemoryManagerRef) - -} // namespace llvm - -#endif // LLVM_EXECUTIONENGINE_RT_DYLD_MEMORY_MANAGER_H diff --git a/include/llvm/ExecutionEngine/RuntimeDyld.h b/include/llvm/ExecutionEngine/RuntimeDyld.h index 1a573171a457..7dba040961a2 100644 --- a/include/llvm/ExecutionEngine/RuntimeDyld.h +++ b/include/llvm/ExecutionEngine/RuntimeDyld.h @@ -16,7 +16,6 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ExecutionEngine/ObjectBuffer.h" -#include "llvm/ExecutionEngine/RTDyldMemoryManager.h" #include "llvm/Support/Memory.h" namespace llvm { @@ -24,6 +23,58 @@ 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; diff --git a/include/llvm/ExecutionEngine/SectionMemoryManager.h b/include/llvm/ExecutionEngine/SectionMemoryManager.h index 6ee2a2aae590..fc8dacfcc090 100644 --- a/include/llvm/ExecutionEngine/SectionMemoryManager.h +++ b/include/llvm/ExecutionEngine/SectionMemoryManager.h @@ -73,6 +73,17 @@ public: /// \returns true if an error occurred, false otherwise. virtual bool finalizeMemory(std::string *ErrMsg = 0); + void registerEHFrames(StringRef SectionData); + + /// This method returns the address of the specified function. As such it is + /// only useful for resolving library symbols, not code generated symbols. + /// + /// If \p 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); + /// \brief Invalidate instruction cache for code sections. /// /// Some platforms with separate data cache and instruction cache require |