diff options
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/interp/g-opt.boot | 14 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index aaa16ebf..a3a76592 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-12-09 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * interp/g-opt.boot (packWehn!): New. + (optimize!): Use it. + 2011-12-07 Gabriel Dos Reis <gdr@cs.tamu.edu> * interp/g-opt.boot (tranformIF!): New. 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!'. |