aboutsummaryrefslogtreecommitdiff
path: root/src/interp/g-opt.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-12-15 19:13:10 +0000
committerdos-reis <gdr@axiomatics.org>2011-12-15 19:13:10 +0000
commitc2527210cb847af8e5b1c9ff4fcbd52342195e99 (patch)
treecd952c7fe4ca1106d65ee58a294e1031adfd9b24 /src/interp/g-opt.boot
parentb205d89b9690e256e30e221f331ebd1152e6317c (diff)
downloadopen-axiom-c2527210cb847af8e5b1c9ff4fcbd52342195e99.tar.gz
* interp/g-opt.boot (removeLoopExitTag!): New.
(optimize!): Run it first. * interp/compiler.boot (nullifyTargetingLeaves): Remove. (massageLoop): Likewise. (compRepeatOrCollect): Don't call it anymore.
Diffstat (limited to 'src/interp/g-opt.boot')
-rw-r--r--src/interp/g-opt.boot17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index 453ebbba..37087c9b 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -345,11 +345,26 @@ removeLeave! x == walkWith!(x,function f) where
x is ['%leave,.,y] and y is ['%return,:.] => resetTo(x,y)
x
+removeLoopExitTag! x == walkWith!(x,function f) where
+ f x ==
+ x is ['%scope,tag,['%repeat,:itl,body,val]] =>
+ resetTo(x,['%repeat,:itl,g(body,tag),g(val,tag)])
+ x
+ g(x,tag) ==
+ atomic? x => x
+ x is ['%leave,=tag,y] =>
+ first(x.args) := nil
+ second(x.args) := g(y,tag)
+ x
+ for xs in tails x repeat
+ xs.first := g(first xs,tag)
+ x
+
++ Transform an intermediate form (output of the elaborator) to
++ a lower intermediate form, applying several transformations
++ generaly intended to improve quality and efficiency.
optimize! x ==
- x := spliceSeq! packWhen! transformIF! removeLeave! x
+ x := spliceSeq! packWhen! transformIF! removeLeave! removeLoopExitTag! x
changeVariableDefinitionToStore(x,nil)
simplifyVMForm cancelScopeLeave! spliceSeq! packWhen! inlineLocals!
groupTranscients! cancelScopeLeave! removeJunk! reduceXLAM! x