diff options
author | Eduardo Julian | 2018-07-31 18:36:18 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-07-31 18:36:18 -0400 |
commit | eea58ee669f69fddf2cef9e1675c41959e2e0a55 (patch) | |
tree | 5424dab3ef26190958fe4371f3f50995025d31cf /luxc | |
parent | 748c868680683df1949f62aac274040ac5bf43da (diff) |
Now implementing atom functionality in stdlib instead of the compiler.
Diffstat (limited to '')
-rw-r--r-- | luxc/src/lux/analyser/proc/common.clj | 36 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/proc/common.clj | 41 |
2 files changed, 0 insertions, 77 deletions
diff --git a/luxc/src/lux/analyser/proc/common.clj b/luxc/src/lux/analyser/proc/common.clj index ee9ea33e8..38f6bc6c3 100644 --- a/luxc/src/lux/analyser/proc/common.clj +++ b/luxc/src/lux/analyser/proc/common.clj @@ -287,38 +287,6 @@ (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T ["array" "size"]) (&/|list =array) (&/|list))))))))) -(defn ^:private analyse-atom-new [analyse exo-type ?values] - (&type/with-var - (fn [$var] - (|do [:let [(&/$Cons ?init (&/$Nil)) ?values] - =init (&&/analyse-1 analyse $var ?init) - _ (&type/check exo-type (&type/Atom $var)) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["atom" "new"]) (&/|list =init) (&/|list))))))))) - -(defn ^:private analyse-atom-read [analyse exo-type ?values] - (&type/with-var - (fn [$var] - (|do [:let [(&/$Cons ?atom (&/$Nil)) ?values] - =atom (&&/analyse-1 analyse (&type/Atom $var) ?atom) - _ (&type/check exo-type $var) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["atom" "read"]) (&/|list =atom) (&/|list))))))))) - -(defn ^:private analyse-atom-compare-and-swap [analyse exo-type ?values] - (&type/with-var - (fn [$var] - (|do [:let [(&/$Cons ?atom (&/$Cons ?old (&/$Cons ?new (&/$Nil)))) ?values] - =atom (&&/analyse-1 analyse (&type/Atom $var) ?atom) - =old (&&/analyse-1 analyse $var ?old) - =new (&&/analyse-1 analyse $var ?new) - _ (&type/check exo-type &type/Bit) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["atom" "compare-and-swap"]) (&/|list =atom =old =new) (&/|list))))))))) - (defn ^:private analyse-box-new [analyse exo-type ?values] (&type/with-var (fn [$var] @@ -429,10 +397,6 @@ "lux frac max" (analyse-frac-max analyse exo-type ?values) "lux frac int" (analyse-frac-int analyse exo-type ?values) - "lux atom new" (analyse-atom-new analyse exo-type ?values) - "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 parallelism" (analyse-process-parallelism analyse exo-type ?values) "lux process schedule" (analyse-process-schedule analyse exo-type ?values) diff --git a/luxc/src/lux/compiler/jvm/proc/common.clj b/luxc/src/lux/compiler/jvm/proc/common.clj index b074e37b9..6f05b3e52 100644 --- a/luxc/src/lux/compiler/jvm/proc/common.clj +++ b/luxc/src/lux/compiler/jvm/proc/common.clj @@ -464,40 +464,6 @@ &&/wrap-long)]] (return nil))) -(defn ^:private compile-atom-new [compile ?values special-args] - (|do [:let [(&/$Cons ?init (&/$Nil)) ?values] - ^MethodVisitor *writer* &/get-writer - :let [_ (doto *writer* - (.visitTypeInsn Opcodes/NEW "java/util/concurrent/atomic/AtomicReference") - (.visitInsn Opcodes/DUP))] - _ (compile ?init) - :let [_ (doto *writer* - (.visitMethodInsn Opcodes/INVOKESPECIAL "java/util/concurrent/atomic/AtomicReference" "<init>" "(Ljava/lang/Object;)V"))]] - (return nil))) - -(defn ^:private compile-atom-read [compile ?values special-args] - (|do [:let [(&/$Cons ?atom (&/$Nil)) ?values] - ^MethodVisitor *writer* &/get-writer - _ (compile ?atom) - :let [_ (doto *writer* - (.visitTypeInsn Opcodes/CHECKCAST "java/util/concurrent/atomic/AtomicReference"))] - :let [_ (doto *writer* - (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/util/concurrent/atomic/AtomicReference" "get" "()Ljava/lang/Object;"))]] - (return nil))) - -(defn ^:private compile-atom-compare-and-swap [compile ?values special-args] - (|do [:let [(&/$Cons ?atom (&/$Cons ?old (&/$Cons ?new (&/$Nil)))) ?values] - ^MethodVisitor *writer* &/get-writer - _ (compile ?atom) - :let [_ (doto *writer* - (.visitTypeInsn Opcodes/CHECKCAST "java/util/concurrent/atomic/AtomicReference"))] - _ (compile ?old) - _ (compile ?new) - :let [_ (doto *writer* - (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/util/concurrent/atomic/AtomicReference" "compareAndSet" "(Ljava/lang/Object;Ljava/lang/Object;)Z") - &&/wrap-boolean)]] - (return nil))) - (defn ^:private compile-box-new [compile ?values special-args] (|do [:let [(&/$Cons initS (&/$Nil)) ?values] ^MethodVisitor *writer* &/get-writer @@ -641,13 +607,6 @@ "write" (compile-box-write compile ?values special-args) ) - "atom" - (case proc - "new" (compile-atom-new compile ?values special-args) - "read" (compile-atom-read compile ?values special-args) - "compare-and-swap" (compile-atom-compare-and-swap compile ?values special-args) - ) - "process" (case proc "parallelism" (compile-process-parallelism compile ?values special-args) |