[ORC] Add an asynchronous jit-link function, jitLinkForORC, to RuntimeDyld and
authorLang Hames <lhames@gmail.com>
Tue, 25 Sep 2018 22:57:44 +0000 (22:57 +0000)
committerLang Hames <lhames@gmail.com>
Tue, 25 Sep 2018 22:57:44 +0000 (22:57 +0000)
commitabeedf1812eeb33578b97bb975ddbf5da4ae933c
treeb83d194aa60258feb5e21c38c4fcfcd296fb5776
parentb794aec290269484481b0ce915f3c5f854a5783f
[ORC] Add an asynchronous jit-link function, jitLinkForORC, to RuntimeDyld and
switch RTDyldObjectLinkingLayer2 to use it.

RuntimeDyld::loadObject is currently a blocking operation. This means that any
JIT'd code whose call-graph contains an embedded complete K graph will require
at least K threads to link, which precludes the use of a fixed sized thread
pool for concurrent JITing of arbitrary code (whatever K the thread-pool is set
at, any code with a K+1 complete subgraph will deadlock at JIT-link time).

To address this issue, this commmit introduces a function called jitLinkForORC
that uses continuation-passing style to pass the fix-up and finalization steps
to the asynchronous symbol resolver interface so that linking can be performed
without blocking.

llvm-svn: 343043
llvm/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
llvm/include/llvm/ExecutionEngine/RuntimeDyld.h
llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h