aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library
diff options
context:
space:
mode:
authorEduardo Julian2022-04-05 18:32:42 -0400
committerEduardo Julian2022-04-05 18:32:42 -0400
commit60daee098f92a44c3b404a9f5801f2e8126ad650 (patch)
tree7b58d0f6f937b8be5dcb46eaf0411f7961907c8a /stdlib/source/library
parenta2d994a3f7a39964452df7523f69e16b10b266f9 (diff)
No longer depending on the ASM library for JVM bytecode generation.
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/control/concurrency/atom.lux16
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux40
-rw-r--r--stdlib/source/library/lux/world/file.lux2
4 files changed, 44 insertions, 36 deletions
diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux
index 08533b6a5..39207767c 100644
--- a/stdlib/source/library/lux/control/concurrency/atom.lux
+++ b/stdlib/source/library/lux/control/concurrency/atom.lux
@@ -44,7 +44,7 @@
(with_expansions [<jvm> (as_expected (java/util/concurrent/atomic/AtomicReference::new value))]
(for @.old <jvm>
@.jvm <jvm>
- (array.has! 0 value (array.empty 1))))))
+ (array.has! 0 (variance.write value) (array.empty 1))))))
(def: .public (read! atom)
(All (_ r w) (-> (Atom' r w) (IO r)))
@@ -63,12 +63,14 @@
(representation atom)))
@.jvm (ffi.of_boolean
(java/util/concurrent/atomic/AtomicReference::compareAndSet current new (representation atom)))
- (let [old (array.item 0 (representation atom))]
- (if (same? old current)
- (exec
- (array.has! 0 new (representation atom))
- true)
- false)))))
+ (if (|> (representation atom)
+ (array.item 0)
+ variance.read
+ (same? current))
+ (exec
+ (array.has! 0 (variance.write new) (representation atom))
+ true)
+ false))))
)
(def: .public (update! f atom)
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index 1facd15f6..9201b9cc2 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -115,10 +115,8 @@
(let [system (the #&file_system platform)
write_artifact! (is (-> [artifact.ID (Maybe Text) Binary] (Action Any))
(function (_ [artifact_id custom content])
- (with_expansions [<it> (cache/artifact.cache! system context @module artifact_id content)]
- (for @.old (as (Async (Try Any))
- <it>)
- <it>))))]
+ (is (Async (Try Any))
+ (cache/artifact.cache! system context @module artifact_id content))))]
(do [! ..monad]
[_ (is (Async (Try Any))
(cache/module.enable! async.monad system context @module))
@@ -135,15 +133,13 @@
(is (Action (List Any)))))
document (# async.monad in
(document.marked? key (the [archive.#module module.#document] entry)))]
- (with_expansions [<it> (|> [(|> entry
- (the archive.#module)
- (has module.#document document))
- (the archive.#registry entry)]
- (_.result (..writer format))
- (cache/module.cache! system context @module))]
- (for @.old (as (Async (Try Any))
- <it>)
- <it>)))))
+ (is (Async (Try Any))
+ (|> [(|> entry
+ (the archive.#module)
+ (has module.#document document))
+ (the archive.#registry entry)]
+ (_.result (..writer format))
+ (cache/module.cache! system context @module))))))
... TODO: Inline ASAP
(def: initialize_buffer!
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux
index f07d818d5..fa87792da 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux
@@ -9,7 +9,7 @@
["<[0]>" code {"+" Parser}]]]
[data
[collection
- ["[0]" array {"+" Array}]
+ ["[0]" array]
["[0]" dictionary]
["[0]" list]]]
["[0]" type
@@ -32,11 +32,13 @@
[<code>.any
(function (_ extension phase archive lengthC)
(<| analysis/type.with_var
- (function (_ [@var :var:]))
+ (function (_ [@read :read:]))
+ analysis/type.with_var
+ (function (_ [@write :write:]))
(do phase.monad
[lengthA (analysis/type.expecting Nat
(phase archive lengthC))
- _ (analysis/type.inference (type (Array :var:)))]
+ _ (analysis/type.inference (type (array.Array' :read: :write:)))]
(in {analysis.#Extension extension (list lengthA)}))))]))
(def: array::length
@@ -45,9 +47,11 @@
[<code>.any
(function (_ extension phase archive arrayC)
(<| analysis/type.with_var
- (function (_ [@var :var:]))
+ (function (_ [@read :read:]))
+ analysis/type.with_var
+ (function (_ [@write :write:]))
(do phase.monad
- [arrayA (analysis/type.expecting (type (Array :var:))
+ [arrayA (analysis/type.expecting (type (array.Array' :read: :write:))
(phase archive arrayC))
_ (analysis/type.inference Nat)]
(in {analysis.#Extension extension (list arrayA)}))))]))
@@ -58,13 +62,15 @@
[(<>.and <code>.any <code>.any)
(function (_ extension phase archive [indexC arrayC])
(<| analysis/type.with_var
- (function (_ [@var :var:]))
+ (function (_ [@read :read:]))
+ analysis/type.with_var
+ (function (_ [@write :write:]))
(do phase.monad
[indexA (analysis/type.expecting Nat
(phase archive indexC))
- arrayA (analysis/type.expecting (type (Array :var:))
+ arrayA (analysis/type.expecting (type (array.Array' :read: :write:))
(phase archive arrayC))
- _ (analysis/type.inference :var:)]
+ _ (analysis/type.inference :read:)]
(in {analysis.#Extension extension (list indexA arrayA)}))))]))
(def: array::write
@@ -73,15 +79,17 @@
[($_ <>.and <code>.any <code>.any <code>.any)
(function (_ extension phase archive [indexC valueC arrayC])
(<| analysis/type.with_var
- (function (_ [@var :var:]))
+ (function (_ [@read :read:]))
+ analysis/type.with_var
+ (function (_ [@write :write:]))
(do phase.monad
[indexA (analysis/type.expecting Nat
(phase archive indexC))
- valueA (analysis/type.expecting :var:
+ valueA (analysis/type.expecting :write:
(phase archive valueC))
- arrayA (analysis/type.expecting (type (Array :var:))
+ arrayA (analysis/type.expecting (type (array.Array' :read: :write:))
(phase archive arrayC))
- _ (analysis/type.inference (type (Array :var:)))]
+ _ (analysis/type.inference (type (array.Array' :read: :write:)))]
(in {analysis.#Extension extension (list indexA valueA arrayA)}))))]))
(def: array::delete
@@ -90,13 +98,15 @@
[($_ <>.and <code>.any <code>.any)
(function (_ extension phase archive [indexC arrayC])
(<| analysis/type.with_var
- (function (_ [@var :var:]))
+ (function (_ [@read :read:]))
+ analysis/type.with_var
+ (function (_ [@write :write:]))
(do phase.monad
[indexA (analysis/type.expecting Nat
(phase archive indexC))
- arrayA (analysis/type.expecting (type (Array :var:))
+ arrayA (analysis/type.expecting (type (array.Array' :read: :write:))
(phase archive arrayC))
- _ (analysis/type.inference (type (Array :var:)))]
+ _ (analysis/type.inference (type (array.Array' :read: :write:)))]
(in {analysis.#Extension extension (list indexA arrayA)}))))]))
(def: bundle::array
diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux
index c0c76d6de..d04f8c052 100644
--- a/stdlib/source/library/lux/world/file.lux
+++ b/stdlib/source/library/lux/world/file.lux
@@ -1,6 +1,6 @@
(.`` (.`` (.using
[library
- [lux "*"
+ [lux {"-" open}
["@" target]
[abstract
["[0]" monad {"+" Monad do}]]