aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/interp/c-util.boot17
2 files changed, 20 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4c92874a..e482a465 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-02 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ * interp/c-util.boot (updateCapsuleDirectory): Record constant
+ makers too.
+ (replaceSimpleFunctions): Fold simple constant form makers.
+
2009-01-01 Gabriel Dos Reis <gdr@cs.tamu.edu>
* interp/pf2sex.boot (pfLiteral2Sex): Fix evaluation of intergers
diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot
index 29debb01..3bcf12c2 100644
--- a/src/interp/c-util.boot
+++ b/src/interp/c-util.boot
@@ -900,10 +900,15 @@ getCapsuleDirectoryEntry slot ==
++ Update the current capsule directory with entry controlled by
++ predicate `pred'.
-updateCapsuleDirectory(entry,pred) ==
+updateCapsuleDirectory(item,pred) ==
pred ^= true => nil
- entry isnt ["$",slot,["CONS",["dispatchFunction",fun],:.],:.] => nil
- $capsuleDirectory := [[slot,:fun],:$capsuleDirectory]
+ entry :=
+ item is ["$",slot,["CONS",["dispatchFunction",fun],:.],:.] => [slot,:fun]
+ item is ["$",slot,["CONS","IDENTITY",
+ ["FUNCALL",["dispatchFunction",fun],"$"]]] => [slot,:fun]
+ nil
+ entry = nil => nil
+ $capsuleDirectory := [entry,:$capsuleDirectory]
@@ -989,6 +994,12 @@ replaceSimpleFunctions form ==
mutateCONDFormWithUnaryFunction(form,"replaceSimpleFunctions")
form is ["LET",:.] =>
optLET mutateLETFormWithUnaryFunction(form,"replaceSimpleFunctions")
+ form is ["spadConstant","$",n] =>
+ null(op := getCapsuleDirectoryEntry n) => form
+ getFunctionReplacement op is ["XLAM",=nil,body] and atom body => body
+ -- Conservatively preserve object identity and storage
+ -- consumption by not folding non-atomic constant forms.
+ form
-- 1. process argument first.
for args in tails rest form repeat
arg' := replaceSimpleFunctions(arg := first args)