Skip to content

Commit

Permalink
Hide LLJIT into implementation to try to address the compilation issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
niyue committed Dec 6, 2023
1 parent a5c193f commit 82ac6a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cpp/src/gandiva/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include <llvm/Analysis/TargetTransformInfo.h>
#include <llvm/Bitcode/BitcodeReader.h>
#include <llvm/ExecutionEngine/ExecutionEngine.h>
#include <llvm/ExecutionEngine/Orc/LLJIT.h>
#include <llvm/IR/DataLayout.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/LLVMContext.h>
Expand Down Expand Up @@ -218,6 +219,8 @@ Engine::Engine(const std::shared_ptr<Configuration>& conf,
target_machine_(std::move(target_machine)),
conf_(conf) {}

Engine::~Engine() {}

Status Engine::Init() {
std::call_once(register_exported_funcs_flag, gandiva::RegisterExportedFuncs);

Expand Down
8 changes: 6 additions & 2 deletions cpp/src/gandiva/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#include <inttypes.h>
#include <cinttypes>
#include <functional>
#include <memory>
#include <optional>
Expand All @@ -26,7 +26,6 @@
#include <vector>

#include <llvm/Analysis/TargetTransformInfo.h>
#include <llvm/ExecutionEngine/Orc/LLJIT.h>

#include "arrow/util/logging.h"
#include "arrow/util/macros.h"
Expand All @@ -36,11 +35,16 @@
#include "gandiva/llvm_types.h"
#include "gandiva/visibility.h"

namespace llvm::orc {
class LLJIT;
} // namespace llvm

namespace gandiva {

/// \brief LLVM Execution engine wrapper.
class GANDIVA_EXPORT Engine {
public:
~Engine();
llvm::LLVMContext* context() { return context_.get(); }
llvm::IRBuilder<>* ir_builder() { return ir_builder_.get(); }
LLVMTypes* types() { return &types_; }
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/gandiva/llvm_generator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ TEST_F(TestLLVMGenerator, TestAdd) {
EXPECT_THAT(ir, testing::HasSubstr("vector.body"));

EXPECT_OK_AND_ASSIGN(auto fn_ptr, generator->engine_->CompiledFunction(fn_name));
auto eval_func = reinterpret_cast<EvalFunc>(fn_ptr);
auto eval_func = (EvalFunc)fn_ptr;

constexpr size_t kNumRecords = 4;
std::array<uint32_t, kNumRecords> a0{1, 2, 3, 4};
Expand Down

0 comments on commit 82ac6a2

Please sign in to comment.