aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog5
-rw-r--r--src/interp/g-opt.boot19
2 files changed, 21 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 48770f4c..eacc35d1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2010-07-25 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/g-opt.boot (simplifyVMForm): Don't call optimize.
+ (optCall): Handle VM macro expansions here.
+
+2010-07-25 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/g-opt.boot (resetTo): New.
(optCatch): Use it.
(optCall): Likewise.
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index 5adf1d48..3039e4d1 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -151,10 +151,19 @@ resetTo(x,y) ==
simplifyVMForm x ==
isAtomicForm x => x
x.op = 'CLOSEDFN => x
- x is [op,vars,body] and op in $AbstractionOperator =>
- third(x) := simplifyVMForm body
+ atom x.op =>
+ x is [op,vars,body] and op in $AbstractionOperator =>
+ third(x) := simplifyVMForm body
+ x
+ if x.op = 'IF then
+ resetTo(x,optIF2COND x)
+ for args in tails x.args repeat
+ args.first := simplifyVMForm first args
+ opt := subrname x.op has OPTIMIZE => resetTo(x,FUNCALL(opt,x))
x
- first optimize [x]
+ for xs in tails x repeat
+ xs.first := simplifyVMForm first xs
+ x
optimize x ==
(opt x; x) where
@@ -241,6 +250,10 @@ optSPADCALL(form is ['SPADCALL,:argl]) ==
form
optCall (x is ['%call,:u]) ==
+ u is [['XLAM,vars,body],:args] =>
+ atom vars => body
+ #vars > #args => systemErrorHere ['optCall,x]
+ resetTo(x,optXLAMCond SUBLIS(pairList(vars,args),body))
-- destructively optimizes this new x
x:= optimize [u]
-- next should happen only as result of macro expansion