Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
79849c3
pipes for redirection in oop jit
Jul 1, 2025
825f005
Merge branch 'main' into redirection
kr-2003 Jul 29, 2025
52b0902
refactoring
Jul 29, 2025
3b4fcad
refactoring
Jul 29, 2025
e174e98
commenting & refactoring
Jul 29, 2025
b744a9f
compiler-rt conditional addition
Aug 1, 2025
0c6c995
Merge branch 'main' into redirection
kr-2003 Aug 1, 2025
2cf71ed
removed compiler-rt dep
Aug 1, 2025
7c29008
Merge branch 'redirection' of https://github.com/kr-2003/llvm-project…
Aug 1, 2025
41f8e54
separate file for oop tests
Aug 1, 2025
4f1d203
separate file for oop tests
Aug 1, 2025
a6a4369
separate file for oop tests
Aug 1, 2025
63de886
test file rename
Aug 1, 2025
c24e84e
test file rename
Aug 1, 2025
b114bb8
test file rename
Aug 1, 2025
850b953
resolving comments & InterpreterRemoteTest
Aug 3, 2025
956f393
resolving comments
Aug 3, 2025
14e5afd
resolving comments
Aug 4, 2025
65afbff
Custom lambda in launchExecutor and pid retrieval
Aug 5, 2025
7dc6590
Merge branch 'main' of https://github.com/llvm/llvm-project into redi…
Aug 20, 2025
095a63b
Dynamic path resolution
Aug 24, 2025
2b6dc6c
Dynamic path resolution using IncrementalCB
Aug 25, 2025
7ad10a6
Dynamic path resolution using IncrementalCB
Aug 25, 2025
6a58d5f
Addressing reviews
Aug 26, 2025
f1b9135
Sinking JitBuilder into Interpreter
Aug 27, 2025
dd73052
RemoteJITUtils shifted to IncrementalExecutor
Aug 31, 2025
e90df55
RemoteJITUtils shifted to IncrementalExecutor
Aug 31, 2025
521be31
Removed custom fork in launchExecutor lambda
Aug 31, 2025
baaff1e
Merge branch 'main' into redirection
kr-2003 Aug 31, 2025
44cde65
refactoring changes
Aug 31, 2025
fc1f0da
Merge branch 'redirection' of https://github.com/kr-2003/llvm-project…
Aug 31, 2025
c49ec55
Refactoring
Aug 31, 2025
a6a05ea
Deleted RemoteJITUtils.h & .cpp
Aug 31, 2025
f2ca64e
Refactoring
Aug 31, 2025
0c99b67
Refactoring
Aug 31, 2025
51d6657
Refactoring
Aug 31, 2025
a71c546
formatting
Aug 31, 2025
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
44 changes: 39 additions & 5 deletions clang/include/clang/Interpreter/Interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define LLVM_CLANG_INTERPRETER_INTERPRETER_H

#include "clang/AST/GlobalDecl.h"
#include "clang/Driver/ToolChain.h"
#include "clang/Interpreter/PartialTranslationUnit.h"
#include "clang/Interpreter/Value.h"

Expand Down Expand Up @@ -115,31 +116,60 @@ class Interpreter {
/// An optional compiler instance for CUDA offloading
std::unique_ptr<CompilerInstance> DeviceCI;

public:
struct OutOfProcessJITConfig {
/// Indicates whether out-of-process JIT execution is enabled.
bool IsOutOfProcess;
/// Path to the out-of-process JIT executor.
std::string OOPExecutor;
std::string OOPExecutorConnect;
/// Indicates whether to use shared memory for communication.
bool UseSharedMemory;
/// String representing the slab allocation size for memory management.
std::string SlabAllocateSizeString;
/// Path to the ORC runtime library.
std::string OrcRuntimePath;

OutOfProcessJITConfig()
: IsOutOfProcess(false), OOPExecutor(""), OOPExecutorConnect(""),
UseSharedMemory(false), SlabAllocateSizeString(""),
OrcRuntimePath("") {}
};

protected:
// Derived classes can use an extended interface of the Interpreter.
Interpreter(std::unique_ptr<CompilerInstance> Instance, llvm::Error &Err,
std::unique_ptr<llvm::orc::LLJITBuilder> JITBuilder = nullptr,
std::unique_ptr<clang::ASTConsumer> Consumer = nullptr);
std::unique_ptr<clang::ASTConsumer> Consumer = nullptr,
OutOfProcessJITConfig OOPConfig = OutOfProcessJITConfig());

// Create the internal IncrementalExecutor, or re-create it after calling
// ResetExecutor().
llvm::Error CreateExecutor();
llvm::Error
CreateExecutor(OutOfProcessJITConfig OOPConfig = OutOfProcessJITConfig());

// Delete the internal IncrementalExecutor. This causes a hard shutdown of the
// JIT engine. In particular, it doesn't run cleanup or destructors.
void ResetExecutor();

public:
virtual ~Interpreter();
static llvm::Expected<std::unique_ptr<Interpreter>>
create(std::unique_ptr<CompilerInstance> CI,
std::unique_ptr<llvm::orc::LLJITBuilder> JITBuilder = nullptr);
static llvm::Expected<std::unique_ptr<Interpreter>> create(
std::unique_ptr<CompilerInstance> CI,
std::optional<OutOfProcessJITConfig> OutOfProcessConfig = std::nullopt);
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);
#ifndef _WIN32
static llvm::Expected<
std::pair<std::unique_ptr<llvm::orc::LLJITBuilder>, pid_t>>
outOfProcessJITBuilder(OutOfProcessJITConfig OutOfProcessConfig);
static llvm::Expected<std::string>
getOrcRuntimePath(const driver::ToolChain &TC);
#endif
const ASTContext &getASTContext() const;
ASTContext &getASTContext();
const CompilerInstance *getCompilerInstance() const;
Expand Down Expand Up @@ -170,6 +200,10 @@ class Interpreter {
llvm::Expected<llvm::orc::ExecutorAddr>
getSymbolAddressFromLinkerName(llvm::StringRef LinkerName) const;

#ifndef _WIN32
pid_t getOutOfProcessExecutorPID() const;
#endif

private:
size_t getEffectivePTUSize() const;
void markUserCodeStart();
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 @@ -28,7 +28,6 @@ add_clang_library(clangInterpreter
Interpreter.cpp
InterpreterValuePrinter.cpp
InterpreterUtils.cpp
RemoteJITUtils.cpp
Value.cpp
InterpreterValuePrinter.cpp
${WASM_SRC}
Expand Down
Loading