diff options
author | dos-reis <gdr@axiomatics.org> | 2011-12-09 13:15:21 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-12-09 13:15:21 +0000 |
commit | 8a611731641d07f5aa91b1f0bee080afe8e6af94 (patch) | |
tree | 9061b46054aa387203a188d09c1f7250f1634886 /src/interp | |
parent | 13234d734eae71bbeb29c5280f27b0bf6eb3a839 (diff) | |
download | open-axiom-8a611731641d07f5aa91b1f0bee080afe8e6af94.tar.gz |
* interp/g-opt.boot (packWehn!): New.
(optimize!): Use it.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/g-opt.boot | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index 0b972171..9b09860a 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -263,11 +263,23 @@ transformIF! x == walkWith!(x,function f) where resetTo(x,['%when,[p,s1],['%otherwise,s2]]) x +++ Transform nested-to-tower. +packWhen! x == walkWith!(x,function f) where + f x == + x is ['%when,[p1,['%when,[p2,s]]]] => + resetTo(x,f ['%when,[['%and,p1,p2],s]]) + x is ['%when,:cl,['%otherwise,y]] and y is ['%when,:.] => + resetTo(x,f ['%when,:cl,:y.args]) + x is ['%scope,g,['%seq,['%when,[p,['%leave,=g,y]]],['%leave,=g,z]]] + and hasNoLeave?(p,g) => + resetTo(x,f ['%when,[p,y],['%otherwise,mkScope(g,z)]]) + 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 == - simplifyVMForm transformIF! removeSeq! inlineLocals! + simplifyVMForm packWhen! transformIF! removeSeq! inlineLocals! groupTranscients! reduceXLAM! x ++ A non-mutating version of `optimize!'. |