aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/algebra/list.spad.pamphlet1
-rw-r--r--src/interp/g-opt.boot2
-rw-r--r--src/interp/g-util.boot10
4 files changed, 15 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index dcefe777..f425c99a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2011-12-11 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/g-opt.boot (inlineLocals!): Single-used temporaries should go.
+ (spliceSeqArgs): Splice sequences drapped in %scope cloths too.
+
+2011-12-11 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/compiler.boot (compColon): Give initial %undefined value
to local variable declarations which are not definitions.
* interp/lisp-backend.boot (expandToVMForm): Translate %undefined.
diff --git a/src/algebra/list.spad.pamphlet b/src/algebra/list.spad.pamphlet
index 6e60ef80..ea7960fb 100644
--- a/src/algebra/list.spad.pamphlet
+++ b/src/algebra/list.spad.pamphlet
@@ -207,6 +207,7 @@ List(S:Type): Exports == Implementation where
merge!(f, p, q) ==
empty? p => q
empty? q => p
+ r,t: %
%peq(p, q) => error "cannot merge a list into itself"
if f(%head p, %head q)
then (r := t := p; p := %tail p)
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