aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm/source/luxc/lang
diff options
context:
space:
mode:
Diffstat (limited to 'lux-jvm/source/luxc/lang')
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/case.lux3
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/loop.lux25
2 files changed, 14 insertions, 14 deletions
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
index 23f84ad4e..421f413a0 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
@@ -23,8 +23,7 @@
[archive (#+ Archive)]]
[language
[lux
- ["." synthesis (#+ Path Synthesis)
- ["#/." case]]]]]]]
+ ["." synthesis (#+ Path Synthesis)]]]]]]
[luxc
[lang
[host
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux
index 10fb23cbd..27a7d58f9 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux
@@ -8,7 +8,7 @@
[number
["n" nat]]
[collection
- ["." list ("#/." functor monoid)]]]
+ ["." list ("#@." functor monoid)]]]
[tool
[compiler
["." phase]
@@ -25,11 +25,11 @@
["_" inst]]]]]
["." //])
-(def: (invariant? register changeS)
+(def: (invariant? expected actual)
(-> Register Synthesis Bit)
- (case changeS
- (^ (synthesis.variable/local var))
- (n.= register var)
+ (case actual
+ (^ (synthesis.variable/local actual))
+ (n.= expected actual)
_
false))
@@ -38,24 +38,25 @@
(Generator (List Synthesis))
(do {@ phase.monad}
[[@begin start] generation.anchor
- #let [end (|> argsS list.size dec (n.+ start))
- pairs (list.zip2 (list.n/range start end)
- argsS)]
+ #let [pairs (|> argsS
+ list.enumerate
+ (list@map (function (_ [register argument])
+ [(n.+ start register) argument])))]
## It may look weird that first I compile the values separately,
## and then I compile the stores/allocations.
## It must be done that way in order to avoid a potential bug.
## Let's say that you'll recur with 2 expressions: X and Y.
## If Y depends on the value of X, and you don't compile values
## and stores separately, then by the time Y is evaluated, it
- ## will refer to the new value of X, instead of the old value, as
- ## should be the case.
+ ## will refer to the new value of X, instead of the old value, and
+ ## shouldn't be the case.
valuesI+ (monad.map @ (function (_ [register argS])
(: (Operation Inst)
(if (invariant? register argS)
(wrap function.identity)
(translate archive argS))))
pairs)
- #let [storesI+ (list/map (function (_ [register argS])
+ #let [storesI+ (list@map (function (_ [register argS])
(: Inst
(if (invariant? register argS)
function.identity
@@ -73,7 +74,7 @@
iterationI (generation.with-anchor [@begin start]
(translate archive iterationS))
#let [initializationI (|> (list.enumerate initsI+)
- (list/map (function (_ [register initI])
+ (list@map (function (_ [register initI])
(|>> initI
(_.ASTORE (n.+ start register)))))
_.fuse)]]