Skip to content

Commit

Permalink
Break out OrcError and RPC
Browse files Browse the repository at this point in the history
Summary:
When createing an ORC remote JIT target the current library split forces the target process to link large portions of LLVM (Core, Execution Engine, JITLink, Object, MC, Passes, RuntimeDyld, Support, Target, and TransformUtils). This occurs because the ORC RPC interfaces rely on the static globals the ORC Error types require, which starts a cycle of pulling in more and more.

This patch breaks the ORC RPC Error implementations out into an "OrcError" library which only depends on LLVM Support. It also pulls the ORC RPC headers into their own subdirectory.

With this patch code can include the Orc/RPC/*.h headers and will only incur link dependencies on LLVMOrcError and LLVMSupport.

Reviewers: lhames

Reviewed By: lhames

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68732
  • Loading branch information
llvm-beanz committed Oct 30, 2019
1 parent cbb3104 commit a34680a
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef LLVM_TOOLS_LLI_REMOTEJITUTILS_H
#define LLVM_TOOLS_LLI_REMOTEJITUTILS_H

#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h"
#include "llvm/Support/Error.h"
#include <cassert>
#include <cerrno>
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#define LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETRPCAPI_H

#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/ExecutionEngine/Orc/RPCUtils.h"
#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
#include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h"
#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h"

namespace llvm {
namespace orc {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===- llvm/ExecutionEngine/Orc/RPCSerialization.h --------------*- C++ -*-===//
//===- llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h --------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -9,7 +9,7 @@
#ifndef LLVM_EXECUTIONENGINE_ORC_RPCSERIALIZATION_H
#define LLVM_EXECUTIONENGINE_ORC_RPCSERIALIZATION_H

#include "OrcError.h"
#include "llvm/ExecutionEngine/Orc/OrcError.h"
#include "llvm/Support/thread.h"
#include <map>
#include <mutex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "llvm/ADT/STLExtras.h"
#include "llvm/ExecutionEngine/Orc/OrcError.h"
#include "llvm/ExecutionEngine/Orc/RPCSerialization.h"
#include "llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h"
#include "llvm/Support/MSVCErrorWorkarounds.h"

#include <future>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===- llvm/ExecutionEngine/Orc/RawByteChannel.h ----------------*- C++ -*-===//
//===- llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h ----------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -10,7 +10,7 @@
#define LLVM_EXECUTIONENGINE_ORC_RAWBYTECHANNEL_H

#include "llvm/ADT/StringRef.h"
#include "llvm/ExecutionEngine/Orc/RPCSerialization.h"
#include "llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include <cstdint>
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/ExecutionEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ endif()
add_subdirectory(Interpreter)
add_subdirectory(JITLink)
add_subdirectory(MCJIT)
add_subdirectory(OrcError)
add_subdirectory(Orc)
add_subdirectory(RuntimeDyld)

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ExecutionEngine/LLVMBuild.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

[common]
subdirectories = Interpreter MCJIT JITLink RuntimeDyld IntelJITEvents
OProfileJIT Orc PerfJITEvents
OProfileJIT Orc OrcError PerfJITEvents

[component_0]
type = Library
Expand Down
2 changes: 0 additions & 2 deletions llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ add_llvm_library(LLVMOrcJIT
ObjectTransformLayer.cpp
OrcABISupport.cpp
OrcCBindings.cpp
OrcError.cpp
OrcMCJITReplacement.cpp
RPCUtils.cpp
RTDyldObjectLinkingLayer.cpp
ThreadSafeModule.cpp
Speculation.cpp
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/ExecutionEngine/Orc/LLVMBuild.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
type = Library
name = OrcJIT
parent = ExecutionEngine
required_libraries = Core ExecutionEngine JITLink Object MC Passes RuntimeDyld
Support Target TransformUtils
required_libraries = Core ExecutionEngine JITLink Object OrcError MC Passes
RuntimeDyld Support Target TransformUtils
6 changes: 6 additions & 0 deletions llvm/lib/ExecutionEngine/OrcError/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
add_llvm_library(LLVMOrcError
OrcError.cpp
RPCError.cpp
ADDITIONAL_HEADER_DIRS
${LLVM_MAIN_INCLUDE_DIR}/llvm/ExecutionEngine/Orc
)
21 changes: 21 additions & 0 deletions llvm/lib/ExecutionEngine/OrcError/LLVMBuild.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
;===- ./lib/ExecutionEngine/OrcError/LLVMBuild.txt -------------*- Conf -*--===;
;
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
; See https://llvm.org/LICENSE.txt for license information.
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
;
;===------------------------------------------------------------------------===;
;
; This is an LLVMBuild description file for the components in this subdirectory.
;
; For more information on the LLVMBuild system, please see:
;
; http://llvm.org/docs/LLVMBuild.html
;
;===------------------------------------------------------------------------===;

[component_0]
type = Library
name = OrcError
parent = ExecutionEngine
required_libraries = Support
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//===--------------- RPCUtils.cpp - RPCUtils implementation ---------------===//
//===--------------- RPCError.cpp - RPCERror implementation ---------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// RPCUtils implementation.
// RPC Error type implmentations.
//
//===----------------------------------------------------------------------===//

#include "llvm/ExecutionEngine/Orc/RPCUtils.h"
#include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h"

char llvm::orc::rpc::RPCFatalError::ID = 0;
char llvm::orc::rpc::ConnectionClosed::ID = 0;
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/lli/RemoteJITUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef LLVM_TOOLS_LLI_REMOTEJITUTILS_H
#define LLVM_TOOLS_LLI_REMOTEJITUTILS_H

#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h"
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
#include <mutex>

Expand Down
2 changes: 1 addition & 1 deletion llvm/unittests/ExecutionEngine/Orc/QueueChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef LLVM_UNITTESTS_EXECUTIONENGINE_ORC_QUEUECHANNEL_H
#define LLVM_UNITTESTS_EXECUTIONENGINE_ORC_QUEUECHANNEL_H

#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h"
#include "llvm/Support/Error.h"

#include <atomic>
Expand Down
2 changes: 1 addition & 1 deletion llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "llvm/ExecutionEngine/Orc/RPCUtils.h"
#include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h"
#include "QueueChannel.h"
#include "gtest/gtest.h"

Expand Down

0 comments on commit a34680a

Please sign in to comment.