diff options
Diffstat (limited to 'src/lux/compiler.clj')
-rw-r--r-- | src/lux/compiler.clj | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lux/compiler.clj b/src/lux/compiler.clj index 7bf53ada7..5dd2e3684 100644 --- a/src/lux/compiler.clj +++ b/src/lux/compiler.clj @@ -29,7 +29,8 @@ [case :as &&case] [lambda :as &&lambda] [module :as &&module] - [io :as &&io]) + [io :as &&io] + [parallel :as &¶llel]) [lux.packager.program :as &packager-program]) (:import (org.objectweb.asm Opcodes Label @@ -118,6 +119,7 @@ )) (defn init! [] + (&¶llel/setup!) (reset! !source->last-line {}) (.mkdirs (java.io.File. &&/output-dir)) (doto (.getDeclaredMethod java.net.URLClassLoader "addURL" (into-array [java.net.URL])) @@ -170,7 +172,10 @@ :let [file-hash (hash file-content)]] (if (&&cache/cached? name) (&&cache/load source-dirs name file-hash compile-module) - (let [compiler-step (&analyser/analyse &optimizer/optimize eval! (partial compile-module source-dirs) all-compilers)] + (let [compiler-step (&analyser/analyse &optimizer/optimize + eval! + (&¶llel/parallel-compilation (partial compile-module source-dirs)) + all-compilers)] (|do [module-exists? (&a-module/exists? name)] (if module-exists? (fail "[Compiler Error] Can't redefine a module!") @@ -253,7 +258,8 @@ (defn compile-program [mode program-module source-dirs] (init!) - (let [m-action (&/map% (partial compile-module source-dirs) (&/|list "lux" program-module))] + (let [m-action (&/map% (&¶llel/parallel-compilation (partial compile-module source-dirs)) + (&/|list "lux" program-module))] (|case (m-action (&/init-state mode)) (&/$Right ?state _) (do (println "Compilation complete!") |