From 4138cd725e18c6ef55742f351af2adc59ff256c7 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 12 Jun 2020 23:26:55 -0400 Subject: Optimizing-away unnecessary variable declarations/bindings. --- lux-jvm/source/luxc/lang/translation/jvm/case.lux | 29 ++++++++++------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'lux-jvm/source') 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 [ ] + (^ ( lefts)) + (operation@wrap (|>> peekI + ( lefts) + pushI)) + (^ (synthesis.path/seq ( 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) -- cgit v1.2.3