From 82ac6a2a36572c4c7f70ffc78d612fe3ff28374f Mon Sep 17 00:00:00 2001 From: Yue Ni Date: Wed, 6 Dec 2023 21:41:22 +0800 Subject: [PATCH] Hide LLJIT into implementation to try to address the compilation issue. --- cpp/src/gandiva/engine.cc | 3 +++ cpp/src/gandiva/engine.h | 8 ++++++-- cpp/src/gandiva/llvm_generator_test.cc | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cpp/src/gandiva/engine.cc b/cpp/src/gandiva/engine.cc index c2a4e363cfadb..920ed957a7d6f 100644 --- a/cpp/src/gandiva/engine.cc +++ b/cpp/src/gandiva/engine.cc @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -218,6 +219,8 @@ Engine::Engine(const std::shared_ptr& conf, target_machine_(std::move(target_machine)), conf_(conf) {} +Engine::~Engine() {} + Status Engine::Init() { std::call_once(register_exported_funcs_flag, gandiva::RegisterExportedFuncs); diff --git a/cpp/src/gandiva/engine.h b/cpp/src/gandiva/engine.h index cecfa08d1c709..3aed02a610276 100644 --- a/cpp/src/gandiva/engine.h +++ b/cpp/src/gandiva/engine.h @@ -17,7 +17,7 @@ #pragma once -#include +#include #include #include #include @@ -26,7 +26,6 @@ #include #include -#include #include "arrow/util/logging.h" #include "arrow/util/macros.h" @@ -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_; } diff --git a/cpp/src/gandiva/llvm_generator_test.cc b/cpp/src/gandiva/llvm_generator_test.cc index d1c8995e98068..a0ba8926bf97d 100644 --- a/cpp/src/gandiva/llvm_generator_test.cc +++ b/cpp/src/gandiva/llvm_generator_test.cc @@ -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(fn_ptr); + auto eval_func = (EvalFunc)fn_ptr; constexpr size_t kNumRecords = 4; std::array a0{1, 2, 3, 4};