Skip to content

Revert "[Clang-Repl] Add support for out-of-process execution." #115854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions clang/include/clang/Interpreter/Interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "llvm/ADT/DenseMap.h"
#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/ExecutionEngine/Orc/ExecutorProcessControl.h"
#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
#include "llvm/Support/Error.h"
#include <memory>
Expand Down Expand Up @@ -130,14 +129,10 @@ class Interpreter {
public:
virtual ~Interpreter();
static llvm::Expected<std::unique_ptr<Interpreter>>
create(std::unique_ptr<CompilerInstance> CI,
std::unique_ptr<llvm::orc::LLJITBuilder> JITBuilder = nullptr);
create(std::unique_ptr<CompilerInstance> CI);
static llvm::Expected<std::unique_ptr<Interpreter>>
createWithCUDA(std::unique_ptr<CompilerInstance> CI,
std::unique_ptr<CompilerInstance> DCI);
static llvm::Expected<std::unique_ptr<llvm::orc::LLJITBuilder>>
createLLJITBuilder(std::unique_ptr<llvm::orc::ExecutorProcessControl> EPC,
llvm::StringRef OrcRuntimePath);
const ASTContext &getASTContext() const;
ASTContext &getASTContext();
const CompilerInstance *getCompilerInstance() const;
Expand Down
38 changes: 0 additions & 38 deletions clang/include/clang/Interpreter/RemoteJITUtils.h

This file was deleted.

1 change: 0 additions & 1 deletion clang/lib/Interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ add_clang_library(clangInterpreter
Interpreter.cpp
InterpreterValuePrinter.cpp
InterpreterUtils.cpp
RemoteJITUtils.cpp
Value.cpp
${WASM_SRC}
PARTIAL_SOURCES_INTENDED
Expand Down
37 changes: 8 additions & 29 deletions clang/lib/Interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "clang/Sema/Lookup.h"
#include "clang/Serialization/ObjectFilePCHContainerReader.h"
#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.h"
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Errc.h"
Expand Down Expand Up @@ -457,11 +456,10 @@ const char *const Runtimes = R"(
)";

llvm::Expected<std::unique_ptr<Interpreter>>
Interpreter::create(std::unique_ptr<CompilerInstance> CI,
std::unique_ptr<llvm::orc::LLJITBuilder> JB) {
Interpreter::create(std::unique_ptr<CompilerInstance> CI) {
llvm::Error Err = llvm::Error::success();
auto Interp = std::unique_ptr<Interpreter>(
new Interpreter(std::move(CI), Err, JB ? std::move(JB) : nullptr));
auto Interp =
std::unique_ptr<Interpreter>(new Interpreter(std::move(CI), Err));
if (Err)
return std::move(Err);

Expand Down Expand Up @@ -580,25 +578,6 @@ createJITTargetMachineBuilder(const std::string &TT) {
return llvm::orc::JITTargetMachineBuilder(llvm::Triple(TT));
}

llvm::Expected<std::unique_ptr<llvm::orc::LLJITBuilder>>
Interpreter::createLLJITBuilder(
std::unique_ptr<llvm::orc::ExecutorProcessControl> EPC,
llvm::StringRef OrcRuntimePath) {
const std::string &TT = EPC->getTargetTriple().getTriple();
auto JTMB = createJITTargetMachineBuilder(TT);
if (!JTMB)
return JTMB.takeError();
auto JB = IncrementalExecutor::createDefaultJITBuilder(std::move(*JTMB));
if (!JB)
return JB.takeError();

(*JB)->setExecutorProcessControl(std::move(EPC));
(*JB)->setPlatformSetUp(
llvm::orc::ExecutorNativePlatform(OrcRuntimePath.str()));

return std::move(*JB);
}

llvm::Error Interpreter::CreateExecutor() {
if (IncrExecutor)
return llvm::make_error<llvm::StringError>("Operation failed. "
Expand Down Expand Up @@ -723,11 +702,11 @@ llvm::Error Interpreter::LoadDynamicLibrary(const char *name) {
if (!EE)
return EE.takeError();

if (auto DLSG = llvm::orc::EPCDynamicLibrarySearchGenerator::Load(
EE->getExecutionSession(), name))
// FIXME: Eventually we should put each library in its own JITDylib and
// turn off process symbols by default.
EE->getProcessSymbolsJITDylib()->addGenerator(std::move(*DLSG));
auto &DL = EE->getDataLayout();

if (auto DLSG = llvm::orc::DynamicLibrarySearchGenerator::Load(
name, DL.getGlobalPrefix()))
EE->getMainJITDylib().addGenerator(std::move(*DLSG));
else
return DLSG.takeError();

Expand Down
Loading
Loading