diff options
author | dos-reis <gdr@axiomatics.org> | 2011-12-01 21:11:07 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-12-01 21:11:07 +0000 |
commit | 020475072e466165432ff92e35d9008eaf36ee2e (patch) | |
tree | 542f8f9dbf191b8d90aafc5526916a692819a632 /src | |
parent | 3e5d6ea25b7f3964e40bbcb76437ca637f533691 (diff) | |
download | open-axiom-020475072e466165432ff92e35d9008eaf36ee2e.tar.gz |
* interp/g-opt.boot (groupVariableDefinitions): Look through
%labelled and %lambda.
(optimizeFunctionDef): Use copyTree, not COPY. Simplify.
(simplifyVMForm): Perform changeVariableDefinitionToStore and
groupVariableDefinitions on abstraction forms.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 8 | ||||
-rw-r--r-- | src/interp/g-opt.boot | 13 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 423f6387..f90a83db 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2011-12-01 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/g-opt.boot (groupVariableDefinitions): Look through + %labelled and %lambda. + (optimizeFunctionDef): Use copyTree, not COPY. Simplify. + (simplifyVMForm): Perform changeVariableDefinitionToStore and + groupVariableDefinitions on abstraction forms. + +2011-12-01 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/define.boot (compDefineCategory): Lose prefix parameter. It is always nil. Adjust caller. (compDefineCategory1): Likewise. diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index 5cdf2d66..67b6aca9 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -123,6 +123,10 @@ groupVariableDefinitions form == for clause in form.args while not CONTAINED('%LET, first clause) repeat second(clause) := groupVariableDefinitions second clause form + form is ['%labelled,tag,expr] => + [form.op,tag,groupVariableDefinitions expr] + form is ['%lambda,:.] => + [form.absKind,form.absParms,groupVariableDefinitions form.absBody] form isnt ['SEQ,:stmts,['EXIT,val]] => form defs := nil for x in stmts while nonExitingSingleAssignment? x repeat @@ -139,7 +143,7 @@ optimizeFunctionDef(def) == sayBrightlyI bright '"Original LISP code:" pp def - def' := simplifyVMForm COPY def + def' := simplifyVMForm copyTree def if $reportOptimization then sayBrightlyI bright '"Intermediate VM code:" @@ -147,7 +151,7 @@ optimizeFunctionDef(def) == [name,[slamOrLam,args,body]] := def' - body':= + body' := removeTopLevelLabel body where removeTopLevelLabel body == body is ['%labelled,g,u] => @@ -163,8 +167,7 @@ optimizeFunctionDef(def) == x isnt [.,:.] => nil replaceLeaveByReturn(first x,g) replaceLeaveByReturn(rest x,g) - changeVariableDefinitionToStore(body',args) - [name,[slamOrLam,args,groupVariableDefinitions body']] + [name,[slamOrLam,args,body']] resetTo(x,y) == y isnt [.,:.] => x := y @@ -182,6 +185,8 @@ simplifyVMForm x == x.op isnt [.,:.] => symbol? x.op and abstractionOperator? x.op => x.absBody := simplifyVMForm x.absBody + changeVariableDefinitionToStore(x.absBody,x.absParms) + x.absBody := groupVariableDefinitions x.absBody x if x.op is 'IF then resetTo(x,optIF2COND x) |