[Orc] Add a method for ObjectLinkingLayer to return ownership of object buffers.
authorLang Hames <lhames@gmail.com>
Tue, 15 Oct 2019 21:41:12 +0000 (21:41 +0000)
committerLang Hames <lhames@gmail.com>
Tue, 15 Oct 2019 21:41:12 +0000 (21:41 +0000)
commita98546ebcd2a692e0634c5b1a7e77471316ab6e0
tree82d178f9a0f31edbd77f933a12bf6dce348de60b
parent75b991ebdf85f2a7a8914abbc2a1bbf2071ab786
[Orc] Add a method for ObjectLinkingLayer to return ownership of object buffers.

RTDyldObjectLinkingLayer allowed clients to register a NotifyEmitted function to
reclaim ownership of object buffers once they had been linked. This patch adds
similar functionality to ObjectLinkingLayer: Clients can now optionally call the
ObjectLinkingLayer::setReturnObjectBuffer method to register a function that
will be called when discarding object buffers. If set, this function will be
called to return ownership of the object regardless of whether the link
succeeded or failed.

Use cases for this function include debug dumping (it provides a way to dump
all objects linked into JIT'd code) and object re-use (e.g. storing an
object in a cache).

llvm-svn: 374951
llvm/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp