From 9dbd3ec86d35a386d291fd59612ef7bb9a5b9ecf Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sat, 28 Apr 2012 22:18:23 +0000 Subject: * interp/compiler.boot (finishLambdaExpression): Tidy. (compWithMappingMode): Use %lambda not LAMBDA. * interp/g-opt.boot (changeVariableDefinitionToStore): Handle %closure. --- src/ChangeLog | 6 ++++++ src/interp/compiler.boot | 4 ++-- src/interp/g-opt.boot | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index acb3a248..4e45dcb6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-04-28 Gabriel Dos Reis + + * interp/compiler.boot (finishLambdaExpression): Tidy. + (compWithMappingMode): Use %lambda not LAMBDA. + * interp/g-opt.boot (changeVariableDefinitionToStore): Handle %closure. + 2012-04-28 Gabriel Dos Reis * interp/boot-pkg.lisp (gensym?): Check for non-null object. diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 9605b35b..71b679bc 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -304,7 +304,7 @@ freeVarUsage([.,vars,body],env) == ++ Finish processing a lambda expression with parameter list `vars', ++ and `env' as the environement after the compilation its body. -finishLambdaExpression(expr is ["LAMBDA",vars,.],env) == +finishLambdaExpression(expr is ['%lambda,vars,.],env) == $FUNNAME: local := nil $FUNNAME__TAIL: local := [nil] expandedFunction := transformToBackendCode expr @@ -355,7 +355,7 @@ compWithMappingMode(x,m is ["Mapping",m',:sl],oldE) == [u,.,.] := t [extractCode(u,nil),m,oldE] [u,.,.]:= comp(x,m',e) or return nil - [.,fun] := optimizeFunctionDef [nil,["LAMBDA",vl,u]] + [.,fun] := optimizeFunctionDef [nil,['%lambda,vl,u]] [finishLambdaExpression(fun,e),m,oldE] extractCode(u,vars) == diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index 57f518f1..ecf4b08c 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -101,7 +101,7 @@ changeLoopVarDefsToStore(iters,body,val,vars) == ++ updated as opposed to being defined. `vars' is the list of ++ all variable definitions in scope. changeVariableDefinitionToStore(form,vars) == - atomic? form or form.op is 'CLOSEDFN or form.op is 'XLAM => vars + atomic? form or form.op in '(CLOSEDFN XLAM) => vars form is ['%LET,v,expr] => vars := changeVariableDefinitionToStore(expr,vars) do @@ -140,6 +140,9 @@ changeVariableDefinitionToStore(form,vars) == vars form is ['%repeat,:iters,body,val] => changeLoopVarDefsToStore(iters,body,val,vars) + form is ['%closure,fun,env] => + changeVariableDefinitionToStore(fun,vars) + vars if form is ['%seq,:.] then form.args := spliceSeqArgs form.args for x in form repeat @@ -149,6 +152,7 @@ changeVariableDefinitionToStore(form,vars) == ++ Return true if `x' contains control transfer to a point outside itself. jumpToToplevel? x == atomic? x => false + abstraction? x or op is '%closure => false op := x.op op is '%seq => CONTAINED('%leave,x.args) -- FIXME: what about GO? op in '(%exit %leave) => true -- cgit v1.2.3