mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +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
|
||||
//
|
||||
@ -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
|
||||
#define LLVM_EXECUTIONENGINE_ORC_OBJECTLINKINGLAYER_H
|
||||
#ifndef LLVM_EXECUTIONENGINE_ORC_RTDYLDOBJECTLINKINGLAYER_H
|
||||
#define LLVM_EXECUTIONENGINE_ORC_RTDYLDOBJECTLINKINGLAYER_H
|
||||
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
@ -35,7 +35,7 @@
|
||||
namespace llvm {
|
||||
namespace orc {
|
||||
|
||||
class ObjectLinkingLayerBase {
|
||||
class RTDyldObjectLinkingLayerBase {
|
||||
protected:
|
||||
/// @brief Holds a set of objects to be allocated/linked as a unit in the JIT.
|
||||
///
|
||||
@ -87,7 +87,7 @@ public:
|
||||
class DoNothingOnNotifyLoaded {
|
||||
public:
|
||||
template <typename ObjSetT, typename LoadResult>
|
||||
void operator()(ObjectLinkingLayerBase::ObjSetHandleT, const ObjSetT &,
|
||||
void operator()(RTDyldObjectLinkingLayerBase::ObjSetHandleT, const ObjSetT &,
|
||||
const LoadResult &) {}
|
||||
};
|
||||
|
||||
@ -98,7 +98,7 @@ public:
|
||||
/// symbols queried. All objects added to this layer can see each other's
|
||||
/// symbols.
|
||||
template <typename NotifyLoadedFtor = DoNothingOnNotifyLoaded>
|
||||
class ObjectLinkingLayer : public ObjectLinkingLayerBase {
|
||||
class RTDyldObjectLinkingLayer : public RTDyldObjectLinkingLayerBase {
|
||||
public:
|
||||
/// @brief Functor for receiving finalization notifications.
|
||||
typedef std::function<void(ObjSetHandleT)> NotifyFinalizedFtor;
|
||||
@ -227,7 +227,7 @@ public:
|
||||
|
||||
/// @brief Construct an ObjectLinkingLayer with the given NotifyLoaded,
|
||||
/// and NotifyFinalized functors.
|
||||
ObjectLinkingLayer(
|
||||
RTDyldObjectLinkingLayer(
|
||||
NotifyLoadedFtor NotifyLoaded = NotifyLoadedFtor(),
|
||||
NotifyFinalizedFtor NotifyFinalized = NotifyFinalizedFtor())
|
||||
: NotifyLoaded(std::move(NotifyLoaded)),
|
||||
@ -359,4 +359,4 @@ private:
|
||||
} // end namespace orc
|
||||
} // 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/ExecutionUtils.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/Support/Error.h"
|
||||
|
||||
@ -30,7 +30,7 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(TargetMachine, LLVMTargetMachineRef)
|
||||
class OrcCBindingsStack {
|
||||
public:
|
||||
typedef orc::JITCompileCallbackManager CompileCallbackMgr;
|
||||
typedef orc::ObjectLinkingLayer<> ObjLayerT;
|
||||
typedef orc::RTDyldObjectLinkingLayer<> ObjLayerT;
|
||||
typedef orc::IRCompileLayer<ObjLayerT> CompileLayerT;
|
||||
typedef orc::CompileOnDemandLayer<CompileLayerT, CompileCallbackMgr>
|
||||
CODLayerT;
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
|
||||
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.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/Mangler.h"
|
||||
#include "llvm/Object/Archive.h"
|
||||
@ -315,7 +315,7 @@ private:
|
||||
NotifyObjectLoadedT(OrcMCJITReplacement &M) : M(M) {}
|
||||
|
||||
template <typename ObjListT>
|
||||
void operator()(ObjectLinkingLayerBase::ObjSetHandleT H,
|
||||
void operator()(RTDyldObjectLinkingLayerBase::ObjSetHandleT H,
|
||||
const ObjListT &Objects,
|
||||
const LoadedObjInfoListT &Infos) const {
|
||||
M.UnfinalizedSections[H] = std::move(M.SectionsAllocatedSinceLastLoad);
|
||||
@ -344,7 +344,7 @@ private:
|
||||
public:
|
||||
NotifyFinalizedT(OrcMCJITReplacement &M) : M(M) {}
|
||||
|
||||
void operator()(ObjectLinkingLayerBase::ObjSetHandleT H) {
|
||||
void operator()(RTDyldObjectLinkingLayerBase::ObjSetHandleT H) {
|
||||
M.UnfinalizedSections.erase(H);
|
||||
}
|
||||
|
||||
@ -361,7 +361,7 @@ private:
|
||||
return MangledName;
|
||||
}
|
||||
|
||||
typedef ObjectLinkingLayer<NotifyObjectLoadedT> ObjectLayerT;
|
||||
typedef RTDyldObjectLinkingLayer<NotifyObjectLoadedT> ObjectLayerT;
|
||||
typedef IRCompileLayer<ObjectLayerT> CompileLayerT;
|
||||
typedef LazyEmittingLayer<CompileLayerT> LazyEmitLayerT;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
|
||||
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
|
||||
#include "llvm/ExecutionEngine/Orc/IRTransformLayer.h"
|
||||
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
|
||||
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
|
||||
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
|
||||
|
||||
namespace llvm {
|
||||
@ -30,7 +30,7 @@ class OrcLazyJIT {
|
||||
public:
|
||||
|
||||
typedef orc::JITCompileCallbackManager CompileCallbackMgr;
|
||||
typedef orc::ObjectLinkingLayer<> ObjLayerT;
|
||||
typedef orc::RTDyldObjectLinkingLayer<> ObjLayerT;
|
||||
typedef orc::IRCompileLayer<ObjLayerT> CompileLayerT;
|
||||
typedef std::function<std::unique_ptr<Module>(std::unique_ptr<Module>)>
|
||||
TransformFtor;
|
||||
|
@ -14,7 +14,7 @@ add_llvm_unittest(OrcJITTests
|
||||
IndirectionUtilsTest.cpp
|
||||
GlobalMappingLayerTest.cpp
|
||||
LazyEmittingLayerTest.cpp
|
||||
ObjectLinkingLayerTest.cpp
|
||||
RTDyldObjectLinkingLayerTest.cpp
|
||||
ObjectTransformLayerTest.cpp
|
||||
OrcCAPITest.cpp
|
||||
OrcTestCommon.cpp
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
|
||||
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.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/Object/ObjectFile.h"
|
||||
#include "gtest/gtest.h"
|
||||
@ -309,7 +309,7 @@ TEST(ObjectTransformLayerTest, Main) {
|
||||
};
|
||||
|
||||
// Construct the jit layers.
|
||||
ObjectLinkingLayer<> BaseLayer;
|
||||
RTDyldObjectLinkingLayer<> BaseLayer;
|
||||
auto IdentityTransform = [](
|
||||
std::unique_ptr<llvm::object::OwningBinary<llvm::object::ObjectFile>>
|
||||
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
|
||||
//
|
||||
@ -13,7 +13,7 @@
|
||||
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
|
||||
#include "llvm/ExecutionEngine/Orc/LambdaResolver.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/LLVMContext.h"
|
||||
#include "gtest/gtest.h"
|
||||
@ -23,8 +23,8 @@ using namespace llvm::orc;
|
||||
|
||||
namespace {
|
||||
|
||||
class ObjectLinkingLayerExecutionTest : public testing::Test,
|
||||
public OrcExecutionTest {
|
||||
class RTDyldObjectLinkingLayerExecutionTest : public testing::Test,
|
||||
public OrcExecutionTest {
|
||||
|
||||
};
|
||||
|
||||
@ -44,7 +44,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ObjectLinkingLayerTest, TestSetProcessAllSections) {
|
||||
TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
|
||||
class SectionMemoryManagerWrapper : public SectionMemoryManager {
|
||||
public:
|
||||
SectionMemoryManagerWrapper(bool &DebugSeen) : DebugSeen(DebugSeen) {}
|
||||
@ -63,7 +63,7 @@ TEST(ObjectLinkingLayerTest, TestSetProcessAllSections) {
|
||||
bool DebugSeen;
|
||||
};
|
||||
|
||||
ObjectLinkingLayer<> ObjLayer;
|
||||
RTDyldObjectLinkingLayer<> ObjLayer;
|
||||
|
||||
LLVMContext 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)
|
||||
return;
|
||||
|
||||
ObjectLinkingLayer<> ObjLayer;
|
||||
RTDyldObjectLinkingLayer<> ObjLayer;
|
||||
SimpleCompiler Compile(*TM);
|
||||
|
||||
// Create a pair of modules that will trigger recursive finalization:
|
||||
@ -183,11 +183,11 @@ TEST_F(ObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
|
||||
<< "Extra call to finalize";
|
||||
}
|
||||
|
||||
TEST_F(ObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
|
||||
TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
|
||||
if (!TM)
|
||||
return;
|
||||
|
||||
ObjectLinkingLayer<> ObjLayer;
|
||||
RTDyldObjectLinkingLayer<> ObjLayer;
|
||||
SimpleCompiler Compile(*TM);
|
||||
|
||||
// Create a pair of unrelated modules:
|
Loading…
x
Reference in New Issue
Block a user