aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-07-24 01:50:09 +0000
committerdos-reis <gdr@axiomatics.org>2010-07-24 01:50:09 +0000
commitc19e54f03e3230811e6c86998568ce63ccbc42c9 (patch)
treeea96f5e883e0aa28215c397677fcd213b10d6735
parent3a373a0b802ee86308db78cba8696aa7b6cdf4df (diff)
downloadopen-axiom-c19e54f03e3230811e6c86998568ce63ccbc42c9.tar.gz
* interp/compiler.boot (compMatchAlternative): Don't generate
LET-expressions. * interp/g-opt.boot (optBind): Tidy.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/boot/strap/tokens.clisp1
-rw-r--r--src/boot/tokens.boot3
-rw-r--r--src/interp/compiler.boot3
-rw-r--r--src/interp/g-opt.boot16
5 files changed, 22 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index de27a6a5..832d9d5a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
2010-07-23 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/compiler.boot (compMatchAlternative): Don't generate
+ LET-expressions.
+ * interp/g-opt.boot (optBind): Tidy.
+
+2010-07-23 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/g-opt.boot (optBind): Check for dependencies in
initializations in %bind expressions.
* interp/g-util.boot (expandBind): The body of s %bind expression
diff --git a/src/boot/strap/tokens.clisp b/src/boot/strap/tokens.clisp
index 5b02904d..94923a97 100644
--- a/src/boot/strap/tokens.clisp
+++ b/src/boot/strap/tokens.clisp
@@ -229,6 +229,7 @@
(LIST '|setPart| 'SETELT) (LIST '|setUnion| 'UNION)
(LIST '|strconc| 'CONCAT) (LIST '|string?| 'STRINGP)
(LIST '|substitute| 'SUBST)
+ (LIST '|substitute!| 'NSUBST)
(LIST '|symbol?| 'SYMBOLP) (LIST '|take| 'TAKE)
(LIST '|third| 'CADDR) (LIST '|true| 'T)
(LIST '|upperCase?| 'UPPER-CASE-P)
diff --git a/src/boot/tokens.boot b/src/boot/tokens.boot
index e5160acd..1424c6cd 100644
--- a/src/boot/tokens.boot
+++ b/src/boot/tokens.boot
@@ -280,7 +280,8 @@ for i in [ _
["setUnion", "UNION"] , _
["strconc", "CONCAT"] , _
["string?", "STRINGP"] ,_
- ["substitute", "SUBST"] , _
+ ["substitute", "SUBST"] , _
+ ["substitute!", "NSUBST"] , _
["symbol?", "SYMBOLP"] , _
["take", "TAKE"] ,
["third", "CADDR"] , _
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index 4999b870..85f796bc 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -2169,8 +2169,7 @@ compMatchAlternative(sn,sm,pat,stmt,m,e) ==
stackAndThrow('"could not compile %1b under mode %2pb",[stmt,m])
body :=
null inits => stmtT.expr
- atom sn => ["LET",inits,stmtT.expr]
- ["%bind",inits,stmtT.expr]
+ ['%bind,inits,stmtT.expr]
[[guard,body],stmtT.mode,stmtT.env,eF]
++ Analyze and generate code for `is case'-pattern where the
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index a42dc1ac..ccde3eb8 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -590,10 +590,18 @@ optLET_* form ==
optLET form
optBind form ==
- form isnt ['%bind,inits,body] => form -- inline only simple expressions
- inits = nil => body -- no local variable, OK.
- inits isnt [[var,expr]] => form -- too many local variables
- canInlineVarDefinition(var,expr,body) => substitute(expr,var,body)
+ form isnt ['%bind,inits,.] => form -- accept only simple bodies
+ ok := true
+ while ok and inits ~= nil repeat
+ [var,expr] := first inits
+ usedSymbol?(var,rest inits) => ok := false -- no dependency, please.
+ body := third form
+ canInlineVarDefinition(var,expr,body) and isSimpleVMForm expr =>
+ third(form) := substitute_!(expr,var,body)
+ inits := rest inits
+ ok := false
+ null inits => third form -- no local var left
+ second(form) := inits
form
optLIST form ==