aboutsummaryrefslogtreecommitdiff
path: root/luxc/src
diff options
context:
space:
mode:
authorEduardo Julian2018-05-08 22:30:03 -0400
committerEduardo Julian2018-05-08 22:30:03 -0400
commit8c90251c12a4d0d4cc191bfb273bb5eb51bb0356 (patch)
tree5964bba6bedd134c244bc322df4cced3419ca957 /luxc/src
parentca9541c0c10d4e6aa94055ecfb47301ed7292828 (diff)
- Re-named "lux process concurrency-level" to "lux process parallelism-level".
- Merged the functionality of "lux process future" into "lux process schedule".
Diffstat (limited to '')
-rw-r--r--luxc/src/lux/analyser/proc/common.clj15
-rw-r--r--luxc/src/lux/compiler/jvm/proc/common.clj15
-rw-r--r--luxc/src/lux/compiler/jvm/rt.clj14
3 files changed, 5 insertions, 39 deletions
diff --git a/luxc/src/lux/analyser/proc/common.clj b/luxc/src/lux/analyser/proc/common.clj
index 44095998c..589ce42e2 100644
--- a/luxc/src/lux/analyser/proc/common.clj
+++ b/luxc/src/lux/analyser/proc/common.clj
@@ -399,20 +399,12 @@
(return (&/|list (&&/|meta exo-type _cursor
(&&/$proc (&/T ["box" "write"]) (&/|list valueA boxA) (&/|list)))))))))))
-(defn ^:private analyse-process-concurrency-level [analyse exo-type ?values]
+(defn ^:private analyse-process-parallelism-level [analyse exo-type ?values]
(|do [:let [(&/$Nil) ?values]
_ (&type/check exo-type &type/Nat)
_cursor &/cursor]
(return (&/|list (&&/|meta exo-type _cursor
- (&&/$proc (&/T ["process" "concurrency-level"]) (&/|list) (&/|list)))))))
-
-(defn ^:private analyse-process-future [analyse exo-type ?values]
- (|do [:let [(&/$Cons ?procedure (&/$Nil)) ?values]
- =procedure (&&/analyse-1 analyse (&/$Apply &type/Top &type/IO) ?procedure)
- _ (&type/check exo-type &type/Top)
- _cursor &/cursor]
- (return (&/|list (&&/|meta exo-type _cursor
- (&&/$proc (&/T ["process" "future"]) (&/|list =procedure) (&/|list)))))))
+ (&&/$proc (&/T ["process" "parallelism-level"]) (&/|list) (&/|list)))))))
(defn ^:private analyse-process-schedule [analyse exo-type ?values]
(|do [:let [(&/$Cons ?milliseconds (&/$Cons ?procedure (&/$Nil))) ?values]
@@ -507,8 +499,7 @@
"lux atom read" (analyse-atom-read analyse exo-type ?values)
"lux atom compare-and-swap" (analyse-atom-compare-and-swap analyse exo-type ?values)
- "lux process concurrency-level" (analyse-process-concurrency-level analyse exo-type ?values)
- "lux process future" (analyse-process-future analyse exo-type ?values)
+ "lux process parallelism-level" (analyse-process-parallelism-level analyse exo-type ?values)
"lux process schedule" (analyse-process-schedule analyse exo-type ?values)
;; else
diff --git a/luxc/src/lux/compiler/jvm/proc/common.clj b/luxc/src/lux/compiler/jvm/proc/common.clj
index 4bf2e8dbf..c671c5328 100644
--- a/luxc/src/lux/compiler/jvm/proc/common.clj
+++ b/luxc/src/lux/compiler/jvm/proc/common.clj
@@ -626,7 +626,7 @@
(.visitLdcInsn &/unit-tag))]]
(return nil)))
-(defn ^:private compile-process-concurrency-level [compile ?values special-args]
+(defn ^:private compile-process-parallelism-level [compile ?values special-args]
(|do [:let [(&/$Nil) ?values]
^MethodVisitor *writer* &/get-writer
:let [_ (doto *writer*
@@ -635,16 +635,6 @@
&&/wrap-long)]]
(return nil)))
-(defn ^:private compile-process-future [compile ?values special-args]
- (|do [:let [(&/$Cons ?procedure (&/$Nil)) ?values]
- ^MethodVisitor *writer* &/get-writer
- _ (compile ?procedure)
- :let [_ (doto *writer*
- (.visitTypeInsn Opcodes/CHECKCAST "lux/Function"))]
- :let [_ (doto *writer*
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "future" "(Llux/Function;)Ljava/lang/Object;"))]]
- (return nil)))
-
(defn ^:private compile-process-schedule [compile ?values special-args]
(|do [:let [(&/$Cons ?milliseconds (&/$Cons ?procedure (&/$Nil))) ?values]
^MethodVisitor *writer* &/get-writer
@@ -770,8 +760,7 @@
"process"
(case proc
- "concurrency-level" (compile-process-concurrency-level compile ?values special-args)
- "future" (compile-process-future compile ?values special-args)
+ "parallelism-level" (compile-process-parallelism-level compile ?values special-args)
"schedule" (compile-process-schedule compile ?values special-args)
)
diff --git a/luxc/src/lux/compiler/jvm/rt.clj b/luxc/src/lux/compiler/jvm/rt.clj
index da5917e3b..0f9c4cb86 100644
--- a/luxc/src/lux/compiler/jvm/rt.clj
+++ b/luxc/src/lux/compiler/jvm/rt.clj
@@ -440,20 +440,6 @@
(.visitInsn Opcodes/RETURN)
(.visitMaxs 0 0)
(.visitEnd))
- (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "future" "(Llux/Function;)Ljava/lang/Object;" nil nil)
- (.visitCode)
- (.visitTypeInsn Opcodes/NEW "java/lang/Thread")
- (.visitInsn Opcodes/DUP)
- (.visitTypeInsn Opcodes/NEW "lux/LuxRunnable")
- (.visitInsn Opcodes/DUP)
- (.visitVarInsn Opcodes/ALOAD 0)
- (.visitMethodInsn Opcodes/INVOKESPECIAL "lux/LuxRunnable" "<init>" "(Llux/Function;)V")
- (.visitMethodInsn Opcodes/INVOKESPECIAL "java/lang/Thread" "<init>" "(Ljava/lang/Runnable;)V")
- (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/Thread" "start" "()V")
- (.visitLdcInsn &/unit-tag)
- (.visitInsn Opcodes/ARETURN)
- (.visitMaxs 0 0)
- (.visitEnd))
(let [$immediately (new Label)]
(doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "schedule" "(JLlux/Function;)Ljava/lang/Object;" nil nil)
(.visitCode)