From 38a994bc4661e90cf6f7d77c3d9223aa385b5d56 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 25 Jul 2010 12:28:00 +0000 Subject: * interp/g-opt.boot (simplifyVMForm): Don't call optimize. (optCall): Handle VM macro expansions here. --- src/ChangeLog | 5 +++++ src/interp/g-opt.boot | 19 ++++++++++++++++--- 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,3 +1,8 @@ +2010-07-25 Gabriel Dos Reis + + * interp/g-opt.boot (simplifyVMForm): Don't call optimize. + (optCall): Handle VM macro expansions here. + 2010-07-25 Gabriel Dos Reis * interp/g-opt.boot (resetTo): New. 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 -- cgit v1.2.3