summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-08-29 00:54:29 +0000
committerLang Hames <lhames@gmail.com>2016-08-29 00:54:29 +0000
commit6b21751ba9f40dcc553b0d48033edec0f44ef32c (patch)
tree66ece2f0dff487d9e17899d2b3677a9c32752f63 /llvm/unittests/ExecutionEngine
parent850feaf3b7d9e8ce60a2148a266fda20d9dc96c8 (diff)
downloadbcm5719-llvm-6b21751ba9f40dcc553b0d48033edec0f44ef32c.tar.gz
bcm5719-llvm-6b21751ba9f40dcc553b0d48033edec0f44ef32c.zip
[Orc] Simplify LogicalDylib and move it back inside CompileOnDemandLayer. Also
switch to using one indirect stub manager per logical dylib rather than one per input module. LogicalDylib is a helper class used by the CompileOnDemandLayer to manage symbol resolution between modules during lazy compilation. In particular, it ensures that internal symbols resolve correctly even in the case where multiple input modules contain the same internal symbol name (which must to be promoted to external hidden linkage so that functions in any given module can be split out by lazy compilation). LogicalDylib's resolution scheme (before this commit) required one stub-manager per input module. This made recompilation of functions (by adding a module containing a new definition) difficult, as the stub manager for any given symbol was bound to the module that supplied the original definition. By using one stubs manager for the whole logical dylib symbols can be more easily replaced, although support for doing this is not included in this patch (it will be implemented in a follow up). llvm-svn: 279952
Diffstat (limited to 'llvm/unittests/ExecutionEngine')
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt1
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/LogicalDylibTest.cpp76
2 files changed, 0 insertions, 77 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt b/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
index 3f155d3549c..68f6d0c28d7 100644
--- a/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
+++ b/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
@@ -14,7 +14,6 @@ add_llvm_unittest(OrcJITTests
IndirectionUtilsTest.cpp
GlobalMappingLayerTest.cpp
LazyEmittingLayerTest.cpp
- LogicalDylibTest.cpp
ObjectLinkingLayerTest.cpp
ObjectTransformLayerTest.cpp
OrcCAPITest.cpp
diff --git a/llvm/unittests/ExecutionEngine/Orc/LogicalDylibTest.cpp b/llvm/unittests/ExecutionEngine/Orc/LogicalDylibTest.cpp
deleted file mode 100644
index 4eed64ea7e7..00000000000
--- a/llvm/unittests/ExecutionEngine/Orc/LogicalDylibTest.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-//===----- CompileOnDemandLayerTest.cpp - Unit tests for the COD layer ----===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "OrcTestCommon.h"
-#include "llvm/ExecutionEngine/Orc/LogicalDylib.h"
-#include "gtest/gtest.h"
-
-using namespace llvm;
-using namespace llvm::orc;
-
-namespace {
-
-
-TEST(LogicalDylibTest, getLogicalModuleResourcesForSymbol) {
-
- std::map<int, std::set<std::string>> ModuleSymbols;
-
- ModuleSymbols[0] = std::set<std::string>({ "foo", "dummy" });
- ModuleSymbols[1] = std::set<std::string>({ "bar" });
- ModuleSymbols[2] = std::set<std::string>({ "baz", "dummy" });
-
- auto MockBaseLayer = createMockBaseLayer<int>(
- DoNothingAndReturn<int>(0),
- DoNothingAndReturn<void>(),
- [&](const std::string &Name, bool) {
- for (auto &S : ModuleSymbols)
- if (S.second.count(Name))
- return JITSymbol(1, JITSymbolFlags::Exported);
- return JITSymbol(nullptr);
- },
- [&](int H, const std::string &Name, bool) {
- if (ModuleSymbols[H].count(Name))
- return JITSymbol(1, JITSymbolFlags::Exported);
- return JITSymbol(nullptr);
- });
-
- struct LDResources { };
- struct LMResources {
- public:
- int ID;
- std::set<std::string> *Symbols;
-
- LMResources() : ID(0), Symbols(nullptr) {}
- LMResources(int ID, std::set<std::string> &Symbols)
- : ID(ID), Symbols(&Symbols) {}
-
- JITSymbol findSymbol(const std::string &Name, bool) {
- assert(Symbols);
- if (Symbols->count(Name))
- return JITSymbol(ID, JITSymbolFlags::Exported);
- return JITSymbol(nullptr);
- }
- };
-
- LogicalDylib<decltype(MockBaseLayer), LMResources, LDResources>
- LD(MockBaseLayer);
-
- // Add logical module resources for each of our dummy modules.
- for (int I = 0; I < 3; ++I) {
- auto H = LD.createLogicalModule();
- LD.addToLogicalModule(H, I);
- LD.getLogicalModuleResources(H) = LMResources(I, ModuleSymbols[I]);
- }
-
- {
- auto LMR = LD.getLogicalModuleResourcesForSymbol("bar", true);
- EXPECT_TRUE(LMR->ID == 1) << "getLogicalModuleResourcesForSymbol failed";
- }
-}
-}
OpenPOWER on IntegriCloud