aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-12-11 19:57:34 +0000
committerdos-reis <gdr@axiomatics.org>2011-12-11 19:57:34 +0000
commit2159e0cec3aa62a8822f1f42f0d14b55df445676 (patch)
tree51fc54b8838ba03a8bc7b8f4e4af28849969b668 /src/interp
parentd60b0772098f0907850b7cc520224a1bfb093e44 (diff)
downloadopen-axiom-2159e0cec3aa62a8822f1f42f0d14b55df445676.tar.gz
* interp/g-opt.boot (inlineLocals!): Single-used temporaries should go.
(spliceSeqArgs): Splice sequences drapped in %scope cloths too.
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/g-opt.boot2
-rw-r--r--src/interp/g-util.boot10
2 files changed, 9 insertions, 3 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index 23f53c16..1e2703d7 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -239,6 +239,8 @@ removeSeq! x == walkWith!(x,function f) where
inlineLocals! x == walkWith!(x,function f) where
f x ==
+ x is ['%bind,[[y,a]],z] and gensym? y and numOfOccurencesOf(y,z) = 1 =>
+ resetTo(x,f substitute!(a,y,z))
x is ['%bind,inits,:.] =>
kept := nil
while inits is [u,:inits] repeat
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index 8313c000..3b1782f9 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -96,15 +96,19 @@ splitAssignments! u == main(u,nil) where
++ an %exit-form in it. In particular, it should be called
++ (if at all) before any call to simplifyVMForm.
spliceSeqArgs l ==
- atomic? l => l
+ l = nil => l
s := first l
s is ['%seq,:.] =>
stmts := spliceSeqArgs s.args
stmts = nil => spliceSeqArgs rest l
lastNode(stmts).rest := spliceSeqArgs rest l
stmts
- s is ['%LET,x,y] and (stmts := splitAssignments y) =>
- lastNode(stmts).rest := [['%LET,x,second y],:spliceSeqArgs rest l]
+ s is ['%scope,tag,['%seq,:ys,['%leave,=tag,z]]] and hasNoLeave?(ys,tag) =>
+ stmts := spliceSeqArgs [:ys,z]
+ lastNode(stmts).rest := spliceSeqArgs rest l
+ stmts
+ s is ['%LET,:.] and (stmts := splitAssignments! s) =>
+ lastNode(stmts).rest := [s,:spliceSeqArgs rest l]
stmts
rest l = nil => l
l.rest := spliceSeqArgs rest l