-
-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Labels
category:runtimeActual Clojure code, core libs, and all the C++ code in `jank::runtime`.Actual Clojure code, core libs, and all the C++ code in `jank::runtime`.
Description
Compilation Cache
jank now compiles the modules to multiple targets i.e. cpp, object file and llvm ir. The current behaviour of the module loader is to skip compilation if compiled object file already exists for that module.
This becomes a problem when the user wants to compile a module to cpp target or llvm ir target and object file already exists. Module loader currectly skips the compilation resulting into a no-op.
Recompilation into an executable fails
;; core.jank
(ns core (:require [lib] [lib-cpp]))
(defn -main [] (lib/hello))
;; lib.jank
(ns lib)
(defn foo [] "Hello from foo")// lib_cpp.cpp
#include<iostream>
extern "C" void jank_module_set_loaded(char const *);
extern "C" void jank_load_lib_cpp()
{
jank_module_set_loaded("lib-cpp");
std::cout<<"Hello from lib-cpp\n";
}Now, if we AoT compile core twice. Module loader, fails to find the lib ns
> jank compile core
> jank compile core
Stack trace (most recent call first):
#0 in jank::error::internal_failure at error.cpp:495
#1 in jank::error::throw_internal_failure at error.cpp:501
#2
#3
#4
#5
#6 in jank::runtime::module::loader::load_o at loader.cpp:995
#7 in jank::runtime::module::loader::load at loader.cpp:935
#8 in jank::runtime::context::load_module at context.cpp:363
#9 in jank::runtime::context::compile_module at context.cpp:386
#10 in jank::compile at main.cpp:362
#11 in main::$_0::operator at main.cpp:428
#12 in main::$_0::__invoke at main.cpp:378
#13 in jank_init_with_pch at c_api.cpp:1077
#14 in jank_init at c_api.cpp:1026
#15 in main at main.cpp:378
#16 at libc.so.6
#17 in __libc_start_main at libc.so.6
Testing
- AoT recompilation works
- Compilation to all the targets (cpp, object, llvm ir) works with proper caching
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
category:runtimeActual Clojure code, core libs, and all the C++ code in `jank::runtime`.Actual Clojure code, core libs, and all the C++ code in `jank::runtime`.