xo-jit: bugfix: need release on unique_ptr -> xfer to refcounted ptr

This commit is contained in:
Roland Conybeare 2024-06-15 15:11:10 -04:00
commit 066c135629
3 changed files with 13 additions and 1 deletions

View file

@ -53,7 +53,8 @@ main() {
llvm::InitializeNativeTargetAsmPrinter();
llvm::InitializeNativeTargetAsmParser();
auto jit = llvm_exit_on_err(Jit::make_aux());
//auto jit = llvm_exit_on_err(Jit::make_aux());
auto jit = Jit::make();
//static_assert(std::is_function_v<decltype(&foo)>);

View file

@ -73,6 +73,8 @@ namespace xo {
public:
/* tracking KaleidoscopeJIT::Create() here.. */
static llvm::Expected<std::unique_ptr<Jit>> make_aux();
static xo::ref::rp<Jit> make();
llvm::Value * codegen_constant(ref::brw<xo::ast::ConstantInterface> expr);
llvm::Function * codegen_primitive(ref::brw<xo::ast::PrimitiveInterface> expr);

View file

@ -66,6 +66,15 @@ namespace xo {
));
} /*make*/
xo::ref::rp<Jit>
Jit::make() {
static llvm::ExitOnError llvm_exit_on_err;
std::unique_ptr<Jit> jit = llvm_exit_on_err(make_aux());
return jit.release();
} /*make*/
Jit::Jit(
std::unique_ptr<KaleidoscopeJIT> kal_jit
#ifdef NOT_USING