aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm/source/luxc/lang/translation/jvm
diff options
context:
space:
mode:
authorEduardo Julian2020-06-12 23:26:55 -0400
committerEduardo Julian2020-06-12 23:26:55 -0400
commit4138cd725e18c6ef55742f351af2adc59ff256c7 (patch)
tree3b17b3a51e8e2a02d94db5d539648d980e7cf14b /lux-jvm/source/luxc/lang/translation/jvm
parentdef9629b35a434b3441aa15b89746b21d6c298ec (diff)
Optimizing-away unnecessary variable declarations/bindings.
Diffstat (limited to 'lux-jvm/source/luxc/lang/translation/jvm')
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/case.lux29
1 files changed, 12 insertions, 17 deletions
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
index e21cf9aec..7962ea991 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
@@ -153,18 +153,13 @@
([synthesis.side/left _.NULL function.identity]
[synthesis.side/right (_.string "") .inc])
- (^ (synthesis.member/left lefts))
- (operation@wrap (|>> peekI
- (..left-projection lefts)
- pushI))
-
- (^ (synthesis.member/right lefts))
- (operation@wrap (|>> peekI
- (..right-projection lefts)
- pushI))
-
## Extra optimization
(^template [<path> <projection>]
+ (^ (<path> lefts))
+ (operation@wrap (|>> peekI
+ (<projection> lefts)
+ pushI))
+
(^ (synthesis.path/seq
(<path> lefts)
(synthesis.!bind-top register thenP)))
@@ -177,6 +172,13 @@
([synthesis.member/left ..left-projection]
[synthesis.member/right ..right-projection])
+ (#synthesis.Seq leftP rightP)
+ (do phase.monad
+ [leftI (path' stack-depth @else @end phase archive leftP)
+ rightI (path' stack-depth @else @end phase archive rightP)]
+ (wrap (|>> leftI
+ rightI)))
+
(#synthesis.Alt leftP rightP)
(do phase.monad
[@alt-else _.make-label
@@ -187,13 +189,6 @@
(_.label @alt-else)
_.POP
rightI)))
-
- (#synthesis.Seq leftP rightP)
- (do phase.monad
- [leftI (path' stack-depth @else @end phase archive leftP)
- rightI (path' stack-depth @else @end phase archive rightP)]
- (wrap (|>> leftI
- rightI)))
))
(def: (path @end phase archive path)