diff options
Diffstat (limited to 'new-luxc/source')
16 files changed, 6 insertions, 295 deletions
diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux index 7218d9618..585292af0 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux @@ -329,28 +329,15 @@ (install "exit" (unary runtimeT.io//exit)) (install "current-time" (nullary (function (_ _) (runtimeT.io//current-time runtimeT.unit))))))) -## [[Atoms]] -(def: atom//new +## [[Box]] +(def: box//new Unary (|>> (list) _.vector)) -(def: (atom//read atom) +(def: (box//read box) Unary - (_.svref atom (_.int 0))) - -(def: (atom//compare-and-swap [atomO oldO newO]) - Trinary - (runtimeT.atom//compare-and-swap atomO oldO newO)) + (_.svref box (_.int 0))) -(def: atom-procs - Bundle - (<| (prefix "atom") - (|> (dict.new text.Hash<Text>) - (install "new" (unary atom//new)) - (install "read" (unary atom//read)) - (install "compare-and-swap" (trinary atom//compare-and-swap))))) - -## [[Box]] (def: (box//write [valueO boxO]) Binary (runtimeT.box//write valueO boxO)) @@ -359,8 +346,8 @@ Bundle (<| (prefix "box") (|> (dict.new text.Hash<Text>) - (install "new" (unary atom//new)) - (install "read" (unary atom//read)) + (install "new" (unary box//new)) + (install "read" (unary box//read)) (install "write" (binary box//write))))) ## [[Processes]] @@ -390,7 +377,6 @@ (dict.merge text-procs) (dict.merge array-procs) (dict.merge io-procs) - (dict.merge atom-procs) (dict.merge box-procs) (dict.merge process-procs)) )) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux index 3750bc674..c54fde7ce 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux @@ -266,19 +266,6 @@ (list @@array//get @@array//put))) -(runtime: (atom//compare-and-swap atom old new) - (with-vars [temp] - (_.let (list [temp (_.svref (@@ atom) (_.int 0))]) - (_.if (_.eq (@@ old) (@@ temp)) - (_.progn - (list (_.setf! (_.svref (@@ atom) (_.int 0)) (@@ new)) - (_.bool #1))) - (_.bool #0))))) - -(def: runtime//atom - Runtime - @@atom//compare-and-swap) - (runtime: (box//write value box) (_.progn (list @@ -356,7 +343,6 @@ runtime//adt runtime//text runtime//array - runtime//atom runtime//box runtime//io runtime//process)) diff --git a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux index b40f00c73..cca49372b 100644 --- a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux @@ -307,19 +307,6 @@ Nullary (frac//to-int "(new Date()).getTime()")) -## [[Atoms]] -(def: (atom//new initJS) - Unary - (format "{" runtimeT.atom-field ":" initJS "}")) - -(def: (atom//read atomJS) - Unary - (format (self-contained atomJS) "." runtimeT.atom-field)) - -(def: (atom//compare-and-swap [atomJS oldJS newJS]) - Trinary - (format runtimeT.atom//compare-and-swap "(" atomJS "," oldJS "," newJS ")")) - ## [[Box]] (def: (box//new initJS) Unary @@ -432,14 +419,6 @@ (install "exit" (unary io//exit)) (install "current-time" (nullary io//current-time))))) -(def: atom-procs - Bundle - (<| (prefix "atom") - (|> (dict.new text.Hash<Text>) - (install "new" (unary atom//new)) - (install "read" (unary atom//read)) - (install "compare-and-swap" (trinary atom//compare-and-swap))))) - (def: box-procs Bundle (<| (prefix "box") @@ -466,7 +445,6 @@ (dict.merge text-procs) (dict.merge array-procs) (dict.merge io-procs) - (dict.merge atom-procs) (dict.merge box-procs) (dict.merge process-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux index c5d85eb0d..d5abbc150 100644 --- a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux @@ -643,23 +643,6 @@ (format __io//log __io//error)) -(def: #export atom-field Text "V") - -(runtime: atom//compare-and-swap "atomCompareAndSwap" - (format "(function " @ "(atom,oldV,newV) {" - "if(atom." atom-field " === oldV) {" - "atom." atom-field " = newV;" - "return true;" - "}" - "else {" - "return false;" - "}" - "})")) - -(def: runtime//atom - Runtime - (format __atom//compare-and-swap)) - (runtime: js//get "jsGetField" (format "(function " @ "(object, field) {" "var temp = object[field];" @@ -704,7 +687,6 @@ runtime//text runtime//array runtime//io - runtime//atom runtime//js)) (def: #export artifact Text (format prefix ".js")) diff --git a/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux index a138bd79a..34e7f02c8 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux @@ -4,8 +4,6 @@ [monad (#+ do)] ["ex" exception (#+ exception:)]] ["." io] - [concurrency - [atom (#+ Atom atom)]] [data ["." error (#+ Error)] ["." text ("text/." Hash<Text>) diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux index 327a95871..a6b037947 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux @@ -408,30 +408,6 @@ (|>> (_.INVOKESTATIC "java.lang.System" "currentTimeMillis" ($t.method (list) (#.Some $t.long) (list)) #0) (_.wrap #$.Long))) -## [[Atoms]] -(def: atom-class Text "java.util.concurrent.atomic.AtomicReference") -(def: (atom//new initI) - Unary - (|>> (_.NEW atom-class) - _.DUP - initI - (_.INVOKESPECIAL atom-class "<init>" ($t.method (list $Object) #.None (list)) #0))) - -(def: (atom//read atomI) - Unary - (|>> atomI - (_.CHECKCAST atom-class) - (_.INVOKEVIRTUAL atom-class "get" ($t.method (list) (#.Some $Object) (list)) #0))) - -(def: (atom//compare-and-swap [atomI oldI newI]) - Trinary - (|>> atomI - (_.CHECKCAST atom-class) - oldI - newI - (_.INVOKEVIRTUAL atom-class "compareAndSet" ($t.method (list $Object $Object) (#.Some $t.boolean) (list)) #0) - (_.wrap #$.Boolean))) - ## [[Box]] (def: empty-boxI $.Inst @@ -559,14 +535,6 @@ (install "exit" (unary io//exit)) (install "current-time" (nullary io//current-time))))) -(def: atom-procs - Bundle - (<| (prefix "atom") - (|> (dict.new text.Hash<Text>) - (install "new" (unary atom//new)) - (install "read" (unary atom//read)) - (install "compare-and-swap" (trinary atom//compare-and-swap))))) - (def: box-procs Bundle (<| (prefix "box") @@ -593,7 +561,6 @@ (dict.merge text-procs) (dict.merge array-procs) (dict.merge io-procs) - (dict.merge atom-procs) (dict.merge box-procs) (dict.merge process-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux index 372d107cb..356adb5c3 100644 --- a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux @@ -306,19 +306,6 @@ (|> (lua.apply "os.time" (list)) (lua.* (lua.int 1_000)))) -## [[Atoms]] -(def: atom//new - Unary - (|>> [runtimeT.atom//field] (list) lua.table)) - -(def: atom//read - Unary - (lua.nth (lua.string runtimeT.atom//field))) - -(def: (atom//compare-and-swap [atomO oldO newO]) - Trinary - (runtimeT.atom//compare-and-swap atomO oldO newO)) - ## [[Box]] (def: box//new Unary @@ -429,14 +416,6 @@ (install "exit" (unary io//exit)) (install "current-time" (nullary io//current-time))))) -(def: atom-procs - Bundle - (<| (prefix "atom") - (|> (dict.new text.Hash<Text>) - (install "new" (unary atom//new)) - (install "read" (unary atom//read)) - (install "compare-and-swap" (trinary atom//compare-and-swap))))) - (def: box-procs Bundle (<| (prefix "box") @@ -463,7 +442,6 @@ (dict.merge text-procs) (dict.merge array-procs) (dict.merge io-procs) - (dict.merge atom-procs) (dict.merge box-procs) (dict.merge process-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux index 8121b2c9d..3a18f98e7 100644 --- a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux @@ -249,19 +249,6 @@ @@array//put )) -(def: #export atom//field Text "_lux_atom") - -(runtime: (atom//compare-and-swap atom old new) - (let [atom//field (lua.string atom//field)] - (lua.if! (lua.= old (lua.nth atom//field atom)) - (lua.block! (list (lua.set! (lua.nth atom//field atom) new) - (lua.return! (lua.bool #1)))) - (lua.return! (lua.bool #0))))) - -(def: runtime//atom - Runtime - (format @@atom//compare-and-swap)) - (runtime: (box//write value box) (lua.block! (list (lua.set! (lua.nth (lua.int 0) box) value) @@ -337,7 +324,6 @@ runtime//bit runtime//text runtime//array - runtime//atom runtime//box runtime//process runtime//lua)) diff --git a/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux index 715d8bf0b..e195130c5 100644 --- a/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux @@ -338,27 +338,6 @@ ## (install "current-time" (nullary (function (_ _) ## (runtimeT.io//current-time! runtimeT.unit))))))) -## ## [[Atoms]] -## (def: atom//new -## Unary -## (|>> [(_.string runtimeT.atom//field)] (list) _.dict)) - -## (def: atom//read -## Unary -## (_.nth (_.string runtimeT.atom//field))) - -## (def: (atom//compare-and-swap [atomO oldO newO]) -## Trinary -## (runtimeT.atom//compare-and-swap atomO oldO newO)) - -## (def: atom-procs -## Bundle -## (<| (prefix "atom") -## (|> (dict.new text.Hash<Text>) -## (install "new" (unary atom//new)) -## (install "read" (unary atom//read)) -## (install "compare-and-swap" (trinary atom//compare-and-swap))))) - ## ## [[Processes]] ## (def: (process//parallelism-level []) ## Nullary @@ -388,6 +367,5 @@ ## (dict.merge text-procs) ## (dict.merge array-procs) ## (dict.merge io-procs) - ## (dict.merge atom-procs) ## (dict.merge process-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux index d4c14b473..c57bc3d80 100644 --- a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux @@ -299,21 +299,6 @@ ## @@array//get ## @@array//put)) -## (def: #export atom//field Text "_lux_atom") - -## (runtime: (atom//compare-and-swap atom old new) -## (let [atom//field (_.string atom//field)] -## (_.if! (_.= old (_.nth atom//field atom)) -## ($_ _.then! -## (_.set-nth! atom//field new atom) -## (_.return! (_.bool #1))) -## (_.return! (_.bool #0))))) - -## (def: runtime//atom -## Runtime -## ($_ _.then! -## @@atom//compare-and-swap)) - ## (runtime: (process//future procedure) ## ($_ _.then! ## (_.import! "threading") @@ -356,7 +341,6 @@ ## runtime//bit ## runtime//text ## runtime//array - ## runtime//atom ## runtime//io ## runtime//process )) diff --git a/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux index 35ffdb1f8..9a70c8c92 100644 --- a/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux @@ -358,27 +358,6 @@ (install "current-time" (nullary (function (_ _) (runtimeT.io//current-time! runtimeT.unit))))))) -## [[Atoms]] -(def: atom//new - Unary - (|>> [(python.string runtimeT.atom//field)] (list) python.dict)) - -(def: atom//read - Unary - (python.nth (python.string runtimeT.atom//field))) - -(def: (atom//compare-and-swap [atomO oldO newO]) - Trinary - (runtimeT.atom//compare-and-swap atomO oldO newO)) - -(def: atom-procs - Bundle - (<| (prefix "atom") - (|> (dict.new text.Hash<Text>) - (install "new" (unary atom//new)) - (install "read" (unary atom//read)) - (install "compare-and-swap" (trinary atom//compare-and-swap))))) - ## [[Box]] (def: box//new Unary @@ -428,7 +407,6 @@ (dict.merge text-procs) (dict.merge array-procs) (dict.merge io-procs) - (dict.merge atom-procs) (dict.merge box-procs) (dict.merge process-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux index 3dd5980e8..571835b79 100644 --- a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux @@ -333,21 +333,6 @@ @@array//get @@array//put)) -(def: #export atom//field Text "_lux_atom") - -(runtime: (atom//compare-and-swap atom old new) - (let [atom//field (python.string atom//field)] - (python.if! (python.= old (python.nth atom//field atom)) - ($_ python.then! - (python.set-nth! atom//field new atom) - (python.return! (python.bool #1))) - (python.return! (python.bool #0))))) - -(def: runtime//atom - Runtime - ($_ python.then! - @@atom//compare-and-swap)) - (runtime: (box//write value box) ($_ python.then! (python.set-nth! (python.int 0) value box) @@ -384,7 +369,6 @@ runtime//frac runtime//text runtime//array - runtime//atom runtime//box runtime//io runtime//process diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux index c17eb6738..d8f4f4662 100644 --- a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux @@ -350,27 +350,6 @@ (install "current-time" (nullary (function (_ _) (runtimeT.io//current-time! runtimeT.unit))))))) -## [[Atoms]] -(def: atom//new - Unary - (|>> [runtimeT.atom//field] (list) r.named-list)) - -(def: atom//read - Unary - (r.nth (r.string runtimeT.atom//field))) - -(def: (atom//compare-and-swap [atomO oldO newO]) - Trinary - (runtimeT.atom//compare-and-swap atomO oldO newO)) - -(def: atom-procs - Bundle - (<| (prefix "atom") - (|> (dict.new text.Hash<Text>) - (install "new" (unary atom//new)) - (install "read" (unary atom//read)) - (install "compare-and-swap" (trinary atom//compare-and-swap))))) - ## [[Box]] (def: box//new Unary @@ -420,7 +399,6 @@ (dict.merge text-procs) (dict.merge array-procs) (dict.merge io-procs) - (dict.merge atom-procs) (dict.merge box-procs) (dict.merge process-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux index fd4adfb1a..ee46836cb 100644 --- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux @@ -764,21 +764,6 @@ @@array//get @@array//put)) -(def: #export atom//field Text "lux_atom") - -(runtime: (atom//compare-and-swap atom old new) - (let [atom//field (r.string atom//field)] - (r.if (|> (@@ atom) (r.nth atom//field) (r.= (@@ old))) - ($_ r.then - (r.set-nth! atom//field (@@ new) atom) - (r.bool #1)) - (r.bool #0)))) - -(def: runtime//atom - Runtime - ($_ r.then - @@atom//compare-and-swap)) - (runtime: (box//write value box) ($_ r.then (r.set-nth! (r.int 1) (@@ value) box) @@ -859,7 +844,6 @@ runtime//frac runtime//text runtime//array - runtime//atom runtime//box runtime//io runtime//process diff --git a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux index ba6a1241a..96d42a4a9 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux @@ -391,27 +391,6 @@ (install "exit" (unary io//exit)) (install "current-time" (nullary io//current-time))))) -## [[Atoms]] -(def: atom//new - Unary - (|>> [(ruby.string runtimeT.atom//field)] (list) ruby.dictionary)) - -(def: atom//read - Unary - (ruby.nth (ruby.string runtimeT.atom//field))) - -(def: (atom//compare-and-swap [atomO oldO newO]) - Trinary - (runtimeT.atom//compare-and-swap atomO oldO newO)) - -(def: atom-procs - Bundle - (<| (prefix "atom") - (|> (dict.new text.Hash<Text>) - (install "new" (unary atom//new)) - (install "read" (unary atom//read)) - (install "compare-and-swap" (trinary atom//compare-and-swap))))) - ## [[Box]] (def: box//new Unary @@ -461,7 +440,6 @@ (dict.merge text-procs) (dict.merge array-procs) (dict.merge io-procs) - (dict.merge atom-procs) (dict.merge box-procs) (dict.merge process-procs) ))) diff --git a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux index 49f5d9d79..32ab5b10c 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux @@ -222,19 +222,6 @@ (format @@array//get @@array//put)) -(def: #export atom//field Text "_lux_atom") - -(runtime: (atom//compare-and-swap atom old new) - (let [atom//field (ruby.string atom//field)] - (ruby.if! (ruby.= old (ruby.nth atom//field atom)) - (ruby.block! (list (ruby.set-nth! atom//field new atom) - (ruby.return! (ruby.bool #1)))) - (ruby.return! (ruby.bool #0))))) - -(def: runtime//atom - Runtime - (format @@atom//compare-and-swap "\n")) - (runtime: (box//write value box) (ruby.block! (list (ruby.set-nth! (ruby.int 0) value box) (ruby.return! ..unit)))) @@ -263,7 +250,6 @@ runtime//bit "\n" runtime//text "\n" runtime//array "\n" - runtime//atom "\n" runtime//box "\n" runtime//process "\n" )) |