diff options
author | dos-reis <gdr@axiomatics.org> | 2010-06-12 08:39:06 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-06-12 08:39:06 +0000 |
commit | fecb6dc501ce3eeadb6d3f5a39de6a1ac808190d (patch) | |
tree | 323f1ff27b039394706ab2e78c00fa7b544dec91 /src | |
parent | 30e7e66530a05b57abbb3bc29383c45adc5d4ec4 (diff) | |
download | open-axiom-fecb6dc501ce3eeadb6d3f5a39de6a1ac808190d.tar.gz |
* interp/g-opt.boot (replaceableTemporary?): New.
(optSEQ) [getRidOfTemps]: Use it to decide when to safely inline a
temporary variable definition.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/interp/g-opt.boot | 15 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b1d41d6d..56d3b90b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2010-06-12 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/g-opt.boot (replaceableTemporary?): New. + (optSEQ) [getRidOfTemps]: Use it to decide when to safely inline a + temporary variable definition. + +2010-06-12 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/compiler.boot (compIterate): Rewrite. (compRepeatOrCollect): Tidy. Bind $loopBodyTag. diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index be39629b..119da259 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -330,7 +330,18 @@ optCONDtail l == optPredicateIfTrue p => [[$true,c]] null rest l => [frst,[$true,["CondError"]]] [frst,:optCONDtail l'] - + +++ Determine whether the symbol `g' is the name of a temporary that +++ can be replaced in the form `x', if it is of linear usage and not +++ the name of a program point. The latter occurs when THROW forms +++ are changed to %LET form followed by a GO form -- see optCatch. +replaceableTemporary?(g,x) == + GENSYMP g and numOfOccurencesOf(g,x) < 2 and not jumpTarget?(g,x) where + jumpTarget?(g,x) == + isAtomicForm x => false + x is ['GO,=g] => true + or/[jumpTarget?(g,x') for x' in x] + optSEQ ["SEQ",:l] == tryToRemoveSEQ SEQToCOND getRidOfTemps splicePROGN l where splicePROGN l == @@ -339,7 +350,7 @@ optSEQ ["SEQ",:l] == l.rest := splicePROGN rest l getRidOfTemps l == null l => nil - l is [["%LET",g,x,:.],:r] and GENSYMP g and 2>numOfOccurencesOf(g,r) => + l is [["%LET",g,x],:r] and replaceableTemporary?(g,r) => getRidOfTemps substitute(x,g,r) first l="/throwAway" => getRidOfTemps rest l --this gets rid of unwanted labels generated by declarations in SEQs |