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 /new-luxc/source/luxc/lang/translation/common-lisp | |
parent | 748c868680683df1949f62aac274040ac5bf43da (diff) |
Now implementing atom functionality in stdlib instead of the compiler.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/common-lisp')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux | 26 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux | 14 |
2 files changed, 6 insertions, 34 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)) |