llvm/unittests/ExecutionEngine
Lang Hames ab3dba86f9 [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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302589 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-09 21:32:18 +00:00
..
MCJIT Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
Orc [ExecutionEngine] Make RuntimeDyld::MemoryManager responsible for tracking EH 2017-05-09 21:32:18 +00:00
CMakeLists.txt [orc] Add a trivial unit test to get the ball rolling 2015-02-23 00:36:25 +00:00
ExecutionEngineTest.cpp Revert r279016 -- it breaks win32-elf JIT tests. 2016-08-18 01:33:28 +00:00