aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEduardo Julian2016-10-11 16:15:06 -0400
committerEduardo Julian2016-10-11 16:15:06 -0400
commit3614dd21db8ddfb8cf1c0e842d035709d8bee8e8 (patch)
treece64f4de675133c032ea2f0d9f957b2f210d2a55 /src
parentb103dafd2c60b91a9c02bbfcee6c2fcb30e40582 (diff)
- Better log printing.
Diffstat (limited to 'src')
-rw-r--r--src/lux/analyser/host.clj4
-rw-r--r--src/lux/base.clj2
-rw-r--r--src/lux/compiler/lux.clj4
-rw-r--r--src/lux/compiler/parallel.clj39
4 files changed, 24 insertions, 25 deletions
diff --git a/src/lux/analyser/host.clj b/src/lux/analyser/host.clj
index ff998c2d5..b84b31dff 100644
--- a/src/lux/analyser/host.clj
+++ b/src/lux/analyser/host.clj
@@ -935,7 +935,7 @@
(defn ^:private analyse-jvm-interface [analyse compile-interface interface-decl supers =anns =methods]
(|do [module &/get-module-name
_ (compile-interface interface-decl supers =anns =methods)
- :let [_ (&/|log! 'INTERFACE (str module "." (&/|first interface-decl)))]
+ :let [_ (println 'INTERFACE (str module "." (&/|first interface-decl)))]
_cursor &/cursor]
(return (&/|list (&&/|meta &/$UnitT _cursor
(&&/$tuple (&/|list)))))))
@@ -954,7 +954,7 @@
_ (check-method-completion all-supers =methods)
_ (compile-class class-decl super-class interfaces =inheritance-modifier =anns =fields =methods &/$Nil &/$None)
_ &/pop-dummy-name
- :let [_ (&/|log! 'CLASS full-name)]
+ :let [_ (println 'CLASS full-name)]
_cursor &/cursor]
(return (&/|list (&&/|meta &/$UnitT _cursor
(&&/$tuple (&/|list))))))))
diff --git a/src/lux/base.clj b/src/lux/base.clj
index b59141b34..54a0354c6 100644
--- a/src/lux/base.clj
+++ b/src/lux/base.clj
@@ -1449,5 +1449,5 @@
(let [!out! *out*]
(defn |log! [& parts]
(binding [*out* !out!]
- (do (print (apply println-str parts))
+ (do (print (apply str parts))
(flush)))))
diff --git a/src/lux/compiler/lux.clj b/src/lux/compiler/lux.clj
index 551572a87..976bdfa15 100644
--- a/src/lux/compiler/lux.clj
+++ b/src/lux/compiler/lux.clj
@@ -346,7 +346,7 @@
[_ (&/$None)]
(return nil))
- :let [_ (&/|log! 'DEF (str module-name ";" ?name))]]
+ :let [_ (println 'DEF (str module-name ";" ?name))]]
(return nil)))
_
@@ -428,7 +428,7 @@
[_ (&/$None)]
(return nil))
- :let [_ (&/|log! 'DEF (str module-name ";" ?name))]]
+ :let [_ (println 'DEF (str module-name ";" ?name))]]
(return nil)))
))))
diff --git a/src/lux/compiler/parallel.clj b/src/lux/compiler/parallel.clj
index 453033287..3506eb82e 100644
--- a/src/lux/compiler/parallel.clj
+++ b/src/lux/compiler/parallel.clj
@@ -18,25 +18,6 @@
(fn [compiler]
(return* compiler compiler)))
-(defn ^:private compilation-task [compile-module* module-name]
- (|do [compiler get-compiler
- :let [[task new?] (dosync (if-let [existing-task (get @!state! module-name)]
- (&/T [existing-task false])
- (let [new-task (promise)]
- (do (alter !state! assoc module-name new-task)
- (&/T [new-task true])))))
- _ (when new?
- (.start (new Thread
- (fn []
- (|case (&/run-state (compile-module* module-name)
- compiler)
- (&/$Right post-compiler _)
- (deliver task post-compiler)
-
- (&/$Left ?error)
- (&/|log! ?error))))))]]
- (return task)))
-
;; [Exports]
(defn setup!
"Must always call this function before using parallel compilation to make sure that the state that is being tracked is in proper shape."
@@ -45,4 +26,22 @@
(defn parallel-compilation [compile-module*]
(fn [module-name]
- (compilation-task compile-module* module-name)))
+ (|do [compiler get-compiler
+ :let [[task new?] (dosync (if-let [existing-task (get @!state! module-name)]
+ (&/T [existing-task false])
+ (let [new-task (promise)]
+ (do (alter !state! assoc module-name new-task)
+ (&/T [new-task true])))))
+ _ (when new?
+ (.start (new Thread
+ (fn []
+ (let [out-str (with-out-str
+ (|case (&/run-state (compile-module* module-name)
+ compiler)
+ (&/$Right post-compiler _)
+ (deliver task post-compiler)
+
+ (&/$Left ?error)
+ (println ?error)))]
+ (&/|log! out-str))))))]]
+ (return task))))