llvm-project/llvm/lib/ExecutionEngine/Orc
Lang Hames c936ac7f37 [ExecutionEngine] Make RuntimeDyld::MemoryManager responsible for tracking EH
frames.

RuntimeDyld was previously responsible for tracking allocated EH frames, but it
makes more sense to have the RuntimeDyld::MemoryManager track them (since the
frames are allocated through the memory manager, and written to memory owned by
the memory manager). This patch moves the frame tracking into
RTDyldMemoryManager, and changes the deregisterFrames method on
RuntimeDyld::MemoryManager from:

void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size);

to:

void deregisterEHFrames();

Separating this responsibility will allow ORC to continue to throw the
RuntimeDyld instances away post-link (saving a few dozen bytes per lazy
function) while properly deregistering frames when modules are unloaded.

This patch also updates ORC to call deregisterEHFrames when modules are
unloaded. This fixes a bug where an exception that tears down the JIT can then
unwind through dangling EH frames that have been deallocated but not
deregistered, resulting in UB.

For people using SectionMemoryManager this should be pretty much a no-op. For
people with custom allocators that override registerEHFrames/deregisterEHFrames,
you will now be responsible for tracking allocated EH frames.

Reviewed in https://reviews.llvm.org/D32829

llvm-svn: 302589
2017-05-09 21:32:18 +00:00
..
CMakeLists.txt [ORC] Use native Errors rather than converted std::error_codes for ORC RPC. 2017-04-13 01:03:06 +00:00
ExecutionUtils.cpp
IndirectionUtils.cpp [ORC] Clone module flags metadata into the globals module in the 2016-09-04 17:53:30 +00:00
LLVMBuild.txt
NullResolver.cpp [ExecutionEngine][MCJIT][Orc] Replace RuntimeDyld::SymbolInfo with JITSymbol. 2016-08-01 20:49:11 +00:00
OrcABISupport.cpp [Orc] Rename OrcArchitectureSupport to OrcABISupport and add Win32 ABI support. 2016-05-07 03:36:38 +00:00
OrcCBindings.cpp [Orc] Merge some common code for creating CompileCallbackManagers and 2016-05-26 17:20:35 +00:00
OrcCBindingsStack.h [Orc] Rename ObjectLinkingLayer -> RTDyldObjectLinkingLayer. 2017-02-20 05:45:14 +00:00
OrcError.cpp [ORC] Add RPC and serialization support for Errors and Expecteds. 2017-04-13 03:51:35 +00:00
OrcMCJITReplacement.cpp
OrcMCJITReplacement.h [ExecutionEngine] Make RuntimeDyld::MemoryManager responsible for tracking EH 2017-05-09 21:32:18 +00:00
RPCUtils.cpp [ORC] Add missing file from r300155. 2017-04-13 01:06:45 +00:00