aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-07-25 12:28:00 +0000
committerdos-reis <gdr@axiomatics.org>2010-07-25 12:28:00 +0000
commit38a994bc4661e90cf6f7d77c3d9223aa385b5d56 (patch)
treeebb1643f001e201e0ba4074136f6f04a560b52d7 /src/interp
parent7766e42778a0bfe271b35d6265122ca7103da24c (diff)
downloadopen-axiom-38a994bc4661e90cf6f7d77c3d9223aa385b5d56.tar.gz
* interp/g-opt.boot (simplifyVMForm): Don't call optimize.
(optCall): Handle VM macro expansions here.
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/g-opt.boot19
1 files changed, 16 insertions, 3 deletions
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