mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[Orc] Rename ObjectLinkingLayer -> RTDyldObjectLinkingLayer.
The current ObjectLinkingLayer (now RTDyldObjectLinkingLayer) links objects in-process using MCJIT's RuntimeDyld class. In the near future I hope to add new object linking layers (e.g. a remote linking layer that links objects in the JIT target process, rather than the client), so I'm renaming this class to be more descriptive. llvm-svn: 295636
This commit is contained in:
parent
01c6dd61f1
commit
982396d819
@ -1,4 +1,4 @@
|
|||||||
//===- ObjectLinkingLayer.h - Add object files to a JIT process -*- C++ -*-===//
|
//===-- RTDyldObjectLinkingLayer.h - RTDyld-based jit linking --*- C++ -*-===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
@ -7,12 +7,12 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// Contains the definition for the object layer of the JIT.
|
// Contains the definition for an RTDyld-based, in-process object linking layer.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#ifndef LLVM_EXECUTIONENGINE_ORC_OBJECTLINKINGLAYER_H
|
#ifndef LLVM_EXECUTIONENGINE_ORC_RTDYLDOBJECTLINKINGLAYER_H
|
||||||
#define LLVM_EXECUTIONENGINE_ORC_OBJECTLINKINGLAYER_H
|
#define LLVM_EXECUTIONENGINE_ORC_RTDYLDOBJECTLINKINGLAYER_H
|
||||||
|
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/ADT/StringMap.h"
|
#include "llvm/ADT/StringMap.h"
|
||||||
@ -35,7 +35,7 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
namespace orc {
|
namespace orc {
|
||||||
|
|
||||||
class ObjectLinkingLayerBase {
|
class RTDyldObjectLinkingLayerBase {
|
||||||
protected:
|
protected:
|
||||||
/// @brief Holds a set of objects to be allocated/linked as a unit in the JIT.
|
/// @brief Holds a set of objects to be allocated/linked as a unit in the JIT.
|
||||||
///
|
///
|
||||||
@ -87,7 +87,7 @@ public:
|
|||||||
class DoNothingOnNotifyLoaded {
|
class DoNothingOnNotifyLoaded {
|
||||||
public:
|
public:
|
||||||
template <typename ObjSetT, typename LoadResult>
|
template <typename ObjSetT, typename LoadResult>
|
||||||
void operator()(ObjectLinkingLayerBase::ObjSetHandleT, const ObjSetT &,
|
void operator()(RTDyldObjectLinkingLayerBase::ObjSetHandleT, const ObjSetT &,
|
||||||
const LoadResult &) {}
|
const LoadResult &) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ public:
|
|||||||
/// symbols queried. All objects added to this layer can see each other's
|
/// symbols queried. All objects added to this layer can see each other's
|
||||||
/// symbols.
|
/// symbols.
|
||||||
template <typename NotifyLoadedFtor = DoNothingOnNotifyLoaded>
|
template <typename NotifyLoadedFtor = DoNothingOnNotifyLoaded>
|
||||||
class ObjectLinkingLayer : public ObjectLinkingLayerBase {
|
class RTDyldObjectLinkingLayer : public RTDyldObjectLinkingLayerBase {
|
||||||
public:
|
public:
|
||||||
/// @brief Functor for receiving finalization notifications.
|
/// @brief Functor for receiving finalization notifications.
|
||||||
typedef std::function<void(ObjSetHandleT)> NotifyFinalizedFtor;
|
typedef std::function<void(ObjSetHandleT)> NotifyFinalizedFtor;
|
||||||
@ -227,7 +227,7 @@ public:
|
|||||||
|
|
||||||
/// @brief Construct an ObjectLinkingLayer with the given NotifyLoaded,
|
/// @brief Construct an ObjectLinkingLayer with the given NotifyLoaded,
|
||||||
/// and NotifyFinalized functors.
|
/// and NotifyFinalized functors.
|
||||||
ObjectLinkingLayer(
|
RTDyldObjectLinkingLayer(
|
||||||
NotifyLoadedFtor NotifyLoaded = NotifyLoadedFtor(),
|
NotifyLoadedFtor NotifyLoaded = NotifyLoadedFtor(),
|
||||||
NotifyFinalizedFtor NotifyFinalized = NotifyFinalizedFtor())
|
NotifyFinalizedFtor NotifyFinalized = NotifyFinalizedFtor())
|
||||||
: NotifyLoaded(std::move(NotifyLoaded)),
|
: NotifyLoaded(std::move(NotifyLoaded)),
|
||||||
@ -359,4 +359,4 @@ private:
|
|||||||
} // end namespace orc
|
} // end namespace orc
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif // LLVM_EXECUTIONENGINE_ORC_OBJECTLINKINGLAYER_H
|
#endif // LLVM_EXECUTIONENGINE_ORC_RTDYLDOBJECTLINKINGLAYER_H
|
@ -16,7 +16,7 @@
|
|||||||
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
|
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
|
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
|
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
|
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
|
||||||
#include "llvm/IR/LLVMContext.h"
|
#include "llvm/IR/LLVMContext.h"
|
||||||
#include "llvm/Support/Error.h"
|
#include "llvm/Support/Error.h"
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(TargetMachine, LLVMTargetMachineRef)
|
|||||||
class OrcCBindingsStack {
|
class OrcCBindingsStack {
|
||||||
public:
|
public:
|
||||||
typedef orc::JITCompileCallbackManager CompileCallbackMgr;
|
typedef orc::JITCompileCallbackManager CompileCallbackMgr;
|
||||||
typedef orc::ObjectLinkingLayer<> ObjLayerT;
|
typedef orc::RTDyldObjectLinkingLayer<> ObjLayerT;
|
||||||
typedef orc::IRCompileLayer<ObjLayerT> CompileLayerT;
|
typedef orc::IRCompileLayer<ObjLayerT> CompileLayerT;
|
||||||
typedef orc::CompileOnDemandLayer<CompileLayerT, CompileCallbackMgr>
|
typedef orc::CompileOnDemandLayer<CompileLayerT, CompileCallbackMgr>
|
||||||
CODLayerT;
|
CODLayerT;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
|
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
|
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/LazyEmittingLayer.h"
|
#include "llvm/ExecutionEngine/Orc/LazyEmittingLayer.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
|
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
|
||||||
#include "llvm/IR/Function.h"
|
#include "llvm/IR/Function.h"
|
||||||
#include "llvm/IR/Mangler.h"
|
#include "llvm/IR/Mangler.h"
|
||||||
#include "llvm/Object/Archive.h"
|
#include "llvm/Object/Archive.h"
|
||||||
@ -315,7 +315,7 @@ private:
|
|||||||
NotifyObjectLoadedT(OrcMCJITReplacement &M) : M(M) {}
|
NotifyObjectLoadedT(OrcMCJITReplacement &M) : M(M) {}
|
||||||
|
|
||||||
template <typename ObjListT>
|
template <typename ObjListT>
|
||||||
void operator()(ObjectLinkingLayerBase::ObjSetHandleT H,
|
void operator()(RTDyldObjectLinkingLayerBase::ObjSetHandleT H,
|
||||||
const ObjListT &Objects,
|
const ObjListT &Objects,
|
||||||
const LoadedObjInfoListT &Infos) const {
|
const LoadedObjInfoListT &Infos) const {
|
||||||
M.UnfinalizedSections[H] = std::move(M.SectionsAllocatedSinceLastLoad);
|
M.UnfinalizedSections[H] = std::move(M.SectionsAllocatedSinceLastLoad);
|
||||||
@ -344,7 +344,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
NotifyFinalizedT(OrcMCJITReplacement &M) : M(M) {}
|
NotifyFinalizedT(OrcMCJITReplacement &M) : M(M) {}
|
||||||
|
|
||||||
void operator()(ObjectLinkingLayerBase::ObjSetHandleT H) {
|
void operator()(RTDyldObjectLinkingLayerBase::ObjSetHandleT H) {
|
||||||
M.UnfinalizedSections.erase(H);
|
M.UnfinalizedSections.erase(H);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ private:
|
|||||||
return MangledName;
|
return MangledName;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef ObjectLinkingLayer<NotifyObjectLoadedT> ObjectLayerT;
|
typedef RTDyldObjectLinkingLayer<NotifyObjectLoadedT> ObjectLayerT;
|
||||||
typedef IRCompileLayer<ObjectLayerT> CompileLayerT;
|
typedef IRCompileLayer<ObjectLayerT> CompileLayerT;
|
||||||
typedef LazyEmittingLayer<CompileLayerT> LazyEmitLayerT;
|
typedef LazyEmittingLayer<CompileLayerT> LazyEmitLayerT;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
|
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
|
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/IRTransformLayer.h"
|
#include "llvm/ExecutionEngine/Orc/IRTransformLayer.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
|
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
|
||||||
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
|
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -30,7 +30,7 @@ class OrcLazyJIT {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
typedef orc::JITCompileCallbackManager CompileCallbackMgr;
|
typedef orc::JITCompileCallbackManager CompileCallbackMgr;
|
||||||
typedef orc::ObjectLinkingLayer<> ObjLayerT;
|
typedef orc::RTDyldObjectLinkingLayer<> ObjLayerT;
|
||||||
typedef orc::IRCompileLayer<ObjLayerT> CompileLayerT;
|
typedef orc::IRCompileLayer<ObjLayerT> CompileLayerT;
|
||||||
typedef std::function<std::unique_ptr<Module>(std::unique_ptr<Module>)>
|
typedef std::function<std::unique_ptr<Module>(std::unique_ptr<Module>)>
|
||||||
TransformFtor;
|
TransformFtor;
|
||||||
|
@ -14,7 +14,7 @@ add_llvm_unittest(OrcJITTests
|
|||||||
IndirectionUtilsTest.cpp
|
IndirectionUtilsTest.cpp
|
||||||
GlobalMappingLayerTest.cpp
|
GlobalMappingLayerTest.cpp
|
||||||
LazyEmittingLayerTest.cpp
|
LazyEmittingLayerTest.cpp
|
||||||
ObjectLinkingLayerTest.cpp
|
RTDyldObjectLinkingLayerTest.cpp
|
||||||
ObjectTransformLayerTest.cpp
|
ObjectTransformLayerTest.cpp
|
||||||
OrcCAPITest.cpp
|
OrcCAPITest.cpp
|
||||||
OrcTestCommon.cpp
|
OrcTestCommon.cpp
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
|
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
|
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/NullResolver.h"
|
#include "llvm/ExecutionEngine/Orc/NullResolver.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
|
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/ObjectTransformLayer.h"
|
#include "llvm/ExecutionEngine/Orc/ObjectTransformLayer.h"
|
||||||
#include "llvm/Object/ObjectFile.h"
|
#include "llvm/Object/ObjectFile.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
@ -309,7 +309,7 @@ TEST(ObjectTransformLayerTest, Main) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Construct the jit layers.
|
// Construct the jit layers.
|
||||||
ObjectLinkingLayer<> BaseLayer;
|
RTDyldObjectLinkingLayer<> BaseLayer;
|
||||||
auto IdentityTransform = [](
|
auto IdentityTransform = [](
|
||||||
std::unique_ptr<llvm::object::OwningBinary<llvm::object::ObjectFile>>
|
std::unique_ptr<llvm::object::OwningBinary<llvm::object::ObjectFile>>
|
||||||
Obj) { return Obj; };
|
Obj) { return Obj; };
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//===-- ObjectLinkingLayerTest.cpp - Unit tests for object linking layer --===//
|
//===- RTDyldObjectLinkingLayerTest.cpp - RTDyld linking layer unit tests -===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
@ -13,7 +13,7 @@
|
|||||||
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
|
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/LambdaResolver.h"
|
#include "llvm/ExecutionEngine/Orc/LambdaResolver.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/NullResolver.h"
|
#include "llvm/ExecutionEngine/Orc/NullResolver.h"
|
||||||
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
|
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
|
||||||
#include "llvm/IR/Constants.h"
|
#include "llvm/IR/Constants.h"
|
||||||
#include "llvm/IR/LLVMContext.h"
|
#include "llvm/IR/LLVMContext.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
@ -23,8 +23,8 @@ using namespace llvm::orc;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class ObjectLinkingLayerExecutionTest : public testing::Test,
|
class RTDyldObjectLinkingLayerExecutionTest : public testing::Test,
|
||||||
public OrcExecutionTest {
|
public OrcExecutionTest {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(ObjectLinkingLayerTest, TestSetProcessAllSections) {
|
TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
|
||||||
class SectionMemoryManagerWrapper : public SectionMemoryManager {
|
class SectionMemoryManagerWrapper : public SectionMemoryManager {
|
||||||
public:
|
public:
|
||||||
SectionMemoryManagerWrapper(bool &DebugSeen) : DebugSeen(DebugSeen) {}
|
SectionMemoryManagerWrapper(bool &DebugSeen) : DebugSeen(DebugSeen) {}
|
||||||
@ -63,7 +63,7 @@ TEST(ObjectLinkingLayerTest, TestSetProcessAllSections) {
|
|||||||
bool DebugSeen;
|
bool DebugSeen;
|
||||||
};
|
};
|
||||||
|
|
||||||
ObjectLinkingLayer<> ObjLayer;
|
RTDyldObjectLinkingLayer<> ObjLayer;
|
||||||
|
|
||||||
LLVMContext Context;
|
LLVMContext Context;
|
||||||
auto M = llvm::make_unique<Module>("", Context);
|
auto M = llvm::make_unique<Module>("", Context);
|
||||||
@ -114,11 +114,11 @@ TEST(ObjectLinkingLayerTest, TestSetProcessAllSections) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
|
TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
|
||||||
if (!TM)
|
if (!TM)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ObjectLinkingLayer<> ObjLayer;
|
RTDyldObjectLinkingLayer<> ObjLayer;
|
||||||
SimpleCompiler Compile(*TM);
|
SimpleCompiler Compile(*TM);
|
||||||
|
|
||||||
// Create a pair of modules that will trigger recursive finalization:
|
// Create a pair of modules that will trigger recursive finalization:
|
||||||
@ -183,11 +183,11 @@ TEST_F(ObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
|
|||||||
<< "Extra call to finalize";
|
<< "Extra call to finalize";
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
|
TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
|
||||||
if (!TM)
|
if (!TM)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ObjectLinkingLayer<> ObjLayer;
|
RTDyldObjectLinkingLayer<> ObjLayer;
|
||||||
SimpleCompiler Compile(*TM);
|
SimpleCompiler Compile(*TM);
|
||||||
|
|
||||||
// Create a pair of unrelated modules:
|
// Create a pair of unrelated modules:
|
Loading…
x
Reference in New Issue
Block a user