X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FExecutionEngine%2FRuntimeDyld.h;fp=include%2Fllvm%2FExecutionEngine%2FRuntimeDyld.h;h=afd8de64913e5a10742beb79c576f4b10f8b3fcd;hp=385b8d0a30b16b7bdfdf19c41632cb586346b12a;hb=1a41a8ee7d262acbf2846d52a43ad91bc66cb9f2;hpb=cf3ea5921770bf8c58b07d7da418882897b905e3 diff --git a/include/llvm/ExecutionEngine/RuntimeDyld.h b/include/llvm/ExecutionEngine/RuntimeDyld.h index 385b8d0a30b..afd8de64913 100644 --- a/include/llvm/ExecutionEngine/RuntimeDyld.h +++ b/include/llvm/ExecutionEngine/RuntimeDyld.h @@ -95,7 +95,9 @@ public: /// \brief Memory Management. class MemoryManager { + friend class RuntimeDyld; public: + MemoryManager() : FinalizationLocked(false) {} virtual ~MemoryManager() {} /// Allocate a memory block of (at least) the given size suitable for @@ -153,6 +155,7 @@ public: private: virtual void anchor(); + bool FinalizationLocked; }; /// \brief Symbol resolution. @@ -241,6 +244,25 @@ public: this->ProcessAllSections = ProcessAllSections; } + /// Perform all actions needed to make the code owned by this RuntimeDyld + /// instance executable: + /// + /// 1) Apply relocations. + /// 2) Register EH frames. + /// 3) Update memory permissions*. + /// + /// * Finalization is potentially recursive**, and the 3rd step will only be + /// applied by the outermost call to finalize. This allows different + /// RuntimeDyld instances to share a memory manager without the innermost + /// finalization locking the memory and causing relocation fixup errors in + /// outer instances. + /// + /// ** Recursive finalization occurs when one RuntimeDyld instances needs the + /// address of a symbol owned by some other instance in order to apply + /// relocations. + /// + void finalizeWithMemoryManagerLocking(); + private: // RuntimeDyldImpl is the actual class. RuntimeDyld is just the public // interface.